River Riddle [Sat, 20 Mar 2021 01:19:16 +0000 (18:19 -0700)]
[mlir][docs] Remove the BuiltinDialect documentation from langref and generate it from ODS
Now that all of the builtin dialect is generated from ODS, its documentation in LangRef can be split out and replaced with references to Dialects/Builtin.md. LangRef is quite crusty right now and should really have a full cleanup done in a followup.
Differential Revision: https://reviews.llvm.org/D98562
Chris Lattner [Sat, 20 Mar 2021 00:57:47 +0000 (17:57 -0700)]
[testsuite] Make testsuite more stable vs canonicalization change. NFC.
Differential Revision: https://reviews.llvm.org/D98998
Jonas Devlieghere [Sat, 20 Mar 2021 00:57:17 +0000 (17:57 -0700)]
Revert "[lldb] Make the API, Shell and Unit tests independent lit test suites"
This reverts commit
6c52d4fd4c24a0cf738e44516ca8378d65dcf019.
Fangrui Song [Sat, 20 Mar 2021 00:47:29 +0000 (17:47 -0700)]
[Driver] Delete compatibility aliases -mpie-copy-relocations and -mno-pie-copy-relocations
They should be unused everywhere.
Dhruva Chakrabarti [Sat, 20 Mar 2021 00:40:37 +0000 (17:40 -0700)]
Empty test commit, verifying commit access
River Riddle [Sat, 20 Mar 2021 00:11:23 +0000 (17:11 -0700)]
[mlir][NFC] Use the native range instead of APInt when computing operand ranges
This removes the need to construct an APInt for each value, given that it is guaranteed to contain 32 bit elements.
BEGIN_PUBLIC
...text exposed to open source public git repo...
END_PUBLIC
River Riddle [Fri, 19 Mar 2021 23:19:23 +0000 (16:19 -0700)]
[mlir] Update `simplifyRegions` to use RewriterBase for erasure notifications
This allows for notifying callers when operations/blocks get erased, which is especially useful for the greedy pattern driver. The current greedy pattern driver "throws away" all information on constants in the operation folder because it doesn't know if they get erased or not. By passing in RewriterBase, we can directly track this and prevent the need for the pattern driver to rediscover all of the existing constants. In some situations this cuts the compile time of the canonicalizer in half.
Differential Revision: https://reviews.llvm.org/D98755
Peter Collingbourne [Fri, 19 Mar 2021 23:23:30 +0000 (16:23 -0700)]
gn build: Unbreak Android cross-compilation.
- D96404 defaulted to libunwind which isn't provided by NDK r21
(or r22), so specify -rtlib=libgcc on non-arm32.
- D97993 means that we need to use --gcc-toolchain instead of -B
to let the driver find libgcc.
Ellis Hoag [Fri, 19 Mar 2021 23:24:16 +0000 (16:24 -0700)]
Port D97640 to llvm/include/llvm/ProfileData/InstrProfData.inc
Differential Revision: https://reviews.llvm.org/D98982
Lang Hames [Fri, 19 Mar 2021 21:54:07 +0000 (14:54 -0700)]
[JITLink] Don't issue lookups for empty symbol sets.
Issuing a lookup for an empty symbol set is legal, but can actually result in
unrelated work being done if there was a work queue left over from the previous
lookup. We can avoid doing this unrelated work (reducing stack depth and
interleaving of debugging output) by not issuing these no-op lookups in the
first place.
Christoffer Lernö [Fri, 19 Mar 2021 22:55:52 +0000 (18:55 -0400)]
Add type attributes to LLVM C API
The LLVM C API is missing type attributes as is needed by attributes
such as sret and byval. This patch adds three missing wrapper
functions.
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=48249
https://reviews.llvm.org/D97763
Vedant Kumar [Thu, 18 Mar 2021 18:12:17 +0000 (11:12 -0700)]
[lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY (reapply)
In general, it seems like the debugger should allow programs to load & run with
libraries as far as possible, instead of defaulting to being super-picky about
unavailable symbols.
This is critical on macOS/Darwin, as libswiftCore.dylib may 1) export a version
symbol using @available markup and then 2) expect that other exported APIs are
only dynamically used once the version symbol is checked. We can't open a
version of the library built with a bleeding-edge SDK on an older OS without
RTLD_LAXY (or pervasive/expensive @available markup added to dyld APIs).
This was previously committed as
cb8c1ee269da and reverted due to
unknown failures on the Linux bots. This version adds additional asserts
to check that the shared objects are where we expect them & that calling
f1() from libt1 produces the expected value. The Linux failure is
tracked by https://bugs.llvm.org/show_bug.cgi?id=49656.
See: https://lists.llvm.org/pipermail/lldb-dev/2021-March/016796.html
Differential Revision: https://reviews.llvm.org/D98879
Fangrui Song [Fri, 19 Mar 2021 22:42:37 +0000 (15:42 -0700)]
[docs] Improve documentation of -B and --gcc-toolchain
Differential Revision: https://reviews.llvm.org/D97902
Fangrui Song [Fri, 19 Mar 2021 22:42:18 +0000 (15:42 -0700)]
[Driver] Suppress GCC detection under -B
In GCC, if `-B $prefix` is specified, `$prefix` is used to find executable files and startup files.
`$prefix/include` is added as an include search directory.
Clang overloads -B with GCC installation detection semantics which make the
behavior less predictable (due to the "largest GCC version wins" rule) and
interact poorly with --gcc-toolchain (--gcc-toolchain can be overridden by -B).
* `clang++ foo.cpp` detects GCC installation under `/usr`.
* `clang++ --gcc-toolchain=Inputs foo.cpp` detects GCC installation under `Inputs`.
* `clang++ -BA --gcc-toolchain=B foo.cpp` detects GCC installation under A and B and the larger version wins. With this patch, only B is used for detection.
* `clang++ -BA foo.cpp` detects GCC installation under `A` and `/usr`, and the larger GCC version wins. With this patch `A` is not used for detection.
This patch changes -B to drop the GCC detection semantics. Its executable
searching semantics are preserved. --gcc-toolchain is the recommended option to
specify the GCC installation detection directory.
(
Note: Clang detects GCC installation in various target dependent directories.
`$sysroot/usr` (sysroot defaults to "") is a common directory used by most targets.
Such a directory is expected to contain something like `lib{,32,64}/gcc{,-cross}/$triple`.
Clang will then construct library/include paths from the directory.
)
Differential Revision: https://reviews.llvm.org/D97993
Vedant Kumar [Fri, 19 Mar 2021 22:26:16 +0000 (15:26 -0700)]
Revert "[lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY"
This reverts commit
cb8c1ee269da72eb6e2c18800cd8ab0a74050785. The test
is failing on Debian for unknown reasons.
https://lab.llvm.org/buildbot/#/builders/68/builds/8990
Vedant Kumar [Thu, 18 Mar 2021 18:12:17 +0000 (11:12 -0700)]
[lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY
In general, it seems like the debugger should allow programs to load & run with
libraries as far as possible, instead of defaulting to being super-picky about
unavailable symbols.
This is critical on macOS/Darwin, as libswiftCore.dylib may 1) export a version
symbol using @available markup and then 2) expect that other exported APIs are
only dynamically used once the version symbol is checked. We can't open a
version of the library built with a bleeding-edge SDK on an older OS without
RTLD_LAXY (or pervasive/expensive @available markup added to dyld APIs).
See: https://lists.llvm.org/pipermail/lldb-dev/2021-March/016796.html
Differential Revision: https://reviews.llvm.org/D98879
Arthur Eubanks [Fri, 19 Mar 2021 21:30:48 +0000 (14:30 -0700)]
[NewPM] Verify LoopAnalysisResults after a loop pass
All loop passes should preserve all analyses in LoopAnalysisResults. Add
checks for those when the checks are enabled (which is by default with
expensive checks on).
Note that due to PR44815, we don't check LAR's ScalarEvolution.
Apparently calling SE.verify() can change its results.
This is a reland of https://reviews.llvm.org/D98820 which was reverted
due to unacceptably large compile time regressions in normal debug
builds.
Jessica Paquette [Thu, 11 Mar 2021 23:36:01 +0000 (15:36 -0800)]
[GlobalISel] Add G_SBFX + G_UBFX (bitfield extraction opcodes)
There is a bunch of similar bitfield extraction code throughout *ISelDAGToDAG.
E.g, ARMISelDAGToDAG, AArch64ISelDAGToDAG, and AMDGPUISelDAGToDAG all contain
code that matches a bitfield extract from an and + right shift.
Rather than duplicating code in the same way, this adds two opcodes:
- G_UBFX (unsigned bitfield extract)
- G_SBFX (signed bitfield extract)
They work like this
```
%x = G_UBFX %y, %lsb, %width
```
Where `lsb` and `width` are
- The least-significant bit of the extraction
- The width of the extraction
This will extract `width` bits from `%y`, starting at `lsb`. G_UBFX zero-extends
the result, while G_SBFX sign-extends the result.
This should allow us to use the combiner to match the bitfield extraction
patterns rather than duplicating pattern-matching code in each target.
Differential Revision: https://reviews.llvm.org/D98464
River Riddle [Fri, 19 Mar 2021 21:20:14 +0000 (14:20 -0700)]
[mlir][Pass] Coalesce dynamic pass pipelines before running
This was missed when dynamic pass pipelines were added, and is necessary for maximizing the performance/parallelism potential of the pass pipeline.
Fangrui Song [Fri, 19 Mar 2021 21:35:22 +0000 (14:35 -0700)]
[llvm-readobj] Remove legacy GNU_PROPERTY_X86_ISA_1_{NEEDED,USED} and dump new GNU_PROPERTY_X86_ISA_1_{NEEDED,USED}
https://sourceware.org/bugzilla/show_bug.cgi?id=26703 deprecated the
previous GNU_PROPERTY_X86_ISA_1_{CMOV,SSE,*} values (renamed to `COMPAT`)
and added new values.
Since the legacy values are not used by compilers, having dumping support in
llvm-readobj is unnecessary. So just drop the legacy feature.
The new values are used by GCC 11
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250) `-march=x86-64-v[234]` to
indicate the micro-architecture ISA levels.
Differential Revision: https://reviews.llvm.org/D98818
Jonas Devlieghere [Fri, 19 Mar 2021 21:31:22 +0000 (14:31 -0700)]
[lldb] Update assert.test to be less strict
Be less strict when checking for the assert substring.
Arthur Eubanks [Fri, 19 Mar 2021 21:31:08 +0000 (14:31 -0700)]
Revert "[NewPM] Verify LoopAnalysisResults after a loop pass"
This reverts commit
94c269baf58330a5e303a4f86f64681f2f7a858b.
Still causes too large of compile time regression in normal debug
builds. Will put under expensive checks instead.
Jonas Devlieghere [Fri, 19 Mar 2021 21:20:26 +0000 (14:20 -0700)]
[lldb] Call os_log_fault on lldb_assert
Call `os_log_fault` when an lldb assert fails. We piggyback off
`LLVM_SUPPORT_XCODE_SIGNPOSTS`, which also depends on `os_log`, to avoid
having to introduce another CMake check and corresponding define.
This patch also adds a small test using lldb-test that verifies we abort
with a "regular" assertion when asserts are enabled.
Differential revision: https://reviews.llvm.org/D98987
Ella Ma [Fri, 19 Mar 2021 04:14:13 +0000 (21:14 -0700)]
[llvm] Add assertions for the smart pointers with the possibility to be null in ModuleLazyLoaderCache::operator()
Split from D91844.
The return value of function `ModuleLazyLoaderCache::operator()` in file llvm/tools/llvm-link/llvm-link.cpp. According to the bug report of my static analyzer, the std::function variable `ModuleLazyLoaderCache::createLazyModule` points to function `loadFile`, which may return `nullptr` when error. And the pointer is dereferenced without a check.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D97258
Stella Laurenzo [Fri, 19 Mar 2021 18:57:01 +0000 (11:57 -0700)]
NFC: Break up the mlir python bindings into individual sources.
* IRModules.cpp -> (IRCore.cpp, IRAffine.cpp, IRAttributes.cpp, IRTypes.cpp).
* The individual pieces now compile in the 5-15s range whereas IRModules.cpp was starting to approach a minute (didn't capture a before time).
* More fine grained splitting is possible, but this represents the most obvious.
Differential Revision: https://reviews.llvm.org/D98978
Arthur Eubanks [Wed, 17 Mar 2021 21:53:57 +0000 (14:53 -0700)]
[NewPM] Verify LoopAnalysisResults after a loop pass
All loop passes should preserve all analyses in LoopAnalysisResults. Add
checks for those.
Note that due to PR44815, we don't check LAR's ScalarEvolution.
Apparently calling SE.verify() can change its results.
Only verify MSSA when VerifyMemorySSA, normally it's very expensive.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D98820
Butygin [Fri, 12 Mar 2021 14:39:43 +0000 (17:39 +0300)]
[MLIR] Test pattern benefit sorting between operation specific and operation agnostic patterns.
Previously low benefit op-specific patterns never had a chance to match
even if high benefit op-agnostic pattern failed to match.
This was already fixed upstream, this commit just adds testscase
Differential Revision: https://reviews.llvm.org/D98513
Benjamin Kramer [Fri, 19 Mar 2021 19:56:59 +0000 (20:56 +0100)]
[mlir][Linalg] Make LLVM_DEBUG region bigger to avoid warnings in Release builds
Transforms.cpp:586:16: error: unused variable 'v' [-Werror,-Wunused-variable]
for (Value v : operands)
^
Benjamin Kramer [Fri, 19 Mar 2021 19:35:17 +0000 (20:35 +0100)]
[CodeGen] Don't crash on for loops with cond variables and no increment
This looks like an oversight from
a875721d8a2d, creating IR that refers
to `for.inc` even if it doesn't exist.
Differential Revision: https://reviews.llvm.org/D98980
Jim Ingham [Fri, 19 Mar 2021 19:38:41 +0000 (12:38 -0700)]
Revert "Make the stop-on-sharedlibrary-events setting work."
This reverts commit
9406d43138811ac4dfd0ab31434f65a649bc882e.
I messed up a test, and when I got it right it was failing. The changed logic
doesn't work quite right (now the async callback called at sync time is
forcing us to stop. I need to be a little more careful about that.
Jim Ingham [Fri, 19 Mar 2021 19:38:23 +0000 (12:38 -0700)]
Revert "Skip all the tests for Windows."
This reverts commit
a8d62fc8ff1c836e16cfb1a510ee8063ac2652ff.
Sanjay Patel [Fri, 19 Mar 2021 19:09:53 +0000 (15:09 -0400)]
[SLP] remove unnecessary characters in test; NFC
Glitch that crept in with
62f9c3358b81
Sanjay Patel [Fri, 19 Mar 2021 19:05:52 +0000 (15:05 -0400)]
[SLP] add tests for min/max reductions that use intrinsics; NFC
Jim Ingham [Fri, 19 Mar 2021 19:05:16 +0000 (12:05 -0700)]
Skip all the tests for Windows.
Jim Ingham [Fri, 19 Mar 2021 18:56:46 +0000 (11:56 -0700)]
Make the stop-on-sharedlibrary-events setting work.
We weren't taking into account the "m_should_stop" setting that the
synchronous breakpoint callback had already set when we did PerformAction
in the StopInfoBreakpoint. So we didn't obey its instructions when it
told us to stop. Fixed that and added some tests both for when we
just have the setting, and when we have the setting AND other breakpoints
at the shared library load notification breakpoint address.
Differential Revision: https://reviews.llvm.org/D98914
Louis Dionne [Thu, 18 Mar 2021 21:05:25 +0000 (14:05 -0700)]
[libc++] NFCI: Remove dead code in the Lit configuration
I was trying to fix something else and I stumbled upon several methods
that are not used anymore in target_info.py.
Differential Revision: https://reviews.llvm.org/D98896
Arnamoy Bhattacharyya [Fri, 19 Mar 2021 18:54:06 +0000 (14:54 -0400)]
[Flang][OpenMP] Add more sema checks for ordered construct
This patch fixes a bug to allow ordered construct within a non-worksharing loop, also adds more sema checks.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D98733
Craig Topper [Fri, 19 Mar 2021 18:23:27 +0000 (11:23 -0700)]
[AArch64] Fix LowerMGATHER to return the chain result for floating point gathers.
Found by adding asserts to LegalizeDAG to make sure custom legalized
results had the right types.
Reviewed By: kmclaughlin
Differential Revision: https://reviews.llvm.org/D98968
Rob Suderman [Fri, 19 Mar 2021 18:42:22 +0000 (11:42 -0700)]
[mlir][tosa] Add tosa.cast to linalg lowering
Handles lowering from the tosa CastOp to the equivalent linalg lowering. It
includes support for interchange between bool, int, and floating point.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D98828
Rob Suderman [Fri, 19 Mar 2021 18:24:52 +0000 (11:24 -0700)]
[mlir][tosa] Add tosa.logical_* to linalg lowerings
Adds lowerings for logical_* boolean operations. Each of these ops only operate
on booleans allowing simple lowerings.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D98910
David Green [Fri, 19 Mar 2021 18:30:11 +0000 (18:30 +0000)]
[ARM] Tone down the MVE scalarization overhead
The scalarization overhead was set deliberately high for MVE, whilst the
codegen was new. It helps protect us against the negative ramifications
of mixing scalar and vector instructions. This decreases that,
especially for floating point where the cost of extracting/inserting
lane elements can be low. For integer the cost is still fairly high due
to the cross-register-bank copy, but is no longer n^2 in the length of
the vector.
In general, this will decrease the cost of scalarizing floats and long
integer vectors. i64 increase in cost, having a high cost before and
after this patch. For floats this allows up to start doing things like
vectorizing fdiv instructions, even if they are scalarized.
Differential Revision: https://reviews.llvm.org/D98245
Stella Laurenzo [Wed, 17 Mar 2021 01:05:19 +0000 (18:05 -0700)]
[mlir][linalg] Add structured op builders from python opdsl.
* Makes the wrapped functions of the `@linalg_structured_op` decorator callable such that they emit IR imperatively when invoked.
* There are numerous TODOs that I will keep working through to achieve generality.
* Will true up exception handling tests as the feature progresses (for things that are actually errors once everything is implemented).
* Includes the addition of an `isinstance` method on concrete types in the Python API.
Differential Revision: https://reviews.llvm.org/D98754
Vy Nguyen [Fri, 19 Mar 2021 18:17:51 +0000 (14:17 -0400)]
[lld-macho][nfc] Fixed typo in comment
Missed this one from https://reviews.llvm.org/D97007?id=331759#inline-930034
Differential Revision: https://reviews.llvm.org/D98973
Philip Reames [Fri, 19 Mar 2021 18:15:29 +0000 (11:15 -0700)]
Update basic deref API to account for possiblity of free [NFC]
This patch is plumbing to support work towards the goal outlined in the recent llvm-dev post "[llvm-dev] RFC: Decomposing deref(N) into deref(N) + nofree".
The point of this change is purely to simplify iteration on other pieces on way to making the switch. Rebuilding with a change to Value.h is slow and painful, so I want to get the API change landed. Once that's done, I plan to more closely audit each caller, add the inference rules in their own patch, then post a patch with the langref changes and test diffs. The value of the command line flag is that we can exercise the inference logic in standalone patches without needing the whole switch ready to go just yet.
Differential Revision: https://reviews.llvm.org/D98908
Vy Nguyen [Thu, 18 Mar 2021 22:49:45 +0000 (18:49 -0400)]
[lld-macho] Define __mh_*_header synthetic symbols.
Bug: https://bugs.llvm.org/show_bug.cgi?id=49290
Differential Revision: https://reviews.llvm.org/D97007
Jonas Devlieghere [Fri, 19 Mar 2021 18:11:59 +0000 (11:11 -0700)]
[lldb] Make the API, Shell and Unit tests independent lit test suites
Make the API, Shell and Unit tests independent lit test suites. This
allows us to specify different dependencies and skip rebuilding all the
unit test (which is particularly expensive) when running check-lldb-api
or check-lldb-shell.
This does not change the autogenerated targets such as
check-lldb-shell-driver or the top level check-lldb target, which all
continue to work as before.
Differential revision: https://reviews.llvm.org/D98842
Alexey Bataev [Tue, 2 Mar 2021 18:53:49 +0000 (10:53 -0800)]
[Cost]Canonicalize the cost for logical or/and reductions.
The generic cost of logical or/and reductions should be cost of bitcast
<ReduxWidth x i1> to iReduxWidth + cmp eq|ne iReduxWidth.
Differential Revision: https://reviews.llvm.org/D97961
Bjorn Pettersson [Tue, 16 Mar 2021 11:47:16 +0000 (12:47 +0100)]
[LangRef] Describe memory layout for vectors types
There are a couple of caveats when it comes to how vectors are
stored to memory, and thereby also how bitcast between vector
and integer types work, in LLVM IR. Specially in relation to
endianess. This patch is an attempt to document such things.
Reviewed By: nlopes
Differential Revision: https://reviews.llvm.org/D94964
Craig Topper [Fri, 19 Mar 2021 17:47:47 +0000 (10:47 -0700)]
[RISCV] Add missing bitcasts to the results of lowerINSERT_SUBVECTOR and lowerEXTRACT_SUBVECTOR when handling mask vectors.
Found by adding asserts to LegalizeDAG to catch incorrect result
types being returned.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98964
Craig Topper [Fri, 19 Mar 2021 17:47:32 +0000 (10:47 -0700)]
[Hexagon] Return an i64 for result 0 from LowerREADCYCLECOUNTER instead of an i32.
As far as I can tell, the node coming in has an i64 result so the
return should have the same type. The HexagonISD node used for
this has a type profile that says the result is i64.
Found while trying to add assserts to LegalizeDAG to catch
result type mismatches.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D98962
Jianzhou Zhao [Fri, 19 Mar 2021 17:53:13 +0000 (17:53 +0000)]
[dfsan] Turn on testing origin tracking at atomics.ll
Andrei Elovikov [Fri, 19 Mar 2021 16:41:44 +0000 (09:41 -0700)]
[NFC][VPlan] Guard print routines with "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D98897
Andrei Elovikov [Thu, 18 Mar 2021 18:32:34 +0000 (11:32 -0700)]
[VPlan] Add plain text (not DOT's digraph) dumps
I foresee two uses for this:
1) It's easier to use those in debugger.
2) Once we start implementing more VPlan-to-VPlan transformations (especially
inner loop massaging stuff), using the vectorized LLVM IR as CHECK targets in
LIT test would become too obscure. I can imagine that we'd want to CHECK
against VPlan dumps after multiple transformations instead. That would be
easier with plain text dumps than with DOT format.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D96628
Craig Topper [Fri, 19 Mar 2021 17:39:33 +0000 (10:39 -0700)]
[RISCV] Lower scalable vector masked loads to intrinsics to match fixed vectors and reduce isel patterns.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98840
thomasraoux [Fri, 19 Mar 2021 17:32:23 +0000 (10:32 -0700)]
[mlir] Fix cuda integration test failure
Fraser Cormack [Fri, 19 Mar 2021 10:17:06 +0000 (10:17 +0000)]
[RISCV] Maintain fixed-length info when optimizing BUILD_VECTORs
I'm not sure how I failed to notice this before, but when optimizing
dominant-element BUILD_VECTORs we would lower via the scalable container type,
which lost us the information about the fixed length of the vector types. By
lowering via the fixed-length type we can preserve that information and
eliminate redundant vsetvli instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98938
Emily Shi [Fri, 19 Mar 2021 02:14:40 +0000 (19:14 -0700)]
[asan] specify c++ version in tests to fix compile error
If we don't specify the c++ version in these tests, it could cause compile errors because the compiler could default to an older c++
rdar://
75247244
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D98913
Philip Reames [Fri, 19 Mar 2021 17:07:12 +0000 (10:07 -0700)]
[SCEV] Factor out a lambda for strict condition splitting [NFC]
Fraser Cormack [Fri, 19 Mar 2021 12:27:15 +0000 (12:27 +0000)]
[RISCV] Add missing CHECKs to vector test
Since the "LMUL-MAX=2" output for some test functions differed between
RV32 and RV64, the update_llc_test_checks script failed to emit a
unified LMULMAX2 check for them. I'm not sure why it didn't warn about
this.
This patch also takes the opportunity to add unified RV32/RV64 checks to
help shorten the test file when the output for LMULMAX1 and LMULMAX2 is
identical but differs between the two ISAs.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98944
Fraser Cormack [Wed, 17 Mar 2021 12:30:11 +0000 (12:30 +0000)]
[RISCV] Fix missing scalable->fixed-length vector conversion
Returning the scalable-vector container type would present problems when
the fixed-length INSERT_VECTOR_ELT was used by later operations.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D98776
Martin Storsjö [Sat, 27 Feb 2021 12:46:16 +0000 (14:46 +0200)]
[libcxx] [test] Account for differences in a trailing slash in weakly_canonical
This seems to be a documented quirk in libc++'s implementation of
weakly_canonical (in a comment in the weakly_canonical test).
Together with a difference between windows and posix regarding whether
paths can go through nonexistent dirs, this results in a difference in
a trailing slash.
Just document this as expected, and degrade the comment from fixme to
a note, as MS STL and libstdc++ behave in the same way.
Differential Revision: https://reviews.llvm.org/D98642
Martin Storsjö [Fri, 19 Mar 2021 11:47:43 +0000 (13:47 +0200)]
[cmake] Enable Clang warnings about redundant semicolons
This matches what GCC warns about when -pedantic is enabled.
This should avoid such redundant semicolons creeping into the codebase.
Differential Revision: https://reviews.llvm.org/D98941
Jay Foad [Fri, 19 Mar 2021 16:43:52 +0000 (16:43 +0000)]
[AMDGPU] Rationalize some check prefixes and use more common prefixes. NFC.
Jay Foad [Fri, 19 Mar 2021 16:08:10 +0000 (16:08 +0000)]
[AMDGPU] Remove weird target triples from tests. NFC.
Markus Böck [Fri, 19 Mar 2021 16:47:07 +0000 (17:47 +0100)]
[Driver] Add -print-runtime-dir
This patch adds a new command line option to clang which outputs the directory containing clangs runtime libraries to stdout.
The primary use case for this command line flag is for build systems using clang-cl. Build systems when using clang-cl invoke the linker, that is either link or lld-link in this case, directly instead of invoking the compiler for the linking process as is common with the other drivers. This leads to issues when runtime libraries of clang, such as sanitizers or profiling, have to be linked in as the compiler cannot communicate the link directory to the linker.
Using this flag, build systems would be capable of getting the directory containing all of clang's runtime libraries and add it to the linker path.
Differential Revision: https://reviews.llvm.org/D98868
David Spickett [Wed, 17 Mar 2021 11:09:41 +0000 (11:09 +0000)]
[libcxx][Arm] Move buildbot flags into cmake files
Reviewed By: #libc, Mordante, curdeius
Differential Revision: https://reviews.llvm.org/D98771
Nicolas Vasilache [Fri, 19 Mar 2021 16:21:15 +0000 (16:21 +0000)]
[mlir][Linalg] NFC - Expose helper function `substituteMin`.
Jianzhou Zhao [Wed, 17 Mar 2021 16:22:01 +0000 (16:22 +0000)]
[dfsan] Add origin ABI wrappers
supported: dl_get_tls_static_info, calloc, clock_gettime,
dfsan_set_write_callback, dl_iterato_phdr, dlopen, memcpy,
memmove, memset, pread, read, strcat, strdup, strncpy
This is a part of https://reviews.llvm.org/D95835.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D98790
Paul Robinson [Fri, 19 Mar 2021 14:43:36 +0000 (07:43 -0700)]
[RGT] Recode more unreachable assertions and tautologies
Count iterations of zero-trip loops and assert the count is zero,
rather than asserting inside the loop.
Unreachable functions should use llvm_unreachable.
Remove tautological 'if' statements, even when they're following a
pattern of checks.
Found by the Rotten Green Tests project.
Simon Pilgrim [Fri, 19 Mar 2021 16:02:31 +0000 (16:02 +0000)]
[DAG] computeKnownBits - add ISD::MULHS/MULHU/SMUL_LOHI/UMUL_LOHI handling
Reuse the existing KnownBits multiplication code to handle the 'extend + multiply + extract high bits' pattern for multiply-high ops.
Noticed while looking at the codegen for D88785 / D98587 - the patch helps division-by-constant expansion code in particular, which suggests that we might have some further KnownBits div/rem cases we could handle - but this was far easier to implement.
Differential Revision: https://reviews.llvm.org/D98857
Jay Foad [Thu, 18 Mar 2021 17:00:14 +0000 (17:00 +0000)]
[AMDGPU] Add atomic optimizer nouse tests
Add some atomic optimizer tests where there is no use of the result of
the atomic operation, which is a common case in real code. NFC.
Differential Revision: https://reviews.llvm.org/D98952
Stanislav Mekhanoshin [Fri, 19 Mar 2021 15:36:03 +0000 (08:36 -0700)]
[AMDGPU] Remove dead glc1 handing in asm parser. NFC.
Balázs Kéri [Fri, 19 Mar 2021 14:46:20 +0000 (15:46 +0100)]
[clang][ASTImporter] Add import support for SourceLocExpr.
It is possible that imported `SourceLocExpr` can cause not expected behavior (if `__builtin_LINE()` is used together with `__LINE__` for example) but still it may be worth to import these because some projects use it.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D98876
Christian Kühnel [Wed, 24 Feb 2021 14:50:02 +0000 (15:50 +0100)]
propose Chocolately as package manager
Installing the Unix tools on Windows is quite painful. To make things easier,
I explained how to use a package manager or a Docker image.
Note: This still uses the GNUWin tools as explained on this page. Once we
replace these with something else, we would also need to update the
installation commands.
Differential Revision: https://reviews.llvm.org/D97387
Arthur O'Dwyer [Tue, 16 Mar 2021 16:51:24 +0000 (12:51 -0400)]
[libc++] Consistency on _LIBCPP_CLANG_VER tests in <type_traits>.
This came out of my review comments on D97283.
This patch re-enables the use of `__is_fundamental`, `__is_signed`, etc.
on non-Clang compilers. Previously, when we found that a builtin didn't
work on old Clangs, we had been reacting by limiting its use to new Clangs
(i.e., we'd also stop using it on new GCCs and new MSVCs, just because of
the old Clang bug). I claim that this was unintentional.
Notice that on Apple Clang, `_LIBCPP_COMPILER_CLANG` is defined and
`_LIBCPP_CLANG_VER` is not defined (therefore `0` in arithmetic expressions).
We assume that Apple Clang has all the bugs of all the Clangs.
Differential Revision: https://reviews.llvm.org/D98720
Simon Pilgrim [Fri, 19 Mar 2021 13:34:47 +0000 (13:34 +0000)]
[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),undef) -> bop(shuffle'(x,y),shuffle'(z,w))
Followup to D96345, handle unary shuffles of binops (as well as binary shuffles) if we can merge the shuffle with inner operand shuffles.
Differential Revision: https://reviews.llvm.org/D98646
Martin Storsjö [Wed, 14 Oct 2020 12:37:13 +0000 (15:37 +0300)]
[libcxx] [test] Fix weakly_canonical for windows
Differential Revision: https://reviews.llvm.org/D98643
Martin Storsjö [Tue, 16 Mar 2021 12:37:28 +0000 (14:37 +0200)]
[libcxx] [test] Avoid race conditions between tests regarding temp directories
Prior to
e0d01294bc124211a8ffb55e69162eb34a242680, all tests used a
random directory name, but now it is deterministic, based on the
test name. This change was done under the assumption that the filename
portion of the cwd is unique across tests that use the filesystem
test temporary directories.
When running tests locally, the cwd of the test is something like
"<build-dir>/test/<test path>/Output/copy_assign.pass.cpp.dir",
and the filename portion, "copy_assign.pass.cpp.dir", is used as
base for the temp directory names.
The change noted that there's a risk for race conditions if multiple
threads within one test try to create temp directories in parallel, but
that doesn't really happen in practice.
However, if running tests with a large number of parallel workers,
multiple tests with the same filename portion, e.g. "copy_assign.pass.cpp.dir",
can run in parallel, leading to race conditions across processes.
Therefore, add a hash of the full cwd to distinguish such cases
from each other.
Secondly, don't use two separate levels of temporary directories
(<base>/static_env.0). When cleaning up, only the individual
directory is removed, leaving the empty intermediate directory
behind littering the temp directory.
Differential Revision: https://reviews.llvm.org/D98703
Martin Storsjö [Fri, 26 Feb 2021 13:10:53 +0000 (15:10 +0200)]
[libcxx] [test] Fix windows errors in fs.op.rename
Differential Revision: https://reviews.llvm.org/D98640
Paul C. Anagnostopoulos [Thu, 25 Feb 2021 21:33:08 +0000 (16:33 -0500)]
[TableGen] Improve handling of template arguments
This requires changes to TableGen files and some C++ files due to
incompatible multiclass template arguments that slipped through
before the improved handling.
Ricky Taylor [Wed, 17 Mar 2021 21:34:36 +0000 (21:34 +0000)]
[M68k] Replace unknown operand with explicit type
Replace the unknown operand used for immediate operands for DIV/MUL with a fixed 16-bit immediate.
This is required since the assembly parser generator requires that all operands are typed.
Differential Revision: https://reviews.llvm.org/D98819
Maxim Kuvyrkov [Fri, 19 Mar 2021 13:37:19 +0000 (13:37 +0000)]
[WoA][MSVC] Use default linker setting in MSVC-compatible driver [take 2]
At the moment "link.exe" is hard-coded as default linker in MSVC.cpp,
so there's no way to use LLD as default linker for MSVC driver.
This patch adds checking of CLANG_DEFAULT_LINKER to MSVC.cpp and
updates unit-tests that expect link.exe linker to explicitly select it
via -fuse-ld=link, so that buildbots and other builds that set
-DCLANG_DEFAULT_LINKER=foobar don't fail these tests.
This is a squash of
- https://reviews.llvm.org/D98493 (MSVC.cpp change) and
- https://reviews.llvm.org/D98862 (unit-tests change)
Reviewed By: maxim-kuvyrkov
Differential Revision: https://reviews.llvm.org/D98935
Jeroen Dobbelaere [Fri, 19 Mar 2021 13:34:25 +0000 (14:34 +0100)]
Support intrinsic overloading on unnamed types
This patch adds support for intrinsic overloading on unnamed types.
This fixes PR38117 and PR48340 and will also be needed for the Full Restrict Patches (D68484).
The main problem is that the intrinsic overloading name mangling is using 's_s' for unnamed types.
This can result in identical intrinsic mangled names for different function prototypes.
This patch changes this by adding a '.XXXXX' to the intrinsic mangled name when at least one of the types is based on an unnamed type, ensuring that we get a unique name.
Implementation details:
- The mapping is created on demand and kept in Module.
- It also checks for existing clashes and recycles potentially existing prototypes and declarations.
- Because of extra data in Module, Intrinsic::getName needs an extra Module* argument and, for speed, an optional FunctionType* argument.
- I still kept the original two-argument 'Intrinsic::getName' around which keeps the original behavior (providing the base name).
-- Main reason is that I did not want to change the LLVMIntrinsicGetName version, as I don't know how acceptable such a change is
-- The current situation already has a limitation. So that should not get worse with this patch.
- Intrinsic::getDeclaration and the verifier are now using the new version.
Other notes:
- As far as I see, this should not suffer from stability issues. The count is only added for prototypes depending on at least one anonymous struct
- The initial count starts from 0 for each intrinsic mangled name.
- In case of name clashes, existing prototypes are remembered and reused when that makes sense.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D91250
Christian Sigg [Fri, 19 Mar 2021 09:11:51 +0000 (10:11 +0100)]
[mlir] Rename gpu-to-llvm pass implementation file
Also remove populate patterns function and binary annotation name option.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D98930
Aaron Ballman [Fri, 19 Mar 2021 12:33:27 +0000 (08:33 -0400)]
Automate common diagnostic checking for statement attributes
Clang currently automates a fair amount of diagnostic checking for
declaration attributes based on the declarations in Attr.td. It checks
for things like subject appertainment, number of arguments, language
options, etc. This patch uses the same machinery to perform diagnostic
checking on statement attributes.
Nemanja Ivanovic [Fri, 19 Mar 2021 11:24:42 +0000 (06:24 -0500)]
[PowerPC] Fix the check for 16-bit signed field in peephole
When a D-Form instruction is fed by an add-immediate, we attempt
to merge the two immediates to form a single displacement so we
can remove the add-immediate.
However, we don't check whether the new displacement fits into
a 16-bit signed immediate field early enough. Namely, we do a
sign-extend from 16 bits first which will discard high bits and
then we check whether the result is a 16-bit signed immediate.
It of course will always be.
Move the check prior to the sign extend to ensure we are checking
the correct value.
Fixes https://bugs.llvm.org/show_bug.cgi?id=49640
Abhina Sreeskantharajan [Fri, 19 Mar 2021 12:09:01 +0000 (08:09 -0400)]
[SystemZ][z/OS] Distinguish between text and binary files on z/OS
This patch consists of the initial changes to help distinguish between text and binary content correctly on z/OS. I would like to get feedback from Windows users on setting OF_None for all ToolOutputFiles. This seems to have been done as an optimization to prevent CRLF translation on Windows in the past.
Reviewed By: zibi
Differential Revision: https://reviews.llvm.org/D97785
Simonas Kazlauskas [Fri, 19 Mar 2021 00:18:34 +0000 (02:18 +0200)]
[X86, NFC] Update stack-clash tests using the automated tooling
This is in preparation of changes in this area (such as D98789 and D98906).
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D98909
Ricky Taylor [Thu, 11 Mar 2021 20:37:00 +0000 (20:37 +0000)]
[M68k] Convert register Aliases to AltNames
This makes it simpler to determine when two registers are actually the
same vs just partially aliasing.
The only real caveat is that it becomes impossible to know which name
was used for the register previously. (i.e. parsing assembly and then
disassembling it can result in the register name changing.)
Differential Revision: https://reviews.llvm.org/D98536
Ricky Taylor [Thu, 11 Mar 2021 20:35:04 +0000 (20:35 +0000)]
[M68k] Introduce DReg bead
This is required in order to determine during disassembly whether a
Reg bead without associated DA bead is referring to a data register.
Differential Revision: https://reviews.llvm.org/D98534
Jay Foad [Fri, 19 Mar 2021 09:27:11 +0000 (09:27 +0000)]
[AMDGPU] Remove some redundant code. NFC.
This is redundant because we have already checked that we can't handle
divergent 64-bit atomic operands.
Jay Foad [Thu, 18 Mar 2021 17:16:48 +0000 (17:16 +0000)]
[AMDGPU] Skip building some IR if it won't be used. NFC.
Jay Foad [Thu, 18 Mar 2021 16:52:04 +0000 (16:52 +0000)]
[AMDGPU] Remove duplicate test functions. NFC.
Jay Foad [Thu, 18 Mar 2021 16:13:16 +0000 (16:13 +0000)]
[AMDGPU] Sink Intrinsic::getDeclaration calls to where they are used. NFC.
Martin Storsjö [Fri, 19 Mar 2021 10:30:08 +0000 (12:30 +0200)]
Revert "[lit] Handle plain negations directly in the internal shell"
This reverts commit
d09adfd3993cbc1043b4d20232bce8bd774232cc.
That commit caused failures in
clang-tidy/infrastructure/validate-check-names.cpp on windows
buildbots.
That change exposed a surprising issue, not directly related to
this change in itself, but in how TestRunner quotes command line
arguments that later are going to be interpreted by a msys based
tool (like grep.exe, when provided by Git for Windows). This
worked accidentally before, when grep was invoked via not.exe
which took a more conservative approach to windows argument quoting.
Muhammad Omair Javaid [Fri, 19 Mar 2021 10:29:53 +0000 (15:29 +0500)]
[LLDB] Skip TestExitDuringExpression on aarch64/linux buildbot
TestExitDuringExpression test_exit_before_one_thread_unwind fails
sporadically on both Arm and AArch64 linux buildbots.
This seems like a thread timing issue. I am marking it skip for now.
Kristof Beyls [Fri, 19 Mar 2021 09:27:34 +0000 (10:27 +0100)]
[docs] Add calendar info for SVE sync-ups
Simon Pilgrim [Thu, 18 Mar 2021 22:36:01 +0000 (22:36 +0000)]
[KnownBits] Add knownbits analysis for mulhs/mulu 'multiply high' instructions
Split off from D98857
https://reviews.llvm.org/D98866
Alexander Belyaev [Thu, 18 Mar 2021 21:35:48 +0000 (22:35 +0100)]
[mlir] Add a roundtrip test for 'linalg.tiled_loop' on buffers.
https://llvm.discourse.group/t/rfc-add-linalg-tileop/2833
Differential Revision: https://reviews.llvm.org/D98900
Christian Sigg [Fri, 19 Mar 2021 08:27:55 +0000 (09:27 +0100)]
[mlir] Remove ConvertKernelFuncToBlob
All users have been converted to gpu::SerializeToBlobPass.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D98928