Sanjay Patel [Sat, 22 Jan 2022 17:36:12 +0000 (12:36 -0500)]
[InstCombine] try to fold binop with phi operands
This is an alternate version of D115914 that handles/tests all binary opcodes.
I suspect that we don't see these patterns too often because -simplifycfg
would convert the minimal cases into selects rather than leave them in phi form
(note: instcombine has logic holes for combining the select patterns too though,
so that's another potential patch).
We only create a new binop in a predecessor that unconditionally branches to
the final block.
https://alive2.llvm.org/ce/z/C57M2F
https://alive2.llvm.org/ce/z/WHwAoU (not safe to speculate an sdiv for example)
https://alive2.llvm.org/ce/z/rdVUvW (but it is ok on this path)
Differential Revision: https://reviews.llvm.org/D117110
Craig Topper [Sat, 22 Jan 2022 19:55:13 +0000 (11:55 -0800)]
[RISCV] Don't Custom legalize f16/f32/f64 bitcasts if those types aren't Legal.
John Ericson [Sat, 22 Jan 2022 06:33:49 +0000 (01:33 -0500)]
[openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Differential Revision: https://reviews.llvm.org/D117945
Peter Klausler [Thu, 20 Jan 2022 00:25:41 +0000 (16:25 -0800)]
[flang] Support DECIMAL='COMMA' mode in namelist I/O
DECIMAL='COMMA' mode affects item separators, real editing, and
complex editing.
Differential Revision: https://reviews.llvm.org/D117906
Peter Klausler [Fri, 14 Jan 2022 21:34:10 +0000 (13:34 -0800)]
[flang] Don't drop format string for external child I/O
In user-defined derived type I/O to an external unit, don't
omit the format string from the constructor of ChildFormattedIoStatement.
And include any user IOMSG text in the crash message of the
parent, if it doesn't catch errors.
Differential Revision: https://reviews.llvm.org/D117903
Arthur O'Dwyer [Sat, 22 Jan 2022 16:53:00 +0000 (11:53 -0500)]
[libc++] [test] {cpo,niebloid}.compile.pass.cpp: Also test their constness.
This will detect if someone writes `inline auto cpo =` instead of
`inline constexpr auto cpo =`. I don't know how that'd be possible,
but it's easy to test, so let's test it.
Florian Hahn [Sat, 22 Jan 2022 15:34:10 +0000 (15:34 +0000)]
[LV] Always create VPWidenCanonicalIVRecipe, optimize away later.
This patch updates createBlockInMask to always generate
VPWidenCanonicalIVRecipe and adds a transform to optimize it away later,
if it is not needed.
This is a step towards breaking up VPWidenIntOrFpInductionRecipe and
explicitly distinguishing between vector phis and scalarizing.
Split off from D116123.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D117140
Qiu Chaofan [Sat, 22 Jan 2022 15:29:34 +0000 (23:29 +0800)]
[PowerPC] Support parsing GNU attributes in MC
This patch is the first step to enable support of GNU attribute in LLVM
PowerPC, enabling it for PowerPC targets, otherwise llvm-mc raises error
when seeing the attribute section.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D115854
Qiu Chaofan [Sat, 22 Jan 2022 15:20:14 +0000 (23:20 +0800)]
[PowerPC] Change CTR clobber estimation for 128-bit floating types
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D117459
David Green [Sat, 22 Jan 2022 13:20:36 +0000 (13:20 +0000)]
[DAG] Convert truncstore(extend(x)) back to store(x)
Pulled out of D106237, this folds truncstore(extend(x)) back to store(x)
if the original store was legal. This can come up due to the order we
fold nodes. A fold from X86 needs to be adjusted to prevent infinite
loops, to have it pick the operand of a trunc more directly.
Differential Revision: https://reviews.llvm.org/D117901
luxufan [Sat, 22 Jan 2022 08:07:17 +0000 (16:07 +0800)]
reapply
de872382951 "[JITLink] Add anonymous symbols in LinkGraph..."
with fixes
This reapply `
de872382951572b70dfaefe8d77eb98d15586115`, which was
reverted in `
fdb6578514dd3799ad23c8bbb7699577c0fb414d`
Add `# REQUIRES: asserts` in test file `anonymous_symbol.s` to disable
this test for non-debug build
Micah Weston [Sat, 22 Jan 2022 12:39:22 +0000 (12:39 +0000)]
[AArch64] Optimize add/sub with immediate through MIPeepholeOpt
Fixes the build issue with D111034, whose goal was to optimize
add/sub with long immediates.
Optimize ([add|sub] r, imm) -> ([ADD|SUB] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
Optimize ([add|sub] r, imm) -> ([SUB|ADD] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.
The change which fixed the build issue in D111034 was the use of new virtual
registers so that SSA form is maintained until deleting MI.
Differential Revision: https://reviews.llvm.org/D117429
Alexander Belyaev [Sat, 22 Jan 2022 10:42:47 +0000 (11:42 +0100)]
[mlir] Add SingleBlockImplicitTerminator<"tensor::YieldOp"> to PadOp.
Mark de Wever [Fri, 21 Jan 2022 19:08:57 +0000 (20:08 +0100)]
[libc++] Use addressof in unordered_set.
This addresses the usage of `operator&` in `<unordered_set>`.
(Note there are still more headers with the same issue.)
Reviewed By: #libc, philnik, Quuxplusone
Differential Revision: https://reviews.llvm.org/D117917
fourdim [Fri, 21 Jan 2022 19:34:13 +0000 (03:34 +0800)]
[JITLink][RISCV] Support R_RISCV_SET* and R_RISCV_32_PCREL relocations
This patch supports R_RISCV_SET* and R_RISCV_32_PCREL relocations in JITLink.
Reviewed By: StephenFan
Differential Revision: https://reviews.llvm.org/D117082
luxufan [Sat, 22 Jan 2022 09:26:54 +0000 (17:26 +0800)]
Revert "[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols"
This reverts commit
de872382951572b70dfaefe8d77eb98d15586115.
Buildbot check error
luxufan [Sat, 22 Jan 2022 08:07:17 +0000 (16:07 +0800)]
[JITLink] Add anonymous symbols in LinkGraph for unnamed temporary symbols
In RISCV, temporary symbols will be used to generate dwarf, eh_frame sections..., and will be placed in object code's symbol table. However, LLVM does not use names on these temporary symbols. This patch add anonymous symbols in LinkGraph for these temporary symbols.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D116475
Prashant Kumar [Fri, 21 Jan 2022 18:23:22 +0000 (23:53 +0530)]
[MLIR] Fix negative gcd in `normalizeDivisionByGCD` function.
When the coefficients of dividend are negative, the gcd may be negative
which will change the sign of dividend and overflow denominator.
Reviewed By: Groverkss
Differential Revision: https://reviews.llvm.org/D117911
Wei Wang [Tue, 18 Jan 2022 22:08:48 +0000 (14:08 -0800)]
[time-trace] Add optimizer and codegen regions to NPM
Optimizer and codegen regions were only added to legacy PM. Add
them to NPM as well.
Differential Revision: https://reviews.llvm.org/D117605
Peter Klausler [Tue, 18 Jan 2022 18:40:10 +0000 (10:40 -0800)]
[flang] Allow INQUIRE() on a child unit in user-defined I/O procedure
A procedure that implements a user-defined derived type I/O operation
is allowed to perform an INQUIRE statement on its unit.
Differential Revision: https://reviews.llvm.org/D117905https://reviews.llvm.org/D117905
Alex Fan [Fri, 21 Jan 2022 11:51:09 +0000 (19:51 +0800)]
[RISCV][RFC] add MC support for zbkc subextension
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117874
Dave Lee [Fri, 14 Jan 2022 00:02:45 +0000 (16:02 -0800)]
[lldb] Allow aliases to aliases of raw input commands
Allow users to create aliases for aliases to raw input commands. That probably
sounds convoluted, so here's an example:
```
command alias some-setup env SOMEVAR=SOMEVALUE
```
This an alias based on `env`, which itself is an alias for `_regex-env`.
`_regex-env` is a `command regex` command, which takes raw input.
The above `some-setup` alias fails with:
```
error: Unable to create requested alias.
```
This change allows such aliases to be created. lldb already supports aliases to
aliases for parsed commands.
Differential Revision: https://reviews.llvm.org/D117259
Peter Klausler [Tue, 18 Jan 2022 23:17:15 +0000 (15:17 -0800)]
[flang] Fix crash from USE-associated defined I/O subprograms
User-defined derived type I/O implementation subroutines and
generic interfaces may be USE-associated, but the code that builds
the type description table wasn't allowing for that possibility.
Add a call to GetUltimate() to cope.
Differential Revision: https://reviews.llvm.org/D117902
Julian Lettner [Sat, 22 Jan 2022 00:58:06 +0000 (16:58 -0800)]
[TSan] Omit vfork interceptor iOS simulator runtime
`_vfork` moved from libsystem_kernel.dylib to libsystem_c.dylib as part
of the below changes. The iOS simulator does not actually have
libsystem_kernel.dylib of its own, it only has the host Mac's. The
umbrella-nature of Libsystem makes this movement transparent to
everyone; except the simulator! So when we "back deploy", i.e., use the
current version of TSan with an older simulator runtime then this symbol
is now missing, when we run on the latest OS (but an older simulator
runtime).
Note we use `SANITIZER_IOS` because usage of vfork is forbidden on iOS
and the API is completely unavailable on watchOS and tvOS, even if this
problem is specific to the iOS simulator.
Caused by:
rdar://
74818691 (Shim vfork() to fork syscall on iOS)
rdar://
76762076 (Shim vfork() to fork syscall on macOS)
Radar-Id: rdar://8634734
Peter Klausler [Wed, 19 Jan 2022 17:16:07 +0000 (09:16 -0800)]
[flang] Fix repeated "DT" editing
User-defined derived type editing in formatted I/O wasn't
working with repeat counts; e.g., "2DT(10)". The solution required
some code to be moved from GetNextDataEdit() to CueUpNextDataEdit() so
that a stack entry for a nonparenthesized repeated data edit
descriptor would work correctly -- all other data edit descriptors
are capable of dealing with repetition in their callees, so the bug
hadn't been exposed before.
Debugging this problem led to some improvements in error messages
for bad format strings, and those changes have been retained; also,
a dead member function was discovered and expunged.
Differential Revision: https://reviews.llvm.org/D117904
Fangrui Song [Sat, 22 Jan 2022 01:00:03 +0000 (17:00 -0800)]
[XRay][test] Clean up llc RUN lines
Petr Hosek [Mon, 10 Jan 2022 22:51:37 +0000 (14:51 -0800)]
[CMake] Passthrough OSX CMake options to builtins and runtimes
When using the default target, there's no other way to pass these
into the builtins and runtimes subbuilds.
Differential Revision: https://reviews.llvm.org/D116976
Joe Loser [Fri, 21 Jan 2022 20:01:34 +0000 (15:01 -0500)]
[libc++][test] Add const and reference tests for enable_view. NFC.
As discussed in https://reviews.llvm.org/D117714, there is missing test coverage
for the behavior of `enable_view` when given a const or reference qualified
type. Add such tests showing the current behavior.
Differential Revision: https://reviews.llvm.org/D117918
Chris Bieneman [Fri, 21 Jan 2022 16:47:15 +0000 (10:47 -0600)]
[split-file] Respect input file's line endings
This change adds support for split-file to respect the line ending style
of the input file. This enables split-file to work as expected on
Windows with input files containing CRLF line endings.
The test files added along with this change mirror the existing basic
tests, but are forced to contain CRLF line endings via git attributes.
This will result in the tests always containing CRLF line endings when
checked out regardless of the user's OS.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D117897
not-jenni [Sat, 22 Jan 2022 00:16:29 +0000 (16:16 -0800)]
[mlir][tosa] Add clamp + clamp as single clamp canonicalization
When 2 clamp ops are in a row, they can be canonicalized into a single clamp
that uses the most constrained range
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D117934
Mitch Phillips [Sat, 22 Jan 2022 00:22:29 +0000 (16:22 -0800)]
NFC (build fix): Add header for llvm::errs().
Looks like
e9211e039377 unfortunately broke the sanitizer build bots,
because those bots compile the symbolizer with DLLVM_ENABLE_THREADS=Off.
Likely, before the patch, this header was transitively included.
John Ericson [Sun, 16 Jan 2022 06:14:24 +0000 (06:14 +0000)]
[clang][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Differential Revision: https://reviews.llvm.org/D117419
Aart Bik [Fri, 21 Jan 2022 01:27:23 +0000 (17:27 -0800)]
[mlir][sparse] add ability for sparse tensor output
Rationale:
Although file I/O is a bit alien to MLIR itself, we provide two convenient ways
for sparse tensor I/O. The input part was already there (behind the swiss army
knife sparse_tensor.new). Now we have a sparse_tensor.out to write out data. As
before, the ops are kept vague and may change in the future. For now this
allows us to compare TACO vs MLIR very easily.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D117850
Dave Lee [Thu, 20 Jan 2022 22:18:20 +0000 (14:18 -0800)]
[lldb] Fix timer logging inverted quiet condition
The logic of `g_quiet` was inverted in D26243. This corrects the issue.
Without this, running `log timers enable` produces a high volume of incremental
timer output.
Differential Revision: https://reviews.llvm.org/D117837
Zequan Wu [Fri, 21 Jan 2022 23:09:42 +0000 (15:09 -0800)]
[llvm-pdbutil] Fix gaps ouput.
Bixia Zheng [Fri, 21 Jan 2022 23:15:06 +0000 (15:15 -0800)]
Fix a commit.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D117932
Bixia Zheng [Fri, 21 Jan 2022 22:40:36 +0000 (14:40 -0800)]
Only run MLIR PyTACO tests when python bindings are enabled.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D117930
Sam McCall [Fri, 21 Jan 2022 22:18:23 +0000 (23:18 +0100)]
[CodeComplete] fix nullptr crash in
612f5ed8823120
Arthur Eubanks [Fri, 21 Jan 2022 19:55:17 +0000 (11:55 -0800)]
[gn build] Set HAVE_MALLINFO2=1
I'm seeing deprecated warnings due to using mallinfo() instead of
mallinfo2().
../../llvm/lib/Support/Unix/Process.inc:98:10: warning: 'mallinfo' is deprecated [-Wdeprecated-declarations]
mi = ::mallinfo();
mallinfo2() is part of glibc 2.33 which was released in Feb 2021, which
is fairly recent but I think gn users should be using fairly up to date
glibcs.
If this breaks people we could make this a gn arg instead.
Differential Revision: https://reviews.llvm.org/D117916
Dávid Bolvanský [Fri, 21 Jan 2022 21:59:14 +0000 (22:59 +0100)]
[x86] regenerate smul-with-overflow.ll; add test which failed with llvm 13 and lower (NFC)
Arthur Eubanks [Fri, 21 Jan 2022 21:53:03 +0000 (13:53 -0800)]
Revert "[gn build] Set HAVE_MALLINFO2=1"
This reverts commit
9f4cc5a6bb56b42bb90ea31f10ecf8fed8f07653.
Breaks http://45.33.8.238/macm1/26108/step_4.txt.
Shubham Sandeep Rastogi [Fri, 21 Jan 2022 21:43:51 +0000 (13:43 -0800)]
Revert "Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section."
This reverts commit
d84d1135d80c1dead6564347943ba56eed5aac3b. to investigate buildbot failures
Arthur Eubanks [Fri, 21 Jan 2022 19:55:17 +0000 (11:55 -0800)]
[gn build] Set HAVE_MALLINFO2=1
I'm seeing deprecated warnings due to using mallinfo() instead of
mallinfo2().
../../llvm/lib/Support/Unix/Process.inc:98:10: warning: 'mallinfo' is deprecated [-Wdeprecated-declarations]
mi = ::mallinfo();
mallinfo2() is part of glibc 2.33 which was released in Feb 2021, which
is fairly recent but I think gn users should be using fairly up to date
glibcs.
If this breaks people we could make this a gn arg instead.
Differential Revision: https://reviews.llvm.org/D117916
Shubham Sandeep Rastogi [Wed, 17 Nov 2021 23:05:58 +0000 (15:05 -0800)]
Emit swift5 reflection section data in dsym bundle generated by dsymutil in the Dwarf section.
Add support for Swift reflection metadata to dsymutil.
This patch adds support for copying Swift reflection metadata (__swift5_.* sections) from .o files to into the symbol-rich binary in the output .dSYM. The functionality is automatically enabled only if a .o file has reflection metadata sections and the binary doesn't. When copying dsymutil moves the section from the __TEXT segment to the __DWARF segment.
rdar://
76973336
https://reviews.llvm.org/D115007
Muiez Ahmed [Fri, 21 Jan 2022 21:18:46 +0000 (16:18 -0500)]
[SystemZ][z/OS][NFC] Remove extra symbol
Craig Topper [Fri, 21 Jan 2022 20:31:41 +0000 (12:31 -0800)]
[RISCV] Strengthen a SDTypeProfile. Fix formatting.
Alex Brachet [Fri, 21 Jan 2022 21:00:39 +0000 (21:00 +0000)]
[Sema] Warn about printf %n on Android and Fuchsia
The `printf` specifier `%n` is not supported on Android's libc and will soon be removed from Fuchsia's
Reviewed By: enh
Differential Revision: https://reviews.llvm.org/D117611
Daniel Thornburgh [Fri, 21 Jan 2022 19:26:52 +0000 (19:26 +0000)]
[Support] Update missed tests with lazy caching behavior.
Fixes test failures created by https://reviews.llvm.org/D117589.
Reviewed By: zhuhan0
Differential Revision: https://reviews.llvm.org/D117915
Rob Suderman [Fri, 21 Jan 2022 20:22:50 +0000 (12:22 -0800)]
[mlir] Add polynomial approximation for atan and atan2
Implement a taylor series approximation for atan and add an atan2 lowering
that uses atan's appromation. This includes tests for edge cases and tests
for each quadrant.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D115682
Amir Ayupov [Sat, 30 Oct 2021 00:27:38 +0000 (17:27 -0700)]
[BOLT][NFC] Reduce includes with include-what-you-use
Summary: Removed redundant includes with IWYU
Test Plan: ninja bolt
Reviewers: maksfb
FBD32043568
Amir Ayupov [Thu, 20 Jan 2022 04:20:55 +0000 (20:20 -0800)]
[BOLT] Make ICP target selection (more) deterministic
Summary: Break ties by selecting targets with lower addresses.
Reviewers: maksfb
FBD33677001
Amir Ayupov [Fri, 9 Apr 2021 06:31:12 +0000 (23:31 -0700)]
[BOLT][NFC] Expand auto types pt.2
Summary: Expand autos where it may lead to differences in the BOLT binary.
Test Plan: NFC
Reviewers: maksfb
Reviewed By: maks
FBD27673231
David Green [Fri, 21 Jan 2022 20:01:06 +0000 (20:01 +0000)]
[AArch64] Add extra tests useful in testing hadd. NFC
wren romano [Thu, 20 Jan 2022 20:56:25 +0000 (12:56 -0800)]
[mlir][sparse] Adding assertions for overhead storage types
Fixes https://bugs.llvm.org/show_bug.cgi?id=52314 aka https://github.com/llvm/llvm-project/issues/51656
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D117597
Mark de Wever [Fri, 21 Jan 2022 17:00:33 +0000 (18:00 +0100)]
[libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.
(Note there are still more headers with the same issue.)
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D117393
Craig Topper [Fri, 21 Jan 2022 19:30:49 +0000 (11:30 -0800)]
[RISCV] Simplify interface to combineMUL_VLToVWMUL. NFC
Instead of passing the both the SDNode* and 2 of the operands
in two different orders, just pass the SDNode * and a bool to
indicate which operand order to test.
While there rename to combineMUL_VLToVWMUL_VL.
Valentin Clement [Fri, 21 Jan 2022 19:34:17 +0000 (20:34 +0100)]
Revert "[flang] Update tco tool pipline and add translation to LLVM IR"
This reverts commit
68db0e25df4b1edaa2c6080eb88453ab01ea01d3.
Alexander Belyaev [Fri, 21 Jan 2022 18:29:08 +0000 (19:29 +0100)]
[mlir] Move linalg::PadTensorOp to tensor::PadOp.
RFC: https://llvm.discourse.group/t/rfc-move-linalg-padtensorop-to-tensor-padop/5785
Differential Revision: https://reviews.llvm.org/D117892
Lei Zhang [Fri, 7 Jan 2022 22:19:41 +0000 (17:19 -0500)]
[mlir][spirv] Support size-1 vector inserts during conversion
Differential Revision: https://reviews.llvm.org/D115517
Craig Topper [Fri, 21 Jan 2022 18:49:50 +0000 (10:49 -0800)]
[RISCV] Use RVBUnary in more places to simplify some tablegen declarations. NFCI
Florian Mayer [Thu, 6 Jan 2022 00:27:23 +0000 (16:27 -0800)]
[NFC] Improve code reuse.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D116711
eopXD [Thu, 20 Jan 2022 18:16:00 +0000 (10:16 -0800)]
[Clang][RISCV] Restrict rvv builtins with zve macros
The `zve` extension specifies the maximum ELEN for both integer and floating
point mode - defined by macro `__riscv_v_elen` and `__riscv_v_elen_fp`.
This commit restricts the functions in riscv_vector.h by the zve defined
macro-s.
Change enum `RISCVExtension` to `RISCVPredefinedMacro` since now it
contains not only extensions. Also added type alignment to it.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112986
John Paul Adrian Glaubitz [Fri, 21 Jan 2022 17:57:17 +0000 (09:57 -0800)]
[Sparc] Don't define __sparcv9 and __sparcv9__ when targeting V8+
Currently, clang defines the three macros __sparcv9, __sparcv9__
and __sparc_v9__ when targeting the V8+ baseline, i.e. using the
V9 instruction set on a 32-bit target.
Since neither gcc nor SolarisStudio define __sparcv9 and __sparcv9__
when targeting V8+, some existing code such as the glibc breaks when
defining either of these two macros on a 32-bit target as they are
used to detect a 64-bit target. Update the tests accordingly.
Fixes PR49562.
Reviewed By: jrtc27, MaskRay, hvdijk
Differential Revision: https://reviews.llvm.org/D98574
Petr Hosek [Fri, 21 Jan 2022 17:53:14 +0000 (09:53 -0800)]
Revert "[cmake] Duplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm"
This reverts commit
4af11272f57a4a6fed2932e9e0857b2c1a707c51.
Valentin Clement [Fri, 21 Jan 2022 17:30:34 +0000 (18:30 +0100)]
[flang] Remove target and require shell
Fix failure from
68db0e25df4b1edaa2c6080eb88453ab01ea01d3 on
arm buildbot.
David Tenty [Fri, 21 Jan 2022 17:20:28 +0000 (12:20 -0500)]
Revert "[compiler-rt][cmake] Use HandleOutOfTreeLLVM like libcxx and friends"
This reverts commit
8c9f62ea90c70d538766a81ef5980c9223b8566b, which is causing build failures on
the bots because it inadvertently changes the output directory of the compiler-rt libs when
built as a runtime.
Differential Revision: https://reviews.llvm.org/D117815
Marek Kurdej [Fri, 21 Jan 2022 17:17:55 +0000 (18:17 +0100)]
[clang-format] Fix comment in spaceRequiredBefore. NFC.
Mark de Wever [Fri, 21 Jan 2022 16:59:07 +0000 (17:59 +0100)]
Revert "[libc++] Use addressof in unordered_map."
This reverts commit
cab96169380296a496614f433507d86b743f0d02.
This breaks the CI.
Bixia Zheng [Fri, 14 Jan 2022 00:27:28 +0000 (16:27 -0800)]
Upstream MLIR PyTACO implementation.
Add TACO tests to test/Integration/Dialect/SparseTensor/taco. Add the MLIR
PyTACO implementation as tools under the directory.
Reviewed By: aartbik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D117260
Mark de Wever [Sun, 7 Nov 2021 18:44:59 +0000 (19:44 +0100)]
[libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.
(Note there are still more headers with the same issue.)
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D117393
Jake Egan [Fri, 21 Jan 2022 16:18:48 +0000 (11:18 -0500)]
[ifs] Use a tmp file instead of "-"
Currently, Clang on AIX uses the system assembler to generate object files from assembly. The use of `-o -` results in a file named `-` instead of output to stdout. This patch uses a temporary object file instead.
Reviewed By: DiggerLin, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D117587
serge-sans-paille [Fri, 21 Jan 2022 16:05:36 +0000 (17:05 +0100)]
Include missing "llvm/Support/Path.h" in "flang/lib/Frontend/CompilerInvocation.cpp"
Chris Bieneman [Wed, 19 Jan 2022 00:20:14 +0000 (18:20 -0600)]
[ADT] [NFC] Add StringRef::detectEOL
This change moves EOL detection out of the clang::InclusionRewriter into
llvm::StringRef so that it can be easily reused elsewhere. It also adds
additional explicit test cases to verify the correct and expected return
results.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D117626
Vy Nguyen [Fri, 21 Jan 2022 15:17:28 +0000 (10:17 -0500)]
[libcxx][doc][nfc] Fixed typo in doc
Nico Weber [Fri, 21 Jan 2022 15:04:41 +0000 (10:04 -0500)]
Try to unbreak build on Windows more after
e9211e03937
serge-sans-paille [Fri, 21 Jan 2022 15:04:19 +0000 (16:04 +0100)]
Add missing llvm/support/Regex.h include in polly/lib/Analysis/ScopDetection.cpp
Nico Weber [Fri, 21 Jan 2022 14:59:22 +0000 (09:59 -0500)]
Try to unbreak build on Windows after
e9211e03937
Benjamin Kramer [Fri, 21 Jan 2022 14:54:33 +0000 (15:54 +0100)]
[clang-tidy] Avoid binding nullptr to a reference
That's undefined behavior. Found by -fsanitize=null.
Kristof Beyls [Wed, 12 Jan 2022 13:40:14 +0000 (14:40 +0100)]
Add security group 2021 transparency report.
Differential Revision: https://reviews.llvm.org/D117872
Caroline Concatto [Mon, 13 Dec 2021 17:20:16 +0000 (17:20 +0000)]
[InstCombine] Fold for masked gather when loading the same value each time.
This patch checks in the masked gather when the first operand value is a
splat and the mask is all one, because the masked gather is reloading the
same value each time. This patch replaces this pattern of masked gather by
a scalar load of the value and splats it in a vector.
Differential Revision: https://reviews.llvm.org/D115726
serge-sans-paille [Thu, 20 Jan 2022 11:04:42 +0000 (12:04 +0100)]
Remove dependency from raw_ostream on <chrono>
The tryLockFor method from raw_fd_sotreamis the sole user of that
header, and it's not referenced in the mono repo. I still chose to keep
it (may be useful for downstream user) but added a transient type that's
forward declared to hold the duration parameter.
Notable changes:
- "llvm/Support/Duration.h" must be included in order to use tryLockFor.
- "llvm/Support/raw_ostream.h" no longer includes <chrono>
This sole change has an interesting impact on the number of processed
line, as measured by:
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 7917500
after: 7835142
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
Kai Nacke [Thu, 20 Jan 2022 19:28:18 +0000 (14:28 -0500)]
[SystemZ] Properly register machine passes.
Registering the passes enables use of -stop-before=/-stop-after
options.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D117823
serge-sans-paille [Fri, 21 Jan 2022 13:59:11 +0000 (14:59 +0100)]
Add apple-specific missing header in Support/GraphWriter.cpp
Jan Svoboda [Wed, 12 Jan 2022 15:09:58 +0000 (16:09 +0100)]
[llvm][ADT] Implement `BitVector::{pop_,}back`
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
Currently, some users of `std::vector<bool>` cannot switch to `llvm::BitVector` because it doesn't implement the `pop_back()` and `back()` functions.
To enable easy transition of `std::vector<bool>` users, this patch implements `llvm::BitVector::pop_back()` and `llvm::BitVector::back()`.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D117115
serge-sans-paille [Fri, 21 Jan 2022 13:28:47 +0000 (14:28 +0100)]
Add ms-specific missing header in Support/InitLLVM.cpp
serge-sans-paille [Fri, 21 Jan 2022 13:18:17 +0000 (14:18 +0100)]
Add apple-specific missing include
Archibald Elliott [Fri, 21 Jan 2022 13:14:58 +0000 (13:14 +0000)]
[NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)
The error messages in tests are far better when a test fails if the test
is written using ASSERT_/EXPECT_<operator>(A, B) rather than
ASSERT_/EXPECT_TRUE(A <operator> B).
This commit updates all of llvm/unittests/Support to use these macros
where possible.
This change has not been possible in:
- llvm/unittests/Support/FSUniqueIDTest.cpp - due to not overloading
operators beyond ==, != and <.
- llvm/unittests/Support/BranchProbabilityTest.cpp - where the unchanged
tests are of the operator overloads themselves.
There are other possibilities of this conversion not being valid, which
have not applied in these tests, as they do not use NULL (they use
nullptr), and they do not use const char* (they use std::string or
StringRef).
Reviewed By: mubashar_
Differential Revision: https://reviews.llvm.org/D117319
serge-sans-paille [Fri, 21 Jan 2022 13:01:51 +0000 (14:01 +0100)]
Add missing header in Support/ConvertUTF.h
serge-sans-paille [Thu, 20 Jan 2022 11:55:14 +0000 (12:55 +0100)]
[llvm] Cleanup header dependencies in ADT and Support
The cleanup was manual, but assisted by "include-what-you-use". It consists in
1. Removing unused forward declaration. No impact expected.
2. Removing unused headers in .cpp files. No impact expected.
3. Removing unused headers in .h files. This removes implicit dependencies and
is generally considered a good thing, but this may break downstream builds.
I've updated llvm, clang, lld, lldb and mlir deps, and included a list of the
modification in the second part of the commit.
4. Replacing header inclusion by forward declaration. This has the same impact
as 3.
Notable changes:
- llvm/Support/TargetParser.h no longer includes llvm/Support/AArch64TargetParser.h nor llvm/Support/ARMTargetParser.h
- llvm/Support/TypeSize.h no longer includes llvm/Support/WithColor.h
- llvm/Support/YAMLTraits.h no longer includes llvm/Support/Regex.h
- llvm/ADT/SmallVector.h no longer includes llvm/Support/MemAlloc.h nor llvm/Support/ErrorHandling.h
You may need to add some of these headers in your compilation units, if needs be.
As an hint to the impact of the cleanup, running
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 8000919 lines
after: 7917500 lines
Reduced dependencies also helps incremental rebuilds and is more ccache
friendly, something not shown by the above metric :-)
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
Simon Pilgrim [Fri, 21 Jan 2022 12:35:36 +0000 (12:35 +0000)]
Revert rG4727d29d908f9dd608dd97a58c0af1ad579fd3ca "[X86] Remove __builtin_ia32_pabs intrinsics and use generic __builtin_elementwise_abs"
Some build bots are referencing the `__builtin_ia32_pabs` intrinsics via alternative headers
Simon Pilgrim [Fri, 21 Jan 2022 12:34:19 +0000 (12:34 +0000)]
Revert rG8ee135dcf8ff060656ad481c3e980fe8763576f5 "[X86] Remove `__builtin_ia32_pmax/min` intrinsics and use generic `__builtin_elementwise_max/min`"
Some build bots are referencing the `__builtin_ia32_pmax/min` intrinsics via alternative headers
Simon Pilgrim [Fri, 21 Jan 2022 12:24:32 +0000 (12:24 +0000)]
[X86] Remove `__builtin_ia32_pmax/min` intrinsics and use generic `__builtin_elementwise_max/min`
D111985 added the generic `__builtin_elementwise_max` and `__builtin_elementwise_min` intrinsics with the same integer behaviour as the SSE/AVX instructions
This patch removes the `__builtin_ia32_pmax/min` intrinsics and just uses `__builtin_elementwise_max/min` - the existing tests see no changes:
```
__m256i test_mm256_max_epu32(__m256i a, __m256i b) {
// CHECK-LABEL: test_mm256_max_epu32
// CHECK: call <8 x i32> @llvm.umax.v8i32(<8 x i32> %{{.*}}, <8 x i32> %{{.*}})
return _mm256_max_epu32(a, b);
}
```
This requires us to add a `__v64qs` explicitly signed char vector type (we already have `__v16qs` and `__v32qs`).
Sibling patch to D117791
Differential Revision: https://reviews.llvm.org/D117798
Valentin Clement [Fri, 21 Jan 2022 12:14:39 +0000 (13:14 +0100)]
[flang] Update tco tool pipline and add translation to LLVM IR
tco is a tool to test the FIR to LLVM IR pipeline of the Flang compiler.
This patch update tco pipelines and adds the translation to LLVM IR.
A simple test is added to make sure the tool is working with a simple
FIR program.
More tests will be upstream in follow up patch from the fir-dev branch.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz, mehdi_amini
Differential Revision: https://reviews.llvm.org/D117781
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Jan Svoboda [Fri, 21 Jan 2022 10:18:22 +0000 (11:18 +0100)]
[clang][deps] Handle symlinks in minimizing FS
The minimizing and caching filesystem used by the dependency scanner can be configured to **not** minimize some files. That's necessary when scanning a TU with prebuilt inputs (i.e. PCH) that refer to the original (non-minimized) files. Minimizing such files in the dependency scanner would cause discrepancy between the current perceived state of the filesystem and the file sizes stored in the AST file. By not minimizing such files, we avoid creating the discrepancy.
The problem with the current approach is that files that should not be minimized are identified by their path. This breaks down when the prebuilt input (PCH) and the current TU refer to the same file via different paths (i.e. symlinks). This patch switches from paths to `llvm::sys::fs::UniqueID` when identifying ignored files. This is consistent with how the rest of Clang treats files.
Depends on D114966.
Reviewed By: dexonsmith, arphaman
Differential Revision: https://reviews.llvm.org/D114971
Jan Svoboda [Fri, 21 Jan 2022 09:55:34 +0000 (10:55 +0100)]
[clang][deps] Ensure filesystem cache consistency
The minimizing filesystem used by the dependency scanner isn't great when it comes to the consistency of its caches. There are two problems that can be exposed by a filesystem that changes during dependency scan:
1. In-memory cache entries for original and minimized files are distinct, populated at different times using separate stat/open syscalls. This means that when a file is read with minimization disabled, its contents might be inconsistent when the same file is read with minimization enabled at later point (and vice versa).
2. In-memory cache entries are indexed by filename. This is problematic for symlinks, where the contents of the symlink might be inconsistent with contents of the original file (for the same reason as in problem 1).
This patch ensures consistency by always stating/reading a file exactly once. The original contents are always cached and minimized contents are derived from that on demand. The cache entries are now indexed by their `UniqueID` ensuring consistency for symlinks too. Moreover, the stat/read syscalls are now issued outside of critical section.
Depends on D115935.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D114966
Jan Svoboda [Fri, 21 Jan 2022 09:54:27 +0000 (10:54 +0100)]
[clang][deps] NFC: Simplify handling of cached FS errors
The return types of some `CachedFileSystemEntry` member function are needlessly complex.
This patch attempts to simplify the code by unwrapping cached entries that represent errors early, and then asserting `!isError()`.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115935
Simon Pilgrim [Fri, 21 Jan 2022 11:55:40 +0000 (11:55 +0000)]
[X86] Remove __builtin_ia32_pabs intrinsics and use generic __builtin_elementwise_abs
D111986 added the generic `__builtin_elementwise_abs()` intrinsic with the same integer absolute behaviour as the SSE/AVX instructions (abs(INT_MIN) == INT_MIN)
This patch removes the `__builtin_ia32_pabs*` intrinsics and just uses `__builtin_elementwise_abs` - the existing tests see no changes:
```
__m256i test_mm256_abs_epi8(__m256i a) {
// CHECK-LABEL: test_mm256_abs_epi8
// CHECK: [[ABS:%.*]] = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %{{.*}}, i1 false)
return _mm256_abs_epi8(a);
}
```
This requires us to add a `__v64qs` explicitly signed char vector type (we already have `__v16qs` and `__v32qs`).
Differential Revision: https://reviews.llvm.org/D117791
Kadir Cetinkaya [Thu, 20 Jan 2022 13:11:15 +0000 (14:11 +0100)]
[clangd] Fail inlayHints requests on content changes
This should improve the overall UX by making the labels less jumpy.
Differential Revision: https://reviews.llvm.org/D117776
Fraser Cormack [Wed, 19 Jan 2022 17:49:33 +0000 (17:49 +0000)]
[RISCV] Enable CGP to sink splat operands of VP intrinsics
This patch brings better splat-matching to our VP support, by sinking
splat operands of VP intrinsics back into the same block as the VP
operation. The list of VP intrinsics we are interested in matches that
of the regular instructions.
Some optimization is still lacking. For instance, our VL nodes aren't
recognized as commutative, so splats must be on the RHS. Because of
this, we limit our sinking of splats to just the RHS operand for now.
Improvement in this regard can come in another patch.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117703
Siddharth Bhat [Fri, 21 Jan 2022 11:32:39 +0000 (17:02 +0530)]
[mlir][LangRef] Add top-level production to the MLIR grammar
The LangRef currently lacks a top-level production, leaving the productions attribute-alias-def and type-alias-defunused. Clarify the situation by declaring what is to be parsed by an MLIR parser at the toplevel.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D117668