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.
Michael Kruse [Sat, 23 Jan 2021 18:28:26 +0000 (12:28 -0600)]
[Polly] Allow param sets for dumpPw().
Michael Kruse [Fri, 22 Jan 2021 04:36:18 +0000 (22:36 -0600)]
[Polly] Clean up hasFeasibleRuntimeContext.
Michael Kruse [Thu, 21 Jan 2021 22:54:46 +0000 (16:54 -0600)]
[Polly] Gist new access relations using the SCoP context.
This simplifies the access relations.
Kazu Hirata [Sat, 23 Jan 2021 18:56:33 +0000 (10:56 -0800)]
[llvm] Use pop_back_val (NFC)
Kazu Hirata [Sat, 23 Jan 2021 18:56:31 +0000 (10:56 -0800)]
[Target] Use llvm::append_range (NFC)
Kazu Hirata [Sat, 23 Jan 2021 18:56:29 +0000 (10:56 -0800)]
[llvm] Forward-declare ICFLoopSafetyInfo (NFC)
LoopUtils.h needs ICFLoopSafetyInfo but relies on a forward
declaration of ICFLoopSafetyInfo in IVDescriptors.h. This patch adds
a forward declaration right in LoopUtils.h.
While we are at it, this patch removes the one in IVDescriptors.h,
where it is unnecessary.
Florian Hahn [Sat, 23 Jan 2021 17:42:18 +0000 (17:42 +0000)]
[InstCombine] Set MadeIRChange in replaceInstUsesWith.
Some utilities used by InstCombine, like SimplifyLibCalls, may add new
instructions and replace the uses of a call, but return nullptr because
the inserted call produces multiple results.
Previously, the replaced library calls would get removed by
InstCombine's deleter, but after
292077072ec1279d89d21873fe900061e55ef936 this may not happen, if the
willreturn attribute is missing.
As a work-around, update replaceInstUsesWith to set MadeIRChange, if it
replaces any uses. This catches the cases where it is used as replacer
by utilities used by InstCombine and seems useful in general; updating
uses will modify the IR.
This fixes an expensive-check failure when replacing
@__sinpif/@__cospifi with @__sincospif_sret.
Mark de Wever [Tue, 24 Nov 2020 15:12:34 +0000 (16:12 +0100)]
[libc++] Implements concept destructible
Implements parts of:
- P0898R3 Standard Library Concepts
- P1754 Rename concepts to standard_case for C++20, while we still can
Reviewed By: ldionne, miscco, #libc
Differential Revision: https://reviews.llvm.org/D91004
Dan Liew [Sat, 23 Jan 2021 17:09:06 +0000 (09:09 -0800)]
[ASan] Fix broken Windows build due to
596d534ac3524052df210be8d3c01a33b2260a42.
In that change I forgot to update the call to
`AsanThread::ThreadStart()` in `asan_win.cpp`.
Ben Shi [Sat, 23 Jan 2021 16:38:57 +0000 (00:38 +0800)]
[AVR] Optimize 16-bit comparison with constant
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D93976
Sanjay Patel [Sat, 23 Jan 2021 15:37:55 +0000 (10:37 -0500)]
[SLP] fix fast-math-flag propagation on FP reductions
As shown in the test diffs, we could miscompile by
propagating flags that did not exist in the original
code.
The flags required for fmin/fmax reductions will be
fixed in a follow-up patch.
Sanjay Patel [Sat, 23 Jan 2021 15:31:23 +0000 (10:31 -0500)]
[SLP] add reduction test with mixed fast-math-flags; NFC
Florian Hahn [Sat, 23 Jan 2021 12:42:46 +0000 (12:42 +0000)]
[Local] Treat calls that may not return as being alive.
With the addition of the `willreturn` attribute, functions that may
not return (e.g. due to an infinite loop) are well defined, if they are
not marked as `willreturn`.
This patch updates `wouldInstructionBeTriviallyDead` to not consider
calls that may not return as dead.
This patch still provides an escape hatch for intrinsics, which are
still assumed as willreturn unconditionally. It will be removed once
all intrinsics definitions have been reviewed and updated.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D94106
Ben Shi [Sat, 23 Jan 2021 15:54:16 +0000 (23:54 +0800)]
[AVR] Optimize 8-bit logic left/right shifts
Reviewed By: dylanmckay
Differential Revision: https://reviews.llvm.org/D89047
Pedro Tammela [Sat, 23 Jan 2021 15:20:54 +0000 (15:20 +0000)]
[lldb/Lua] add 'Lua' before naming versions
NFC
Pedro Tammela [Mon, 18 Jan 2021 23:33:43 +0000 (23:33 +0000)]
[lldb/Lua] add initial Lua typemaps
This patch adds the integer handling typemaps and the typemap for
string returning functions.
The integer handling typemaps overrides SWIG's own typemaps to distinct
the handling of integers from floating point.
The typemap for string returning functions is a port of Python's
typemap.
Differential Revision: https://reviews.llvm.org/D94937
LLVM GN Syncbot [Sat, 23 Jan 2021 14:07:39 +0000 (14:07 +0000)]
[gn build] Port
0057cc5a215e
Ayke van Laethem [Sat, 23 Jan 2021 14:04:27 +0000 (15:04 +0100)]
Revert "[Clang] Move assembler into a separate file"
This reverts commit
2325157c0568ffd16f3318ad54f947e4e2109ef6.
Unfortunately this commit produces linker errors on some builds:
http://lab.llvm.org:8011/#/builders/57/builds/3704
http://lab.llvm.org:8011/#/builders/112/builds/3216
http://lab.llvm.org:8011/#/builders/121/builds/3900
Roman Lebedev [Sat, 23 Jan 2021 13:23:11 +0000 (16:23 +0300)]
[SimplifyCFG] Change 'LoopHeaders' to be ArrayRef<WeakVH>, not a naked set, thus avoiding dangling pointers
If i change it to AssertingVH instead, a number of existing tests fail,
which means we don't consistently remove from the set when deleting blocks,
which means newly-created blocks may happen to appear in that set
if they happen to occupy the same memory chunk as did some block
that was in the set originally.
There are many places where we delete blocks,
and while we could probably consistently delete from LoopHeaders
when deleting a block in transforms located in SimplifyCFG.cpp itself,
transforms located elsewhere (Local.cpp/BasicBlockUtils.cpp) also may
delete blocks, and it doesn't seem good to teach them to deal with it.
Since we at most only ever delete from LoopHeaders,
let's just delegate to WeakVH to do that automatically.
But to be honest, personally, i'm not sure that the idea
behind LoopHeaders is sound.
LLVM GN Syncbot [Sat, 23 Jan 2021 13:38:51 +0000 (13:38 +0000)]
[gn build] Port
2325157c0568
Ayke van Laethem [Sat, 23 Jan 2021 10:53:24 +0000 (11:53 +0100)]
[Clang] Move assembler into a separate file
This change adds an AssemblerInvocation class, similar to the
CompilerInvocation class. It can be used to invoke cc1as directly.
The project I'm working on wants to compile Clang and use it as a static
library. For that to work, there must be a way to invoke the assembler
programmatically, using the same arguments as you would otherwise pass
to cc1as.
Differential Revision: https://reviews.llvm.org/D63852
Nikita Popov [Sat, 23 Jan 2021 12:06:46 +0000 (13:06 +0100)]
[LSR] Add test for PR46943 (NFC)
LSR should be dropping nowrap flags when adding new postinc users.
Florian Hahn [Sat, 23 Jan 2021 12:09:29 +0000 (12:09 +0000)]
[LTO] Store target attributes as vector of strings (NFC).
The target features are obtained as a list of features/attributes.
Instead of storing them in a single string, store the vector. This
matches lto::Config's behavior and simplifies the transition to
lto::backend().
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D95224
Jeroen Dobbelaere [Sat, 23 Jan 2021 11:10:57 +0000 (12:10 +0100)]
[InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments.
Insert a llvm.experimental.noalias.scope.decl intrinsic that identifies where a noalias argument was inlined.
This patch includes some refactorings from D90104.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93040
Simon Pilgrim [Sat, 23 Jan 2021 11:03:43 +0000 (11:03 +0000)]
[Support] TrigramIndex::insert - pass std::String argument by const reference. NFCI.
Avoid string copies and fix clang-tidy warning.
Roger Ferrer Ibanez [Sat, 23 Jan 2021 07:30:30 +0000 (07:30 +0000)]
[RISCV][PrologEpilogInserter] "Float" emergency spill slots to avoid making them immediately unreachable from the stack pointer
In RISC-V there is a single addressing mode of the form imm(reg) where
imm is a signed integer of 12-bit with a range of [-2048..2047] bytes
from reg.
The test MultiSource/UnitTests/C++11/frame_layout of the LLVM test-suite
exercises several scenarios with the stack, including function calls
where the stack will need to be realigned to to a local variable having
a large alignment of 4096 bytes.
In situations of large stacks, the RISC-V backend (in
RISCVFrameLowering) reserves an extra emergency spill slot which can be
used (if no free register is found) by the register scavenger after the
frame indexes have been eliminated. PrologEpilogInserter already takes
care of keeping the emergency spill slots as close as possible to the
stack pointer or frame pointer (depending on what the function will
use). However there is a final alignment step to honour the maximum
alignment of the stack that, when using the stack pointer to access the
emergency spill slots, has the side effect of setting them farther from
the stack pointer.
In the case of the frame_layout testcase, the net result is that we do
have an emergency spill slot but it is so far from the stack pointer
(more than 2048 bytes due to the extra alignment of a variable to 4096
bytes) that it becomes unreachable via any immediate offset.
During elimination of the frame index, many (regular) offsets of the
stack may be immediately unreachable already. Their address needs to be
computed using a register. A virtual register is created and later
RegisterScavenger should be able to find an unused (physical) register.
However if no register is available, RegisterScavenger will pick a
physical register and spill it onto an emergency stack slot, while we
compute the offset (restoring the chosen register after all this). This
assumes that the emergency stack slot is easily reachable (this is,
without requiring another register!).
This is the assumption we seem to break when we perform the extra
alignment in PrologEpilogInserter.
We can "float" the emergency spill slots by increasing (in absolute
value) their offsets from the incoming stack pointer. This way the
emergency spill slots will remain close to the stack pointer (once the
function has allocated storage for the stack, including the needed
realignment). The new size computed in PrologEpilogInserter is padding
so it should be OK to move the emergency spill slots there. Also because
we're increasing the alignment, the new location should stay aligned for
the purpose of the emergency spill slots.
Note that this change also impacts other backends as shown by the tests.
Changes are minor adjustments to the emergency stack slot offset.
Differential Revision: https://reviews.llvm.org/D89239
Sergey Dmitriev [Sat, 23 Jan 2021 03:33:27 +0000 (19:33 -0800)]
[llvm-link] Fix for an assertion when linking global with appending linkage
This patch fixes llvm-link assertion when linking external variable
declaration with a definition with appending linkage.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D95126
Dan Liew [Thu, 7 Jan 2021 01:41:46 +0000 (17:41 -0800)]
[ASan] Stop blocking child thread progress from parent thread in `pthread_create` interceptor.
Previously in ASan's `pthread_create` interceptor we would block in the
`pthread_create` interceptor waiting for the child thread to start.
Unfortunately this has bad performance characteristics because the OS
scheduler doesn't know the relationship between the parent and child
thread (i.e. the parent thread cannot make progress until the child
thread makes progress) and may make the wrong scheduling decision which
stalls progress.
It turns out that ASan didn't use to block in this interceptor but was
changed to do so to try to address
http://llvm.org/bugs/show_bug.cgi?id=21621/.
In that bug the problem being addressed was a LeakSanitizer false
positive. That bug concerns a heap object being passed
as `arg` to `pthread_create`. If:
* The calling thread loses a live reference to the object (e.g.
`pthread_create` finishes and the thread no longer has a live
reference to the object).
* Leak checking is triggered.
* The child thread has not yet started (once it starts it will have a
live reference).
then the heap object will incorrectly appear to be leaked.
This bug is covered by the `lsan/TestCases/leak_check_before_thread_started.cpp` test case.
In
b029c5101fb49b3577a1c322f42ef9fc616f25bf ASan was changed to block
in `pthread_create()` until the child thread starts so that `arg` is
kept alive for the purposes of leaking check.
While this change "works" its problematic due to the performance
problems it causes. The change is also completely unnecessary if leak
checking is disabled (via detect_leaks runtime option or
CAN_SANITIZE_LEAKS compile time config).
This patch does two things:
1. Takes a different approach to solving the leak false positive by
making LSan's leak checking mechanism treat the `arg` pointer of
created but not started threads as reachable. This is done by
implementing the `ForEachRegisteredThreadContextCb` callback for
ASan.
2. Removes the blocking behaviour in the ASan `pthread_create`
interceptor.
rdar://problem/
63537240
Differential Revision: https://reviews.llvm.org/D95184
Kazu Hirata [Sat, 23 Jan 2021 07:25:05 +0000 (23:25 -0800)]
[llvm] Use static_assert instead of assert (NFC)
Identified with misc-static-assert.
Kazu Hirata [Sat, 23 Jan 2021 07:25:03 +0000 (23:25 -0800)]
[llvm] Use isAlpha/isAlnum (NFC)
Kazu Hirata [Sat, 23 Jan 2021 07:25:01 +0000 (23:25 -0800)]
[Analysis] Use llvm::append_range (NFC)