Abhina Sreeskantharajan [Mon, 25 Jan 2021 13:02:27 +0000 (08:02 -0500)]
Revert "[SystemZ][z/OS] Fix No such file or directory expression error matching in lit tests - continued"
This reverts commit
520b5ecf856152f35ee38207eec39f5674dd2bd4.
Tom Ritter [Mon, 25 Jan 2021 13:06:54 +0000 (08:06 -0500)]
Add a --use-color option to clang-query to allow forcing the behavior
D62056 makes the output color if clang auto-detects a tty, but if it
does not, there is no way to force it to use colors anyway.
This patch adjusts the command-lines given to ClangTool which will
force color on or off if --use-color is specified.
Sanjay Patel [Sun, 24 Jan 2021 17:57:11 +0000 (12:57 -0500)]
[InstCombine] narrow min/max intrinsics with extended inputs
We can sink extends after min/max if they match and would
not change the sign-interpreted compare. The only combo
that doesn't work is zext+smin/smax because the zexts
could change a negative number into positive:
https://alive2.llvm.org/ce/z/D6sz6J
Sext+umax/umin works:
define i32 @src(i8 %x, i8 %y) {
%0:
%sx = sext i8 %x to i32
%sy = sext i8 %y to i32
%m = umax i32 %sx, %sy
ret i32 %m
}
=>
define i32 @tgt(i8 %x, i8 %y) {
%0:
%m = umax i8 %x, %y
%r = sext i8 %m to i32
ret i32 %r
}
Transformation seems to be correct!
Sanjay Patel [Sun, 24 Jan 2021 17:37:38 +0000 (12:37 -0500)]
[InstCombine] add tests for min/max intrinsics with extended values; NFC
Sven van Haastregt [Mon, 25 Jan 2021 12:43:30 +0000 (12:43 +0000)]
Revert "[clang] Fix signedness in vector bitcast evaluation"
This reverts commit
14947cd04701d923a57a0161fd1967b81e00ff5e because
it broke clang-cmake-armv7-quick.
Nicolas Vasilache [Mon, 25 Jan 2021 11:48:39 +0000 (11:48 +0000)]
[mlir][Linalg] Add a hoistPaddingOnTensors transformation
This transformation anchors on a padding op whose result is only used as an input
to a Linalg op and pulls it out of a given number of loops.
The result is a packing of padded tailes of ops that is amortized just before
the outermost loop from which the pad operation is hoisted.
Differential revision: https://reviews.llvm.org/D95243
Faris Rehman [Mon, 25 Jan 2021 12:07:17 +0000 (12:07 +0000)]
[flang][driver] Update PP tests to use the new driver
Update the preprocessor regression tests to use the new driver if the new driver is built (FLANG_BUILD_NEW_DRIVER=On), otherwise the tests will still run using f18.
Summary of changes:
- Introduce %flang to the regression tests, which points to the new driver if it is built or otherwise points to f18
- Update all tests in flang/test/Preprocessing/ to use %flang
Differential Revision: https://reviews.llvm.org/D94805
Sander de Smalen [Wed, 20 Jan 2021 09:10:24 +0000 (09:10 +0000)]
[SLPVectorizer] NFC: Migrate getVectorCallCosts to use InstructionCost.
This change also changes getReductionCost to return InstructionCost,
and it simplifies two expressions by removing a redundant 'isValid' check.
Simon Pilgrim [Mon, 25 Jan 2021 12:10:12 +0000 (12:10 +0000)]
[X86][AVX] LowerTRUNCATE - avoid bitcasts around extract_subvectors.
We allow extract_subvector lowering of all legal types, so pre-bitcast the source type to try and reduce bitcast pollution.
Sven van Haastregt [Mon, 25 Jan 2021 12:01:42 +0000 (12:01 +0000)]
[clang] Fix signedness in vector bitcast evaluation
The included test case triggered a sign assertion on the result in
`Success()`. This was caused by the APSInt created for a bitcast
having its signedness bit inverted. The second APSInt constructor
argument is `isUnsigned`, so invert the result of
`isSignedIntegerType`.
Differential Revision: https://reviews.llvm.org/D95135
Faris Rehman [Mon, 25 Jan 2021 11:58:52 +0000 (11:58 +0000)]
[flang][driver] Remove newline in CompilerInvocation
Remove a new line in CompilerInvocation, to now follow the style when clang-format is applied.
Simon Pilgrim [Mon, 25 Jan 2021 11:10:17 +0000 (11:10 +0000)]
[X86][AVX] combineX86ShuffleChain - avoid bitcasts around insert_subvector() shuffle patterns.
We allow insert_subvector lowering of all legal types, so don't always cast to the vXi64/vXf64 shuffle types - this is only necessary for X86ISD::SHUF128/X86ISD::VPERM2X128 patterns later.
Simon Pilgrim [Sat, 23 Jan 2021 18:01:12 +0000 (18:01 +0000)]
[TableGen] RuleMatcher::defineComplexSubOperand avoid std::string copy. NFCI.
Use const reference to avoid std::string copy - accordingly to the style guide we shouldn't be using auto anyway.
Fixes MSVC analyzer warning.
Sander de Smalen [Thu, 21 Jan 2021 16:37:09 +0000 (16:37 +0000)]
[InstructionCost] Prevent InstructionCost being created with CostState.
For a function that returns InstructionCost, it is very tempting to write:
return InstructionCost::Invalid;
But that actually returns InstructionCost(1 /* int value of Invalid */))
which has a totally different meaning. By marking this constructor as
`delete`, this can no longer happen.
Anastasia Stulova [Mon, 25 Jan 2021 11:17:03 +0000 (11:17 +0000)]
[OpenCL][Docs] Describe tablegen BIFs declarations.
Added documentation for the fast builtin
function declarations with -fdeclare-opencl-builtins.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D95038
Fraser Cormack [Fri, 8 Jan 2021 09:32:15 +0000 (09:32 +0000)]
[SelectionDAG] Support scalable-vector splats in more cases
This patch adds support for scalable-vector splats in DAGCombiner's
`isConstantOrConstantVector` and `ISD::matchUnaryPredicate` functions,
which enable the SelectionDAG div/rem-by-constant optimizations for
scalable vector types.
It also fixes up one case where the UDIV optimization was generating a
SETCC without first consulting the target for its preferred SETCC result
type.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94501
Philip Pfaffe [Mon, 25 Jan 2021 10:05:13 +0000 (11:05 +0100)]
[llvm-dwp] Automatically set the target triple
The llvm-dwp tool hard-codes the target triple to x86. Instead, deduce the
target triple from the object files being read.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D93749
Benjamin Kramer [Mon, 25 Jan 2021 10:48:58 +0000 (11:48 +0100)]
[mlir] Perfectly forward ImplicitLocOpBuilder ctors to OpBuilder
This is both cleaner and less prone to creating a mess out of overload
resolution.
Georgii Rymar [Mon, 25 Jan 2021 10:23:58 +0000 (13:23 +0300)]
[ObjectYAML] - An attempt to fix BB after commit of D95140.
D95140 introduced `static constexpr StringRef TypeStr = "SectionHeaderTable";` member
of `SectionHeaderTable` with in-class initialized. BB reports the link error:
/usr/bin/ld: lib/libLLVMObjectYAML.a(ELFYAML.cpp.o): in function
`llvm::yaml::MappingTraits<std::unique_ptr<llvm::ELFYAML::Chunk, std::default_delete<llvm::ELFYAML::Chunk> > >::mapping(llvm::yaml::IO&, std::unique_ptr<llvm::ELFYAML::Chunk, std::default_delete<llvm::ELFYAML::Chunk> >&)':
ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x58): undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x353):undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
/usr/bin/ld: ELFYAML.cpp:(.text._ZN4llvm4yaml13MappingTraitsISt10unique_ptrINS_7ELFYAML5ChunkESt14default_deleteIS4_EEE7mappingERNS0_2IOERS7_+0x6e5): undefined reference to `llvm::ELFYAML::SectionHeaderTable::TypeStr'
This patch adds a definition to cpp file, I guess it should fix the issue.
Kirill Bobyrev [Mon, 25 Jan 2021 10:09:56 +0000 (11:09 +0100)]
[clang] NFC: Remove else-after-return pattern from some files
Follow-up on D95336. A bunch of these cases were found manually, the
rest made sense to be included to eliminate llvm-else-after-return
Clang-Tidy warnings.
Georgii Rymar [Tue, 19 Jan 2021 14:02:08 +0000 (17:02 +0300)]
[yaml2obj, obj2yaml] - Implement section header table as a special Chunk.
This was discussed in D93678 thread.
Currently we have one special chunk - Fill.
This patch re implements the "SectionHeaderTable" key to become a special chunk too.
With that we are able to place the section header table at any location,
just like we place sections.
Differential revision: https://reviews.llvm.org/D95140
Marek Kurdej [Mon, 25 Jan 2021 09:59:47 +0000 (10:59 +0100)]
[clang-format] [docs] Fix RST indentation.
James Henderson [Thu, 21 Jan 2021 11:13:30 +0000 (11:13 +0000)]
[lld][ELF][test] Add testing for IE/LD TLS weak undef references
Whilst migrating/retiring some downstream testing, I came across a test
for weak undef IE and LD TLS references, but was unable to find any
equivalent in LLD's upstream testing. There does seem to be some slight
subtle differences that could be worth testing compared to LE TLS
references, in particular that IE can be relaxed to LE in this case,
hence this change.
Differential Revision: https://reviews.llvm.org/D95124
Reviewed by: grimar, MaskRay
Kirill Bobyrev [Mon, 25 Jan 2021 09:58:15 +0000 (10:58 +0100)]
[clang] NFC: Remove else if after return
Update the code to be compatible with LLVM Coding Guidelines.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D95336
Nicolas Vasilache [Mon, 25 Jan 2021 09:11:31 +0000 (09:11 +0000)]
[mlir][Linalg] Add a padding option to Linalg tiling
This revision allows the base Linalg tiling pattern to optionally require padding to
a constant bounding shape.
When requested, a simple analysis is performed, similar to buffer promotion.
A temporary `linalg.simple_pad` op is added to model padding for the purpose of
connecting the dots. This will be replaced by a more fleshed out `linalg.pad_tensor`
op when it is available.
In the meantime, this temporary op serves the purpose of exhibiting the necessary
properties required from a more fleshed out pad op, to compose with transformations
properly.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D95149
Sjoerd Meijer [Mon, 25 Jan 2021 08:48:04 +0000 (08:48 +0000)]
[AArch64] Add Cortex CPU subtarget features for instruction fusion.
This adds subtarget features for AES, literal, and compare and branch
instruction fusion for different Cortex CPUs.
Patch by: Cassie Jones.
Differential Revision: https://reviews.llvm.org/D94457
Simon Cook [Mon, 25 Jan 2021 08:58:53 +0000 (08:58 +0000)]
[RISCV] Add attribute support for all supported extensions
This adds support for ".attribute arch" for all extensions that are
currently supported by the compiler.
Differential Revision: https://reviews.llvm.org/D94931
Simon Cook [Mon, 25 Jan 2021 08:58:46 +0000 (08:58 +0000)]
[RISCV] Implement new architecture extension macros
This adds support for the new architecture extension test macros as
defined in the C-API Document:
https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md
Extension versions have been taken from what are used in
RISCVTargetStreamer for ratified extensions, and the -march parser
for experimental extensions.
Differential Revision: https://reviews.llvm.org/D94403
Marek Kurdej [Mon, 25 Jan 2021 08:50:03 +0000 (09:50 +0100)]
[libc++] Set CMAKE_FOLDER. NFC.
* This variable populates the default value of FOLDER target property. It is used in some IDE's (e.g. MSVC) to group different targets together.
Fangrui Song [Mon, 25 Jan 2021 08:49:18 +0000 (00:49 -0800)]
[XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering
Fangrui Song [Mon, 25 Jan 2021 08:26:54 +0000 (00:26 -0800)]
[XRay] Make __xray_customevent support non-Linux
Haojian Wu [Mon, 25 Jan 2021 08:42:06 +0000 (09:42 +0100)]
Fix a build-bot failure.
The test ms-lookup-template-base-classes.cpp added in
d972d4c749048531953a16b815e07c67e8455a3b
is failing on some builtbot that don't include x86.
This patch should fix that (following the patterns in the test directory).
Lukas Barth [Mon, 25 Jan 2021 08:30:02 +0000 (09:30 +0100)]
[clang-format] Add the possibility to align assignments spanning empty lines or comments
Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf
Differential Revision: https://reviews.llvm.org/D93986
Marek Kurdej [Mon, 25 Jan 2021 08:40:46 +0000 (09:40 +0100)]
Revert "[clang-format] Add the possibility to align assignments spanning empty lines or comments"
This reverts commit
f00a20e51c1d186e72844939aad10416e1cc99de.
Marek Kurdej [Mon, 25 Jan 2021 08:30:02 +0000 (09:30 +0100)]
[clang-format] Add the possibility to align assignments spanning empty lines or comments
Currently, empty lines and comments break alignment of assignments on consecutive
lines. This makes the AlignConsecutiveAssignments option an enum that allows controlling
whether empty lines or empty lines and comments should be ignored when aligning
assignments.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, tinloaf
Differential Revision: https://reviews.llvm.org/D93986
Ben Shi [Mon, 25 Jan 2021 08:33:58 +0000 (16:33 +0800)]
Revert "[clang][AVR] Improve avr-ld command line options"
This reverts commit
89a5147e5a0c2e886cdf7ffa34799c069d825940.
Jan Svoboda [Mon, 25 Jan 2021 07:42:44 +0000 (08:42 +0100)]
[clang][cli] NFC: Pass CC1Option explicitly to BoolOption
When `Bool{F,G}Option` were introduced, they were designed after the existing `Opt{In,Out}FFlag` in that they implied `CC1Option` for the `ChangedBy` flag.
This means less typing, but can be misleading in situations when the `ResetBy` has explicit `CC1Option` and `ChangedBy` doesn't.
This patch stops implicitly putting `CC1Option` to `ChangedBy` flag.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95225
Jan Svoboda [Mon, 25 Jan 2021 07:41:41 +0000 (08:41 +0100)]
[clang][cli] NFC: Move prefix to the front of BoolOption
The prefix used to be the last (optional) argument to BoolOption. This decision was made with the expectation that only few command line options would need to pass it explicitly instead of using Bool{F,G}Option. It turns out that a considerable number of options don't conform to Bool{F,G}Option and need to provide the prefix anyways. This sometimes requires to explicitly pass `BothFlags<[]>`.
This patch makes prefix the first parameter, so it now directly precedes the spelling base string. Now 8 options dropped `BothFlags<[]>` and only two options (`pthread` and `emit_llvm_uselists`) need to pass an empty prefix.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95221
Andre Vieira [Mon, 25 Jan 2021 07:55:13 +0000 (07:55 +0000)]
[AArch64] Merge [US]MULL with half adds and subs into [US]ML[AS]L
This patch adds patterns to teach the AArch64 backend to merge [US]MULL
instructions and adds/subs of half the size into [US]ML[AS]L where we don't use
the top half of the result.
Differential Revision: https://reviews.llvm.org/D95218
Lang Hames [Mon, 25 Jan 2021 04:14:22 +0000 (15:14 +1100)]
[JITLink] Enable exception handling for ELF.
Adds the EHFrameSplitter and EHFrameEdgeFixer passes to the default JITLink
pass pipeline for ELF/x86-64, and teaches EHFrameEdgeFixer to handle some
new pointer encodings.
Together these changes enable exception handling (at least for the basic
cases that I've tested so far) for ELF/x86-64 objects loaded via JITLink.
QingShan Zhang [Mon, 25 Jan 2021 04:00:32 +0000 (04:00 +0000)]
[NFC] [DAGCombine] Correct the result for sqrt even the iteration is zero
For now, we correct the result for sqrt if iteration > 0. This doesn't make
sense as they are not strict relative.
Reviewed By: dmgreen, spatel, RKSimon
Differential Revision: https://reviews.llvm.org/D94480
Ben Shi [Mon, 25 Jan 2021 04:01:26 +0000 (12:01 +0800)]
[clang][AVR] Improve avr-ld command line options
Stella Laurenzo [Sun, 24 Jan 2021 22:46:56 +0000 (14:46 -0800)]
[mlir][Python] Roll up of python API fixes.
* As discussed, fixes the ordering or (operands, results) -> (results, operands) in various `create` like methods.
* Fixes a syntax error in an ODS accessor method.
* Removes the linalg example in favor of a test case that exercises the same.
* Fixes FuncOp visibility to properly use None instead of the empty string and defaults it to None.
* Implements what was documented for requiring that trailing __init__ args `loc` and `ip` are keyword only.
* Adds a check to `InsertionPoint.insert` so that if attempting to insert past the terminator, an exception is raised telling you what to do instead. Previously, this would crash downstream (i.e. when trying to print the resultant module).
* Renames `_ods_build_default` -> `build_generic` and documents it.
* Removes `result` from the list of prohibited words and for single-result ops, defaults to naming the result `result`, thereby matching expectations and what is already implemented on the base class.
* This was intended to be a relatively small set of changes to be inlined with the broader support for ODS generating the most specific builder, but it spidered out once actually testing various combinations, so rolling up separately.
Differential Revision: https://reviews.llvm.org/D95320
David Blaikie [Tue, 5 Jan 2021 06:48:54 +0000 (22:48 -0800)]
lldb: Add support for printing variables with DW_AT_ranges on DW_TAG_subprograms
Finishing out the support (to the best of my knowledge/based on current
testing running the whole check-lldb with a clang forcibly using
DW_AT_ranges on all DW_TAG_subprograms) for this feature.
Differential Revision: https://reviews.llvm.org/D94064
David Blaikie [Mon, 25 Jan 2021 02:38:16 +0000 (18:38 -0800)]
Fix sign-comparison warnings in unit test EXPECTs
Chen Zheng [Mon, 18 Jan 2021 04:53:33 +0000 (23:53 -0500)]
[PowerPC] support register pressure reduction in machine combiner.
Reassociating some patterns to generate more fma instructions to
reduce register pressure.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D92071
Harald van Dijk [Mon, 25 Jan 2021 00:56:45 +0000 (00:56 +0000)]
Suppress non-conforming GNU paste extension in all standard-conforming modes
The GNU token paste extension that removes the comma in , ## __VA_ARGS__
conflicts with C99/C++11's requirements when a variadic macro has no
named parameters: according to the standard, an invocation as FOO()
gives it a single empty argument, and concatenation of anything with an
empty argument is well-defined. For this reason, the GNU extension was
already disabled in C99 standard-conforming mode. It was not yet
disabled in C++11 standard-conforming mode.
The associated comment suggested that GCC keeps this extension enabled
in C90/C++03 standard-conforming mode, but it actually does not, so
rather than adding a check for C++ language version, this change simply
removes the check for C language version.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D91913
Carl Ritson [Sun, 24 Jan 2021 23:31:08 +0000 (08:31 +0900)]
[AMDGPU] Fix llvm.amdgcn.init.exec and frame materialization
Frame-base materialization may insert vector instructions before EXEC is initialised.
Fix this by moving lowering of llvm.amdgcn.init.exec later in backend.
Also remove SI_INIT_EXEC_LO pseudo as this is not necessary.
Reviewed By: ruiling
Differential Revision: https://reviews.llvm.org/D94645
Simon Cook [Sun, 24 Jan 2021 22:07:33 +0000 (22:07 +0000)]
[RISCV] Add support for Zvamo/Zvlsseg to driver
Differential Revision: https://reviews.llvm.org/D94930
Craig Topper [Sun, 24 Jan 2021 21:33:02 +0000 (13:33 -0800)]
[RISCV] Use bitsLE instead of strict == MVT::i32 in assertsexti32 and assertzexti32.
The patterns that use this really want to know if the operand has at
least 32 sign/zero bits.
This increases opportunities to use W instructions when the original
source used i8/i16. Not sure how much this matters for performance,
but it makes i8/i16 code more consistent with i32.
Craig Topper [Sun, 24 Jan 2021 20:43:53 +0000 (12:43 -0800)]
[RISCV] Add test cases for missed opportunities to use *W instructions for div/rem when inputs are sign/zero extended from i8/16 instead of i32.
Craig Topper [Sun, 24 Jan 2021 19:23:25 +0000 (11:23 -0800)]
[RISCV] Add test cases for missed opportunities to use fcvt.*.w(u) instructions on RV64 when input is known to be extended from i8/i16.
David Green [Sun, 24 Jan 2021 21:39:00 +0000 (21:39 +0000)]
[ARM] Extra MVE unaligned VLDn tests. NFC
Simon Cook [Sun, 24 Jan 2021 21:01:49 +0000 (21:01 +0000)]
[RISCV] Fix name of Zba extension (NFC)
Augusto Noronha [Sun, 24 Jan 2021 20:29:59 +0000 (21:29 +0100)]
Implement vAttachOrWait
Implements the required functions on gdb-remote so the '--include-existing' flag of process attach works correctly on Linux.
Reviewed By: labath, clayborg
Differential Revision: https://reviews.llvm.org/D94672
Fangrui Song [Sun, 24 Jan 2021 20:21:57 +0000 (20:21 +0000)]
[lldb] Add -Wl,-rpath to make tests run with fresh built libc++
On my Debian machine, system libc++/libc++abi is not installed (`libc++1-9 libc++abi-9`),
21 check-lldb-api tests fail because -stdlib=libc++ linked executables cannot
find runtime libc++.so.1 at runtime.
Use the `-Wl,-rpath,$(LLVM_LIBS_DIR)` mechanism in
`packages/Python/lldbsuite/test/make/Makefile.rules` (D58630 for NetBSD) to
allow such tests compile/link with fresh libc++ built beside lldb.
(A system libc++.so.1 is not guaranteed to match fresh libc++ header files.)
Some tweaks to the existing NetBSD rule when generalizing:
* Drop `-L$(LLVM_LIBS_DIR)` since Clang driver adds it correctly.
* Add `-stdlib=libc++` only for `USE_LIBCPP`.
Also, drop `-isystem /usr/include/c++/v1` introduced in D9426. It is not needed
by Clang driver. GCC using libc++ requires more setup.
I don't find any test needing `-Wl,-rpath` in `test/Shell/helper/{build,toolchain}.py` (D58630 for NetBSD added them).
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D94888
Kazu Hirata [Sun, 24 Jan 2021 20:18:57 +0000 (12:18 -0800)]
[llvm] Use pop_back_val (NFC)
Kazu Hirata [Sun, 24 Jan 2021 20:18:55 +0000 (12:18 -0800)]
[Target] Use llvm::append_range (NFC)
Kazu Hirata [Sun, 24 Jan 2021 20:18:54 +0000 (12:18 -0800)]
[CodeGen] Forward-declare TargetMachine (NFC)
InstrEmitter.h needs TargetMachine but relies on a forward declaration
of TargetMachine in MachineOperand.h. This patch adds a forward
declaration right in InstrEmitter.h.
While we are at it, this patch removes the one in MachineOperand.h,
where it is unnecessary.
Craig Topper [Sun, 24 Jan 2021 18:21:49 +0000 (10:21 -0800)]
[RISCV] Use SRLIWPat in the PACKUW pattern.
This makes the code more tolerant if we ever change SimplifyDemandedBits
to not remove 1s from the lsbs of a contiguous mask.
Jon Chesterfield [Sun, 24 Jan 2021 18:30:04 +0000 (18:30 +0000)]
[libomptarget][cuda] Fix build, change missed from D95274
Shilei Tian [Sun, 24 Jan 2021 18:18:22 +0000 (13:18 -0500)]
[OpenMP] Fixed test environment of `check-libomptarget-nvptx`
D95161 removed the option `--libomptarget-nvptx-path`, which is used in
the tests for `libomptarget-nvptx`.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D95293
Nikita Popov [Sun, 24 Jan 2021 15:22:09 +0000 (16:22 +0100)]
[Utils] Use NoAliasScopeDeclInst in a few more places (NFC)
In the cloning infrastructure, only track an MDNode mapping,
without explicitly storing the Metadata mapping, same as is done
during inlining. This makes things slightly simpler.
David Green [Sun, 24 Jan 2021 14:47:15 +0000 (14:47 +0000)]
[CostModel] Tests for showing the cost of intrinsics from the vectorizer. NFC
Florian Hahn [Sun, 24 Jan 2021 13:14:19 +0000 (13:14 +0000)]
[LTO] Move DisableVerify setting to LTOCodeGenerator class (NFC).
To simplify the transition to using LTOBackend, move DisableVerify to
the LTOCodeGenerator class, like most/all other options.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D95223
Sanjay Patel [Sat, 23 Jan 2021 16:44:31 +0000 (11:44 -0500)]
[SLP] fix fast-math requirements for fmin/fmax reductions
a6f0221276 enabled intersection of FMF on reduction instructions,
so it is safe to ease the check here.
There is still some room to improve here - it looks like we
have nearly duplicate flags propagation logic inside of the
LoopUtils helper but it is limited targets that do not form
reduction intrinsics (they form the shuffle expansion).
David Zarzycki [Sun, 24 Jan 2021 13:50:37 +0000 (08:50 -0500)]
Fix x86 exegesis tests after
c042aff8860df3cad2b274bf0a495e83ae36ddee
In
c042aff8860df3cad2b274bf0a495e83ae36ddee, unused FileCheck prefixes became an error, which exposed some testing bugs in four exegesis tests. I've tried my best to either fix the testing bugs, or expand the testing to cover more scenarios.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D95287
David Green [Sun, 24 Jan 2021 13:49:17 +0000 (13:49 +0000)]
[AArch64] Saturating add cost tests. NFC
Jeroen Dobbelaere [Sun, 24 Jan 2021 12:55:50 +0000 (13:55 +0100)]
[InstCombine] Remove unused llvm.experimental.noalias.scope.decl
A @llvm.experimental.noalias.scope.decl is only useful if there is !alias.scope and !noalias metadata that uses the declared scope.
When that is not the case for at least one of the two, the intrinsic call can as well be removed.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D95141
Jeroen Dobbelaere [Sun, 24 Jan 2021 12:50:25 +0000 (13:50 +0100)]
[LoopRotate] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata as needed
Similar to D92887, LoopRotation also needs duplicate the noalias scopes when rotating a `@llvm.experimental.noalias.scope.decl` across a block boundary.
This is based on the version from the Full Restrict paches (D68511).
The problem it fixes also showed up in Transforms/Coroutines/ex5.ll after D93040 (when enabling strict checking with -verify-noalias-scope-decl-dom).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D94306
Jeroen Dobbelaere [Sun, 24 Jan 2021 12:48:20 +0000 (13:48 +0100)]
[LoopUnroll] Use llvm.experimental.noalias.scope.decl for duplicating noalias metadata as needed
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=39282. Compared to D90104, this version is based on part of the full restrict patched (D68484) and uses the `@llvm.experimental.noalias.scope.decl` intrinsic to track the location where !noalias and !alias.scope scopes have been introduced. This allows us to only duplicate the scopes that are really needed.
Notes:
- it also includes changes and tests from D90104
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D92887
Lang Hames [Sun, 24 Jan 2021 10:52:23 +0000 (21:52 +1100)]
[examples] Fix "Target does not support MC emission!" in HowToUseJIT example.
Patch by Shivam Gupta. Thanks Shivam!
Differential Revision: https://reviews.llvm.org/D92280
Jon Chesterfield [Sun, 24 Jan 2021 10:59:16 +0000 (10:59 +0000)]
[libomptarget][nvptx] Replace cuda atomic primitives with clang intrinsics
[libomptarget][nvptx] Replace cuda atomic primitives with clang intrinsics
Tested by diff of IR generated for target_impl.cu before and after. NFC. Part
of removing deviceRTL build time dependency on cuda SDK.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D95294
Nikita Popov [Fri, 22 Jan 2021 21:33:55 +0000 (22:33 +0100)]
[ValueTracking] Don't assume readonly function will return
This is similar to D94106, but for the
isGuaranteedToTransferExecutionToSuccessor() helper. We should not
assume that readonly functions will return, as this is only true for
mustprogress functions (in which case we already infer willreturn).
As with the DCE change, for now continue assuming that readonly
intrinsics will return, as not all target intrinsics have been
annotated yet.
Differential Revision: https://reviews.llvm.org/D95288
Craig Topper [Sun, 24 Jan 2021 08:13:12 +0000 (00:13 -0800)]
[RISCV] Make the code in MatchSLLIUW ignore the lower bits of the AND mask where the shift has guaranteed zeros.
This avoids being dependent on SimplifyDemandedBits having cleared
those bits.
It could make sense to teach SimplifyDemandedBits to keep all
lower bits 1 in an AND mask when possible. This could be
implemented with slli+srli in the general case rather than
needing to materialize the constant.
Lang Hames [Sun, 24 Jan 2021 04:33:04 +0000 (15:33 +1100)]
[JITLink] Use edge kind names for fixups in EHFrameEdgeFixer.
Previously FDE field names were used, but the fixup kind used for a field can
vary based on the pointer encoding.
This change will improve readability / maintainability when EH-frame support is
added to JITLink/ELF.
Ben Shi [Sun, 24 Jan 2021 03:04:37 +0000 (11:04 +0800)]
[AVR] Optimize 8-bit int shift
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D90678
Michael Kruse [Sun, 24 Jan 2021 02:42:18 +0000 (20:42 -0600)]
[OpenMPIRBuilder] Silence compiler warning. NFC.
Address the compiler warning
OMPIRBuilder.cpp:1232:27: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
Michael Kruse [Sat, 23 Jan 2021 19:10:44 +0000 (13:10 -0600)]
[OpenMPIRBuilder] Implement tileLoops.
The tileLoops method implements the code generation part of the tile directive introduced in OpenMP 5.1. It takes a list of loops forming a loop nest, tiles it, and returns the CanonicalLoopInfo representing the generated loops.
The implementation takes n CanonicalLoopInfos, n tile size Values and returns 2*n new CanonicalLoopInfos. The input CanonicalLoopInfos are invalidated and BBs not reused in the new loop nest removed from the function.
In a modified version of D76342, I was able to correctly compile and execute a tiled loop nest.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D92974
Craig Topper [Sun, 24 Jan 2021 00:19:15 +0000 (16:19 -0800)]
[RISCV] Group some Zbs isel patterns together and remove a stale comment. NFC
Zbigniew Sarbinowski [Sat, 23 Jan 2021 23:04:30 +0000 (23:04 +0000)]
[SystemZ][ZOS] Provide PATH_MAX macro for libcxx
Defining PATH_MAX to _XOPEN_PATH_MAX which is the closest macro available on z/OS.
Note that this value is 1024 which is 4 times smaller from same macro on Linux.
Reviewed By: #libc, ldionne, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D92110
Craig Topper [Sat, 23 Jan 2021 23:57:41 +0000 (15:57 -0800)]
[RISCV] Add isel patterns to remove masks on SLO/SRO shift amounts.
Craig Topper [Sat, 23 Jan 2021 23:45:51 +0000 (15:45 -0800)]
[RISCV] Add test cases for SRO/SLO with shift amounts masked to bitwidth-1. NFC
The sro/slo instructions ignore extra bits in the shift amount,
so we can ignore the mask just like we do for sll, srl, and sra.
Craig Topper [Sat, 23 Jan 2021 22:41:42 +0000 (14:41 -0800)]
[RISCV] Add isel patterns to remove (and X, 31) from sllw/srlw/sraw shift amounts.
We try to do this during DAG combine with SimplifyDemandedBits,
but it fails if there are multiple nodes using the AND. For
example, multiple shifts using the same shift amount.
Jon Chesterfield [Sat, 23 Jan 2021 22:53:57 +0000 (22:53 +0000)]
[libomptarget][amdgpu][nfc] Update comments
[libomptarget][amdgpu][nfc] Update comments
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D95295
Stella Laurenzo [Sat, 23 Jan 2021 02:43:50 +0000 (18:43 -0800)]
[mlir][CAPI] Add result type inference to the CAPI.
* Adds a flag to MlirOperationState to enable result type inference using the InferTypeOpInterface.
* I chose this level of implementation for a couple of reasons:
a) In the creation flow is naturally where generated and custom builder code will be invoking such a thing
b) it is a bit more efficient to share the data structure and unpacking vs having a standalone entry-point
c) we can always decide to expose more of these interfaces with first-class APIs, but that doesn't preclude that we will always want to use this one in this way (and less API surface area for common things is better for API stability and evolution).
* I struggled to find an appropriate way to test it since we don't link the test dialect into anything CAPI accessible at present. I opted instead for one of the simplest ops I found in a regular dialect which implements the interface.
* This does not do any trait-based type selection. That will be left to generated tablegen wrappers.
Differential Revision: https://reviews.llvm.org/D95283
Roman Lebedev [Sat, 23 Jan 2021 21:49:27 +0000 (00:49 +0300)]
[NFC][SimplifyCFG] Extract CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses() out of PerformBranchToCommonDestFolding()
To be used in PerformValueComparisonIntoPredecessorFolding()
Roman Lebedev [Sat, 23 Jan 2021 19:01:41 +0000 (22:01 +0300)]
[NFC][SimplifyCFG] Perform early-continue in FoldValueComparisonIntoPredecessors() per-pred loop
Roman Lebedev [Sat, 23 Jan 2021 18:55:37 +0000 (21:55 +0300)]
[NFC][SimplifyCFG] Extract PerformValueComparisonIntoPredecessorFolding() out of FoldValueComparisonIntoPredecessors()
Less nested code is much easier to follow and modify.
Nikita Popov [Sat, 23 Jan 2021 21:38:43 +0000 (22:38 +0100)]
[IR] Add NoAliasScopeDeclInst (NFC)
Add an intrinsic type class to represent the
llvm.experimental.noalias.scope.decl intrinsic, to make code
working with it a bit nicer by hiding the metadata extraction
from view.
Arthur Eubanks [Fri, 22 Jan 2021 19:11:03 +0000 (11:11 -0800)]
[NewPM][opt] Make -enable-new-pm default to LLVM_ENABLE_NEW_PASS_MANAGER
This is controlled by the ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER CMake flag.
https://lists.llvm.org/pipermail/llvm-dev/2021-January/147993.html
Reviewed By: ychen, asbirlea
Differential Revision: https://reviews.llvm.org/D95254
Arthur Eubanks [Sat, 23 Jan 2021 20:19:37 +0000 (12:19 -0800)]
[test] Pin dead-calls-willreturn.ll to legacy PM
The new PM inliner does not delete dead calls.
Jon Chesterfield [Sat, 23 Jan 2021 20:33:12 +0000 (20:33 +0000)]
[libomptarget][cuda] Call v2 functions explicitly
[libomptarget][cuda] Call v2 functions explicitly
rtl.cpp calls functions like cuMemFree that are replaced by a macro
in cuda.h with cuMemFree_v2. This patch changes the source to use
the v2 names consistently.
See also D95104, D95155 for the idea. Alternatives are to use a mixture,
e.g. call the macro names and explictly dlopen the _v2 names, or to keep
the current status where the symbols are replaced by macros in both files
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D95274
Nikita Popov [Sat, 23 Jan 2021 17:22:17 +0000 (18:22 +0100)]
[PhaseOrdering] Add tests for PR44461 and PR48844 (NFC)
In both cases, optimization is prevented because
"br X == C || X == C2" is converted into a switch. In one case
loop rotation is blocked, in the other vectorization.
Nikita Popov [Sat, 23 Jan 2021 20:21:59 +0000 (21:21 +0100)]
[SimplifyCFG] Regenerate test checks (NFC)
Shilei Tian [Sat, 23 Jan 2021 19:42:32 +0000 (14:42 -0500)]
[Clang][OpenMP][NVPTX] Replace `libomptarget-nvptx-path` with `libomptarget-nvptx-bc-path`
D94700 removed the static library so we no longer need to pass
`-llibomptarget-nvptx` to `nvlink`. Since the bitcode library is the only device
runtime for now, instead of emitting a warning when it is not found, an error
should be raised. We also set a new option `libomptarget-nvptx-bc-path` to let
user choose which bitcode library is being used.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D95161
Kazu Hirata [Sat, 23 Jan 2021 19:23:54 +0000 (11:23 -0800)]
Revert "[Target] Use llvm::append_range (NFC)"
This reverts commit
cc7a23828657f35f706343982cf96bb6583d4d73.
The X86WinEHState.cpp hunk seems to break certain builds.
Mark de Wever [Sat, 23 Jan 2021 19:10:17 +0000 (20:10 +0100)]
[libc++] Remove invalid C++20 code from a test.
During the review of D91986 it has been discovered the in C++11
deprecated `throw()` exception specification has been removed in
C++20. Removed the part of the test code using this feature.
Florian Hahn [Sat, 23 Jan 2021 15:28:57 +0000 (15:28 +0000)]
[FuzzMutate] Add mutator to modify instruction flags.
This patch adds a new InstModificationIRStrategy to mutate flags/options
for instructions. For example, it may add or remove nuw/nsw flags from
add, mul, sub, shl instructions or change the predicate for icmp
instructions.
Subtle changes such as those mentioned above should lead to a more
interesting range of inputs. The presence or absence of overflow flags
can expose subtle bugs, for example.
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D94905
Michael Kruse [Fri, 22 Jan 2021 03:20:53 +0000 (21:20 -0600)]
[Polly] Track defined behavior for PHI predecessor computation.
ZoneAlgorithms's computePHI relies on being provided with consistent a
schedule to compute the statement prodecessors of a statement containing
PHINodes. Otherwise unexpected results such as PHI nodes with multiple
predecessors can occur which would result in problems in the
algorithms expecting consistent data.
In the added test case, statement instances are scrubbed from the
SCoP their execution would result in undefined behavior (Due to a nsw
overflow). As already being undefined behavior in LLVM-IR, neither
AssumedContext nor InvalidContext are updated, giving computePHI no
means to avoid these cases.
Intoduce a new SCoP property, the DefinedBehaviorContext, that among
the runtime-checked conditions, also tracks the assumptions not needing
a runtime check, in particular those affecting the assumed control flow.
This replaces the manual combination of the 3 other contexts that was
already done in computePHI and setNewAccessRelation. Currently, the only
additional assumption is that loop induction variables will nsw flag for
not wrap, but potentially more can be added. Use in
hasFeasibleRuntimeContext, isl::ast_build and gisting are other
potential uses.
To limit computational complexity, the DefinedBehaviorContext is not
availabe if it grows too large (atm hardcoded to 8 disjuncts).
Possible other fixes include bailing out in computePHI when
inconsistencies are detected, choose an arbitrary value for inconsistent
cases (since it is undefined behavior anyways), or make the code
receiving the result from ComputePHI handle inconsistent data. All of
them reduce the quality of implementation having to bail out more often
and disabling the ability to assert on actually wrong results.
This fixes llvm.org/PR48783.