Nico Weber [Fri, 9 Jul 2021 15:39:40 +0000 (11:39 -0400)]
Revert "Revert "Temporarily do not drop volatile stores before unreachable""
This reverts commit
52aeacfbf5ce5f949efe0eae029e56db171ea1f7.
There isn't full agreement on a path forward yet, but there is agreement that
this shouldn't land as-is. See discussion on https://reviews.llvm.org/D105338
Also reverts unreviewed "[clang] Improve `-Wnull-dereference` diag to be more in-line with reality"
This reverts commit
f4877c78c0fc98be47b926439bbfe33d5e1d1b6d.
And all the related changes to tests:
This reverts commit
9a0152799f8e4a59e0483728c9f11c8a7805616f.
This reverts commit
3f7c9cc27422f7302cf5a683eeb3978e6cb84270.
This reverts commit
329f8197ef59f9bd23328b52d623ba768b51dbb2.
This reverts commit
aa9f58cc2c48ca6cfc853a2467cd775dc7622746.
This reverts commit
2df37d5ddd38091aafbb7d338660e58836f4ac80.
This reverts commit
a72a44181264fd83e05be958c2712cbd4560aba7.
Nikita Popov [Thu, 8 Jul 2021 18:56:05 +0000 (20:56 +0200)]
[IR] Don't accept nullptr as GEP element type
GetElementPtrInst::Create() (and IRBuilder methods based on it)
currently accept nullptr as the element type, and will fetch the
element type from the pointer in that case. Remove this fallback,
as it is incompatible with opaque pointers. I've removed a handful
of leftover calls using this behavior as a preliminary step.
Out-of-tree code affected by this change should either pass a proper
type, or can temporarily explicitly call getPointerElementType(),
if the newly added assertion is encountered.
Differential Revision: https://reviews.llvm.org/D105653
Kevin P. Neal [Thu, 8 Jul 2021 19:12:11 +0000 (15:12 -0400)]
[FPEnv][InstSimplify] Constrained FP support for NaN
Currently InstructionSimplify.cpp knows how to simplify floating point
instructions that have a NaN operand. It does not know how to handle the
matching constrained FP intrinsic.
This patch teaches it how to simplify so long as the exception handling
is not "fpexcept.strict".
Differential Revision: https://reviews.llvm.org/D103169
zhijian [Fri, 9 Jul 2021 15:06:46 +0000 (11:06 -0400)]
[AIX][XCOFF] Use bit order of has_vec and longtbtable bits as defined in AIX header debug.h
Summary:
The bit order of the has_vec and longtbtable bits in the traceback table generated by the XL compiler flipped at some point after v12.1. This is different from the definition is the AIX header debug.h. The change in the XL compiler that caused the deviation from the OS header definition was unintentional. Since both orderings are extant and the XL compiler runtime also expects the ordering defined by the OS, we will correct the output from LLVM to match the defined ordering given by the OS (which is also consistent with the Assembler Language Reference). Mitigation for traceback tables encoded with the wrong ordering is required for either ordering.
Reviewers: XingXue, HubertTong
Differential Revision: https://reviews.llvm.org/D105487
Jeremy Morse [Fri, 9 Jul 2021 14:32:30 +0000 (15:32 +0100)]
[Debug-info][InstrRef] Avoid an unnecessary map ordering
We keep a record of substitutions between debug value numbers post-isel,
however we never actually look them up until the end of compilation. As a
result, there's nothing gained by the collection being a std::map. This
patch downgrades it to being a vector, that's then sorted at the end of
compilation in LiveDebugValues.
Differential Revision: https://reviews.llvm.org/D105029
Louis Dionne [Thu, 8 Jul 2021 16:26:33 +0000 (12:26 -0400)]
[libc++][ci] Test Clang ToT by default, and add jobs on Clang 11 and 12
It makes the most sense to test with Clang ToT by default since that's
exactly what we're trying to QA: that libc++ works with whatever compiler
we're going to release next.
Roman Lebedev [Fri, 9 Jul 2021 13:25:08 +0000 (16:25 +0300)]
Revert "Transform memset + malloc --> calloc (PR25892)"
It broke `check-msan`, see e.g. https://lab.llvm.org/buildbot/#/builders/18/builds/1934
This reverts commit
375694a07bcba3be66864c42a5932be1a22831e2.
Alex Zinenko [Thu, 8 Jul 2021 16:35:18 +0000 (18:35 +0200)]
[mlir] factor memref-to-llvm lowering out of std-to-llvm
After the MemRef has been split out of the Standard dialect, the
conversion to the LLVM dialect remained as a huge monolithic pass.
This is undesirable for the same complexity management reasons as having
a huge Standard dialect itself, and is even more confusing given the
existence of a separate dialect. Extract the conversion of the MemRef
dialect operations to LLVM into a separate library and a separate
conversion pass.
Reviewed By: herhut, silvas
Differential Revision: https://reviews.llvm.org/D105625
Roman Lebedev [Fri, 9 Jul 2021 11:56:18 +0000 (14:56 +0300)]
[compiler-rt] fuzzer: adjust tests to not expect that store to null traps and is not erase
Instead, mostly just trap directly.
Roman Lebedev [Fri, 9 Jul 2021 11:39:29 +0000 (14:39 +0300)]
[compiler-rt] Conceal UB in sanitizer_common/TestCases/Linux/signal_line.cpp test
Store to null is deleted, so the test no longer did what it was expecting to do.
Conceal that by creating null pointer in a more elaborate way,
thus retaining original test coverage.
Martin Storsjö [Sat, 1 Aug 2020 06:44:24 +0000 (09:44 +0300)]
[llvm-rc] Make commas in user data structs optional
This matches what rc.exe tolerates in this type.
This fixes cases like this:
1 24
BEGIN
"<?xml version=""1.0""?>\n"
"<assembly>\n"
"</assembly>\n"
END
Differential Revision: https://reviews.llvm.org/D105621
Martin Storsjö [Fri, 9 Jul 2021 11:02:51 +0000 (14:02 +0300)]
Revert "[ScalarEvolution] Fix overflow in computeBECount."
This reverts commit
5b350183cdabd83573bc760ddf513f3e1d991bcb (and
also "[NFC][ScalarEvolution] Cleanup howManyLessThans.",
009436e9c1fee1290d62bc0faafe0c0295542f56, to make it apply).
See https://reviews.llvm.org/D105216 for discussion on various
miscompilations caused by that commit.
Roman Lebedev [Fri, 9 Jul 2021 10:36:21 +0000 (13:36 +0300)]
Revert "Temporarily do not drop volatile stores before unreachable"
This reverts commit
4e413e16216d0c94ada2171f3c59e0a85f4fa4b6,
which landed almost 10 months ago under premise that the original behavior
didn't match reality and was breaking users, even though it was correct as per
the LangRef. But the LangRef change still hasn't appeared, which might suggest
that the affected parties aren't really worried about this problem.
Please refer to discussion in:
* https://reviews.llvm.org/D87399 (`Revert "[InstCombine] erase instructions leading up to unreachable"`)
* https://reviews.llvm.org/D53184 (`[LangRef] Clarify semantics of volatile operations.`)
* https://reviews.llvm.org/D87149 (`[InstCombine] erase instructions leading up to unreachable`)
clang has `-Wnull-dereference` which will diagnose the obvious cases
of null dereference, it was adjusted in
f4877c78c0fc98be47b926439bbfe33d5e1d1b6d,
but it will only catch the cases where the pointer is a null literal,
it will not catch the cases where an arbitrary store is expected to trap.
Differential Revision: https://reviews.llvm.org/D105338
Roman Lebedev [Fri, 9 Jul 2021 11:13:34 +0000 (14:13 +0300)]
[NFC][Clang][CodegenOpenCL] Fix test not to rely on volatile store not being removed
Simon Pilgrim [Fri, 9 Jul 2021 11:04:09 +0000 (12:04 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Fri, 9 Jul 2021 10:48:25 +0000 (11:48 +0100)]
[X86] ReplaceNodeResults - fp_to_sint/uint - manually widen v2i32 results to let us add AssertSext/AssertZext
Its proving tricky to move this to the generic legalizer code, so manually insert the v2i32 subvector into v4i32, insert the AssertSext/AssertZext node, then extract the subvector again.
This avoids masks in the truncation/pack code, which means we avoid a PSHUFB in the fp_to_sint/uint code for sub-128 bit types (specific targets can still combine the packs to a pshufb if they have fast variable per-lane shuffles).
This was noticed when I was trying to improve fp_to_sint/uint costs with D103695 (and some targets had very high fp_to_sint costs due to the PSHUFB), so we can then update the fp_to_uint codegen from D89697.
Max Kazantsev [Fri, 9 Jul 2021 10:40:42 +0000 (17:40 +0700)]
[LoopDeletion] Handle switch in proving that loop exits on first iteration
Added check for switch-terminated blocks in loops.
Now if a block is terminated with a switch, we try to find out which of the
cases is taken on 1st iteration and mark corresponding edge from the block
to the case successor as live.
Patch by Dmitry Makogon!
Differential Revision: https://reviews.llvm.org/D105688
Reviewed By: nikic, mkazantsev
David Green [Fri, 9 Jul 2021 10:51:16 +0000 (11:51 +0100)]
[TTI] Remove IsPairwiseForm from getArithmeticReductionCost
This patch removes the IsPairwiseForm flag from the Reduction Cost TTI
hooks, along with some accompanying code for pattern matching reductions
from trees starting at extract elements. IsPairWise is now assumed to be
false, which was the predominant way that the value was used from both
the Loop and SLP vectorizers. Since the adjustments such as D93860, the
SLP vectorizer has not relied upon this distinction between paiwise and
non-pairwise reductions.
This also removes some code that was detecting reductions trees starting
from extract elements inside the costmodel. This case was
double-counting costs though, adding the individual costs on the
individual instruction _and_ the total cost of the reduction. Removing
it changes the costs in llvm/test/Analysis/CostModel/X86/reduction.ll to
not double count. The cost of reduction intrinsics is still tested
through the various tests in
llvm/test/Analysis/CostModel/X86/reduce-xyz.ll.
Differential Revision: https://reviews.llvm.org/D105484
Roman Lebedev [Fri, 9 Jul 2021 10:30:17 +0000 (13:30 +0300)]
Speculatively adjust gtest's UnitTest::AddTestPartResult() to not rely on volatile store to null trapping
This fallback path is used at least on PPC.
If this doesn't work on some compilers that take this path,
then this will have to be changed to either abort,
or partitioned to do different things based on the compiler.
Please refer to https://reviews.llvm.org/D105338.
Roman Lebedev [Fri, 9 Jul 2021 10:14:15 +0000 (13:14 +0300)]
[NFC][Codegen] Harden a few tests to not rely that volatile store to null isn't erased
patacca [Fri, 9 Jul 2021 10:24:35 +0000 (12:24 +0200)]
[Polly][Isl] Update isl to isl-0.24-52-gd7be01f7
This is needed because the functions `isl_union_{set,map}_get_{set,map}_list` have been exposed to the C++ interface
Bjorn Pettersson [Fri, 9 Jul 2021 10:23:51 +0000 (12:23 +0200)]
[NewPM][FuzzMutate] Fix renaming 'unswitch' to 'simple-loop-unswitch'
This is a follow up to D105628 (commit
1db2551cc1a356a67c096). I had
missed to replace 'unswitch' by 'simple-loop-unswitch' in one place.
Roman Lebedev [Fri, 9 Jul 2021 10:11:16 +0000 (13:11 +0300)]
[compiler-rt][ASAN] Speculatively fix Windows/dll_control_c.cpp test - use trap
Please refer to https://reviews.llvm.org/D105338,
such store will not trap, it will be removed.
Haojian Wu [Wed, 7 Jul 2021 06:38:34 +0000 (08:38 +0200)]
[clang] Fix an infinite loop during typo-correction
See https://bugs.llvm.org/show_bug.cgi?id=50797#c6
Differential Revision: https://reviews.llvm.org/D105533
Roman Lebedev [Fri, 9 Jul 2021 09:01:08 +0000 (12:01 +0300)]
[clang] Improve `-Wnull-dereference` diag to be more in-line with reality
* Drop any mention of `volatile`.
Please refer to https://reviews.llvm.org/D105338
* Drop address space check - it really doesn't affect the behavior,
the store will still be dropped: https://godbolt.org/z/dP8fevxG4
Whisperity [Fri, 9 Jul 2021 09:37:38 +0000 (11:37 +0200)]
[NFC][llvm][docs] YamlIO: StringRef validate -> std::string validate
A change in the API happened as per http://reviews.llvm.org/D89463
(latest related commit
b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b)
but the RST documentation was not updated to match this at that time.
Alex Richardson [Fri, 9 Jul 2021 09:15:16 +0000 (10:15 +0100)]
[ELF][AArch64] Write addends for TLSDESC relocations with -z rel
Since D100490 this case is diagnosed for -z rel. This commit implements
R_AARCH64_TLSDESC cases for AArch64::getImplicitAddend() and
AArch64::relocate(). However, there are probably further relocation types
that need to be handled for full support of -z rel.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47009
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D100544
Alex Richardson [Fri, 9 Jul 2021 09:12:43 +0000 (10:12 +0100)]
[ELF] Implement RISCV::getImplicitAddend()
This allows checking dynamic relocation addends for -z rel and
--apply-dynamic-relocs output.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101455
Alex Richardson [Fri, 9 Jul 2021 09:12:21 +0000 (10:12 +0100)]
[ELF] Write R_RISCV_IRELATIVE addends with -z rel
I found this missing case with the new --check-dynamic-relocation flag
while running the lld tests with --apply-dynamic-relocs enabled by default.
This is the same as D101452 just for RISC-V
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101454
Alex Richardson [Fri, 9 Jul 2021 09:11:31 +0000 (10:11 +0100)]
[ELF] Write R_X86_64_IRELATIVE addends with -z rel
I found this missing case with the new --check-dynamic-relocation flag
while running the lld tests with --apply-dynamic-relocs enabled by default.
This also fixes a broken CHECK in lld/test/ELF/x86-64-gotpc-relax.s:
The test wasn't using CHECK-NEXT, so it was passing despite the output
actually containing relocations. I am not sure when this changed, but I
think this behaviour is correct.
Found with D101450 + enabling --apply-dynamic-relocs by default.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101452
Alex Richardson [Fri, 9 Jul 2021 09:10:33 +0000 (10:10 +0100)]
[ELF] Implement X86_64::getImplicitAddend()
This allows checking dynamic relocation addends for -z rel and
--apply-dynamic-relocs output.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101451
Alex Richardson [Fri, 9 Jul 2021 09:05:18 +0000 (10:05 +0100)]
[ELF] Check the Elf_Rel addends for dynamic relocations
There used to be many cases where addends for Elf_Rel were not emitted in
the final object file (mostly when building for MIPS64 since the input .o
files use RELA but the output uses REL). These cases have been fixed since,
but this patch adds a check to ensure that the written values are correct.
It is based on a previous patch that I added to the CHERI fork of LLD since
we were using MIPS64 as a baseline. The work has now almost entirely
shifted to RISC-V and Arm Morello (which use Elf_Rela), but I thought
it would be useful to upstream our local changes anyway.
This patch adds a (hidden) command line flag --check-dynamic-relocations
that can be used to enable these checks. It is also on by default in
assertions builds for targets that handle all dynamic relocations kinds
that LLD can emit in Target::getImplicitAddend(). Currently this is
enabled for ARM, MIPS, and I386.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D101450
Alex Richardson [Fri, 9 Jul 2021 09:04:35 +0000 (10:04 +0100)]
[ELF] Refactor DynamicReloc to fix incorrect relocation addends
This patch changes the DynamicReloc class to store an enum instead
of the overloaded useSymVA member to make it easier to understand
and fix incorrect addends being written in some corner cases. The
change is motivated by a follow-up review that checks the value of
implicit Elf_Rel addends written to the output file.
This patch fixes an incorrect output when using `-z rela` for i386 files
with R_386_GOT32 relocations (not that this really matters since it's an
unsupported configuration).
Storing the relocation expression kind also addresses an incorrect addend
FIXME in ppc64-abs64-dyn.s introduced in D63383.
DynamicReloc now also has a special case for the MIPS TLS relocations
(DynamicReloc::AgainstSymbolWithTargetVA) since the
R_MIPS_TLS_TPREL{32/64} the symbol VA to the GOT for preemptible
symbols. I'm not sure if the symbol value actually should be written
for R_MIPS_TLS_TPREL32, but this patch does not attempt to change
that behaviour.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D100490
Tim Northover [Fri, 9 Jul 2021 08:51:57 +0000 (09:51 +0100)]
[Support] reorder Threading includes to avoid conflict with FreeBSD headers
FreeBSD's condvar.h (included by user.h in Threading.inc) uses a "struct
thread" that conflicts with llvm::thread if both are visible when it's
included.
So this moves our #include after the FreeBSD code.
Dawid Jurczak [Mon, 5 Jul 2021 09:42:17 +0000 (11:42 +0200)]
Transform memset + malloc --> calloc (PR25892)
After this change DSE can eliminate malloc + memset and emit calloc.
It's https://reviews.llvm.org/D101440 follow-up.
Differential Revision: https://reviews.llvm.org/D103009
Bjorn Pettersson [Thu, 8 Jul 2021 12:12:19 +0000 (14:12 +0200)]
[NewPM] Rename 'unswitch' to 'simple-loop-unswitch' in PassRegistry
It is confusing to have two ways of specifying the same pass
('simple-loop-unswitch' and 'unswitch'). This patch replaces
'unswitch' by 'simple-loop-unswitch' to get a unique identifier.
Using 'simple-loop-unswitch' instead of 'unswitch' also has the
advantage of matching how the pass is named in DEBUG_TYPE etc. So
this makes it a bit more consistent how we refer to the pass in
options such as -passes, -print-after and -debug-only.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D105628
Bjorn Pettersson [Thu, 8 Jul 2021 12:24:03 +0000 (14:24 +0200)]
[NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'
There was an alias between 'simplifycfg' and 'simplify-cfg' in the
PassRegistry. That was the original reason for this patch, which
effectively removes the alias.
This patch also replaces all occurrances of 'simplify-cfg'
by 'simplifycfg'. Reason for choosing that form for the name is
that it matches the DEBUG_TYPE for the pass, and the legacy PM name
and also how it is spelled out in other passes such as
'loop-simplifycfg', and in other options such as
'simplifycfg-merge-cond-stores'.
I for some reason the name should be changed to 'simplify-cfg' in
the future, then I think such a renaming should be more widely done
and not only impacting the PassRegistry.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D105627
Bjorn Pettersson [Sun, 27 Jun 2021 22:22:11 +0000 (00:22 +0200)]
[NewPM] Handle passes with params in -print-before/-print-after
To support options like -print-before=<pass> and -print-after=<pass>
the PassBuilder will register PassInstrumentation callbacks as well
as a mapping between internal pass class names and the pass names
used in those options (and other cmd line interfaces). But for
some reason all the passes that takes options where missing in those
maps, so for example "-print-after=loop-vectorize" didn't work.
This patch will add the missing entries by also taking care of
function and loop passes with params when setting up the class to
pass name maps.
One might notice that even with this patch it might be tricky to
know what pass name to use in options such as -print-after. This
because there only is a single mapping from class name to pass name,
while the PassRegistry currently is a bit messy as it sometimes
reuses the same class for different pass names (without using the
"pass with params" scheme, or the pass-name<variant> syntax).
It gets extra messy in some situations. For example the
MemorySanitizerPass can run like this (with debug and print-after)
opt -passes='kmsan' -print-after=msan-module -debug-only=msan
The 'kmsan' alias for 'msan<kernel>' is just confusing as one might
think that 'kmsan' is a separate pass (but the DEBUG_TYPE is still
just 'msan'). And since the module pass version of the pass adds
a mapping from 'MemorySanitizerPass' to 'msan-module' one need to
use 'msan-module' in the print-before and print-after options.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D105006
jacquesguan [Fri, 9 Jul 2021 05:15:45 +0000 (13:15 +0800)]
[RISCV][clang] Add macro __riscv_zvlsseg for RVV Zvlsseg builtins
Add extension macro __riscv_zvlsseg to enable Zvlsseg builtins only
with target feature Zvlsseg.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D105626
Haruki Imai [Fri, 9 Jul 2021 05:09:21 +0000 (22:09 -0700)]
[CMake] Disable -fno-semantic-interposition for GCC<10.3 on SystemZ
`-fno-semantic-interposition` was added for GCC in D102453, but some MLIR tests
on SystemZ failed with GCC<10.3 due to a bug.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D105453
Kai Luo [Fri, 9 Jul 2021 04:42:27 +0000 (04:42 +0000)]
[PowerPC] Remove implicit use register after transformToImmFormFedByLI()
When the instruction has imm form and fed by LI, we can remove the redundat LI instruction.
Below is an example:
```
renamable $x5 = LI8 2
renamable $x4 = exact SRD killed renamable $x4, killed renamable $r5, implicit $x5
```
will be converted to:
```
renamable $x5 = LI8 2
renamable $x4 = exact RLDICL killed renamable $x4, 62, 2, implicit killed $x5
```
But when we do this optimization, we forget to remove implicit killed $x5
This bug has caused a lnt case error. This patch is to fix above bug.
Reviewed By: #powerpc, shchenz
Differential Revision: https://reviews.llvm.org/D85288
Eric Christopher [Fri, 9 Jul 2021 04:36:44 +0000 (21:36 -0700)]
Update Bazel overlay in GPUToGPURuntimeTransforms.
Muhammad Omair Javaid [Fri, 9 Jul 2021 03:11:08 +0000 (08:11 +0500)]
Revert "GlobalISel/AArch64: don't optimize away redundant branches at -O0"
This reverts commit
458c230b5ef893238d2471fcff27cd275e8026d5.
This broke LLDB buildbot testcase where breakpoint set at start of loop
failed to hit. https://lab.llvm.org/buildbot/#/builders/96/builds/9404
https://github.com/llvm/llvm-project/blob/main/lldb/test/API/commands/process/attach/main.cpp#L15
Differential Revision: https://reviews.llvm.org/D105238
Reshabh Sharma [Fri, 9 Jul 2021 02:18:03 +0000 (07:48 +0530)]
[ASan][AMDGPU] Make shadow offset match X86 on Linux
This patch explicitly sets the shadow offset for
AMDGPU to match that of X86 on Linux.
Reviewed By: vitalybuka
https://reviews.llvm.org/D105282
Ben Shi [Fri, 9 Jul 2021 01:48:23 +0000 (09:48 +0800)]
[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD
This patch will show the following optimization by future patches.
(mul x imm) -> (SH1ADD x, (SLLI x, bits)) when imm = 2^n + 2.
(mul x imm) -> (SH2ADD x, (SLLI x, bits)) when imm = 2^n + 4.
(mul x imm) -> (SH3ADD x, (SLLI x, bits)) when imm = 2^n + 8.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D105614
Mehdi Amini [Fri, 9 Jul 2021 01:43:19 +0000 (01:43 +0000)]
Revert "[mlir][sparse] Add Merger unit tests"
This reverts commit
0d0cff3ace39378acfc66d6564dc99e19b8a561f.
The build is broken with GCC 5.4
Eli Friedman [Fri, 9 Jul 2021 00:49:02 +0000 (17:49 -0700)]
[NFC][ScalarEvolution] Cleanup howManyLessThans.
In preparation for D104075. Some NFC cleanup, and some test coverage for
planned changes.
Chia-hung Duan [Fri, 9 Jul 2021 00:00:36 +0000 (08:00 +0800)]
[mlir-reduce] Fix the grammer in the doc
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D105623
Kevin Athey [Thu, 8 Jul 2021 23:39:58 +0000 (16:39 -0700)]
Add documentation for -fsanitize-address-use-after-return.
for issue: https://github.com/google/sanitizers/issues/1394
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D104155
Yuanfang Chen [Thu, 8 Jul 2021 19:20:57 +0000 (12:20 -0700)]
Add AddDiscriminatorsPass to NPM default O0 pipeline
AddDiscriminatorsPass is in Legacy PM's O0 pipeline. This patch did the same
for NPM O0 pipeline.
Reviewed By: aeubanks, MaskRay
Differential Revision: https://reviews.llvm.org/D105650
Gus Smith [Thu, 8 Jul 2021 22:43:59 +0000 (22:43 +0000)]
[mlir][sparse] Add Merger unit tests
We opt to use unit tests rather than check tests as the lattice/merger code is a small C++ component with a well-defined API. Testing this API via check tests would be far less direct and readable. In addition, as the check tests will only be able to test the API indirectly, the tests may break based on unrelated changes; e.g. changes in linalg.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D104956
Stanislav Mekhanoshin [Thu, 8 Jul 2021 22:15:47 +0000 (15:15 -0700)]
[AMDGPU] Mark more SOP instructions as rematerializable
The rest of the SOP instructions implicitly set SCC and not
suitable for the rematerialization.
Differential Revision: https://reviews.llvm.org/D105670
Craig Topper [Thu, 8 Jul 2021 21:59:54 +0000 (14:59 -0700)]
[ARM] Pass 2 instead of 0 to PHINode::Create in MVEGatherScatterLowering. NFC
This parameter controls how much space is reserved for incoming
values. There are always going to be 2 incoming values in this case.
While there remove the unused std::vector right below.
Found while looking at porting this code to RISCV.
Yi Zhang [Thu, 8 Jul 2021 20:43:04 +0000 (13:43 -0700)]
Mark TensorDialect legal and PadTensor op illegal
`GeneralizePadTensorOpPattern` might generate `tensor.dim` op so the
TensorDialect should be marked legal. This pattern should also
transform all `linalg.pad_tensor` ops so mark those as illegal. Those
changes are missed from a previous change in
https://reviews.llvm.org/D105293
Reviewed By: silvas
Differential Revision: https://reviews.llvm.org/D105642
Thomas Lively [Thu, 8 Jul 2021 21:31:53 +0000 (14:31 -0700)]
[WebAssembly] Scalarize extract_vector_elt of binops
Override the `shouldScalarizeBinop` target lowering hook using the same
implementation used in the x86 backend. This causes `extract_vector_elt`s of
vector binary ops to be scalarized if the scalarized version would be supported.
Differential Revision: https://reviews.llvm.org/D105646
David Green [Thu, 8 Jul 2021 21:27:23 +0000 (22:27 +0100)]
[ARM] Extra v8i16 -> i64 reduction tests with loads. NFC
Alexey Bataev [Thu, 8 Jul 2021 20:45:03 +0000 (13:45 -0700)]
[InstCombine][NFC]Use only `replaceInstUsesWith`, NFC.
Rob Suderman [Thu, 8 Jul 2021 20:25:46 +0000 (13:25 -0700)]
[mlir][bazel] Added missing MathDialect dep to LinalgOps target
LinalgOps needs MathDialect as a dependency for it to build correctly.
Differential Revision: https://reviews.llvm.org/D105656
David Blaikie [Thu, 8 Jul 2021 20:46:36 +0000 (13:46 -0700)]
Revert "PR51018: Disallow explicit construction of StringRef from SmallString due to ambiguity in C++23"
This reverts commit
e2d30846327c7ec5cc9d2a46aa9bcd9c2c4eff93.
MSVC doesn't seem to resolve the intended ambiguity in implicit
conversion contexts correctly: https://godbolt.org/z/ee16aqv4v
David Blaikie [Thu, 8 Jul 2021 20:26:40 +0000 (13:26 -0700)]
PR51018: Disallow explicit construction of StringRef from SmallString due to ambiguity in C++23
See bug for full details, but basically there's an upcoming ambiguity in
the conversion in `StringRef(SomeSmallString)` - either the implicit
conversion operator (SmallString::operator StringRef) could be used, or
the std::string_view range-based ctor (& then `StringRef(std::string_view)`
would be used)
To address this, make such a conversion invalid up-front - most uses are
more tersely written as `SomeSmallString.str()` anyway, or more clearly
written as `StringRef x = y;` rather than `StringRef x(y);` - so if you
hit this in out-of-tree code, please update in one of those ways.
Hopefully I've fixed everything in tree prior to this patch landing.
David Blaikie [Thu, 8 Jul 2021 20:30:14 +0000 (13:30 -0700)]
PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23
C++23 will make these conversions ambiguous - so fix them to make the
codebase forward-compatible with C++23 (& a follow-up change I've made
will make this ambiguous/invalid even in <C++23 so we don't regress
this & it generally improves the code anyway)
Leonard Chan [Thu, 8 Jul 2021 20:19:17 +0000 (13:19 -0700)]
[NFC][compiler-rt][fuchsia] Add InitShadowBounds declaration to header
Forgot to include this as a part of
a11aea68a4b31e72bc0b84bde5f3210048287d28.
Mitch Phillips [Thu, 8 Jul 2021 20:06:34 +0000 (13:06 -0700)]
[GWP-ASan] Change unreachable -> trap to work around DCE bug.
trapOnAddress is designed to SEGV on a specific address. Unfortunately,
with an IR change, __builtin_unreachable() ends up doing DCE on things
that have side effects, like the load that causes the trap.
Change to __builtin_trap() to avoid the optimisation.
Root cause is still an LLVM bug, and tracked in
https://bugs.llvm.org/show_bug.cgi?id=47480.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D105654
Vitaly Buka [Sat, 3 Jul 2021 02:13:03 +0000 (19:13 -0700)]
[msan] Handle funnel shifts
Fixes https://bugs.llvm.org/show_bug.cgi?id=50840
Differential Revision: https://reviews.llvm.org/D105387
Vitaly Buka [Sat, 3 Jul 2021 01:19:23 +0000 (18:19 -0700)]
[msan] Add funel shift tests
For https://bugs.llvm.org/show_bug.cgi?id=50840
Alexey Bataev [Fri, 11 Jun 2021 13:02:47 +0000 (06:02 -0700)]
[SLP]Improve vectorization of stores.
Patch tries to improve the vectorization of stores. Originally, we just
check the type and the base pointer of the store.
Patch adds some extra checks to avoid non-profitable vectorization
cases. It includes analysis of the scalar values to be stored and
triggers the vectorization attempt only if the scalar values have
same/alt opcode and are from same basic block, i.e. we don't end up
immediately with the gather node, which is not profitable.
This also improves compile time by filtering out non-profitable cases.
Part of D57059.
Differential Revision: https://reviews.llvm.org/D104122
Nikita Popov [Thu, 8 Jul 2021 19:20:17 +0000 (21:20 +0200)]
[CodeGen] Avoid nullptr arg to CreateStructGEP (NFC)
For now just make the getPointerElementType() explicit.
Nikita Popov [Thu, 8 Jul 2021 19:13:52 +0000 (21:13 +0200)]
[AMDGPU] Simplify GEP construction (NFC)
Noticed while making a related change. This code was doing
something really peculiar: Creating an APInt by parsing a string.
And then creating a SmallVector with one element to create the
GEP.
Instead create the APInt from integers and directly pass the single
index to GetElementPtrInst::Create().
Nikita Popov [Thu, 8 Jul 2021 19:10:03 +0000 (21:10 +0200)]
[AMDGPU] Pass explicit GEP type in printf transform (NFC)
This code is working on an i8*. Avoid nullptr element type in
preparation for removing support.
Nikita Popov [Thu, 8 Jul 2021 18:59:56 +0000 (20:59 +0200)]
[NVPTX] Pass explicit GEP type (NFC)
Use source element type of original GEP, as we're just changing
the address space.
Alexey Bataev [Thu, 8 Jul 2021 17:58:10 +0000 (10:58 -0700)]
[OPENMP]Do no privatize const firstprivates in target regions.
No need to emit private copyfor firstprivate constants in target
regions, we can use the original copy instead.
Differential Revision: https://reviews.llvm.org/D105647
Alexey Bataev [Mon, 28 Jun 2021 15:56:08 +0000 (08:56 -0700)]
[SLP][COST][X86]Improve cost model for masked gather.
Revived D101297 in its original form + added some changes in X86
legalization cehcking for masked gathers.
This solution is the most stable and the most correct one. We have to
check the legality before trying to build the masked gather in SLP.
Without this check we have incorrect cost (for SLP) in case if the masked gather
is not legal/slower than the gather. And we're missing some
vectorization opportunities.
This can be fixed in the cost model, but in this case we need to add
special checks for the cost of GEPs for ScatterVectorize node, add
special check for small trees, etc., i.e. there are a lot of corner
cases here and there, which insrease code base and make it harder to
maintain the code.
> Can't we rely on cost model to deal with this? This can be profitable for futher vectorization, when we can start from such gather loads as seed.
The question from D101297. Actually, no, it can't. Actually, simple
gather may give us better result, especially after we started
vectorization of insertelements. Plus, like I said before, the cost for
non-legal masked gathers leads to missed vectorization opportunities.
Differential Revision: https://reviews.llvm.org/D105042
Craig Topper [Thu, 8 Jul 2021 18:42:53 +0000 (11:42 -0700)]
[ARM] Use matchSimpleRecurrence to simplify some code in MVEGatherScatterLowering. NFCI
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D105262
Louis Dionne [Thu, 8 Jul 2021 18:39:15 +0000 (14:39 -0400)]
[libc++] Add XFAIL for Clang ToT with modules
This is what I should have done instead of
6afd6e96ce20.
Nikita Popov [Thu, 8 Jul 2021 18:33:37 +0000 (20:33 +0200)]
[CodeGen] Avoid CreateGEP with nullptr type (NFC)
In preparation for dropping support for it. I've replaced it with
a proper type where the correct type was obvious and left an
explicit getPointerElementType() where it wasn't.
Alexey Bataev [Thu, 8 Jul 2021 18:29:40 +0000 (11:29 -0700)]
[X86][NFC]Add run lines for AVX512VL for masked gather test, NFC.
Matheus Izvekov [Mon, 5 Jul 2021 22:24:43 +0000 (00:24 +0200)]
[clang] fix constexpr code generation for user conversions.
When building the member call to a user conversion function during an
implicit cast, the expression was not being checked for immediate
invocation, so we were never adding the ConstantExpr node to AST.
This would cause the call to the user conversion operator to be emitted
even if it was constantexpr evaluated, and this would even trip an
assert when said user conversion was declared consteval:
`Assertion failed: !cast<FunctionDecl>(GD.getDecl())->isConsteval() && "consteval function should never be emitted", file clang\lib\CodeGen\CodeGenModule.cpp, line 3530`
Fixes PR48855.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D105446
Stanislav Mekhanoshin [Thu, 8 Jul 2021 18:13:43 +0000 (11:13 -0700)]
[AMDGPU] Fix more indention in llc-pipeline test. NFC.
Louis Dionne [Thu, 8 Jul 2021 16:19:53 +0000 (12:19 -0400)]
[libc++][ci] Install Clang 11, Clang 12 and Clang ToT in the Docker image
The compiler support policy mentions that we support Clang 11 and 12, so
we should test those. We already test on Clang 12, but I'll add testers
for Clang 11 once the new Docker image is in use on all the builders.
Nicolas Vasilache [Thu, 8 Jul 2021 14:26:57 +0000 (14:26 +0000)]
[mlir][Linalg] Fix tensor.extract_slice(linalg.init_tensor) canonicalization for rank-reducing extract
Differential Revision: https://reviews.llvm.org/D105636
Michael Liao [Thu, 8 Jul 2021 18:05:54 +0000 (14:05 -0400)]
[Metadata] Decorate methods with 'const'. NFC.
- Minor coding style fix.
Stanislav Mekhanoshin [Thu, 8 Jul 2021 18:08:25 +0000 (11:08 -0700)]
[AMDGPU] Fix indention in llc-pipeline test. NFC.
Matt Arsenault [Thu, 8 Jul 2021 15:32:57 +0000 (11:32 -0400)]
Mips/GlobalISel: Remove custom splitToValueTypes
Matt Arsenault [Thu, 8 Jul 2021 15:26:30 +0000 (11:26 -0400)]
GlobalISel: Track original argument index in ArgInfo
SelectionDAG's equivalents in ISD::InputArg/OutputArg track the
original argument index. Mips relies on this, and its currently
reinventing its own parallel CallLowering infrastructure which tracks
these indexes on the side. Add this to help move towards deleting the
custom mips handling.
Matt Arsenault [Wed, 7 Jul 2021 22:28:57 +0000 (18:28 -0400)]
Mips/GlobalISel: Use correct callee calling convention
This was using the convention from the calling function.
Fangrui Song [Thu, 8 Jul 2021 17:29:43 +0000 (10:29 -0700)]
[LangRef] Fix typo about SHF_LINK_ORDER
Leonard Chan [Wed, 9 Jun 2021 19:38:08 +0000 (12:38 -0700)]
[compiler-rt][hwasan] Define fuchsia implementations of required hwasan functions
This contains all the definitions required by hwasan for the fuchsia
implementation and can be landed independently from the remaining parts of D91466.
Differential Revision: https://reviews.llvm.org/D103936
Eli Friedman [Tue, 29 Jun 2021 22:22:13 +0000 (15:22 -0700)]
[ScalarEvolution] Fix overflow in computeBECount.
There are two issues with the current implementation of computeBECount:
1. It doesn't account for the possibility that adding "Stride - 1" to
Delta might overflow. For almost all loops, it doesn't, but it's not
actually proven anywhere.
2. It doesn't account for the possibility that Stride is zero. If Delta
is zero, the backedge is never taken; the value of Stride isn't
relevant. To handle this, we have to make sure that the expression
returned by computeBECount evaluates to zero.
To deal with this, add two new checks:
1. Use a variety of tricks to try to prove that the addition doesn't
overflow. If the proof is impossible, use an alternate sequence which
never overflows.
2. Use umax(Stride, 1) to handle the possibility that Stride is zero.
Differential Revision: https://reviews.llvm.org/D105216
Simon Pilgrim [Thu, 8 Jul 2021 16:51:32 +0000 (17:51 +0100)]
Fix MSVC "truncation from 'int' to 'bool'" warning. NFCI.
Simon Pilgrim [Thu, 8 Jul 2021 16:21:08 +0000 (17:21 +0100)]
[CostModel][X86] Account for older SSE targets with slow fp->int conversions
Both the conversion cost and the xmm->gpr transfer cost tend to be a lot higher on early SSE targets
Fangrui Song [Thu, 8 Jul 2021 17:07:10 +0000 (10:07 -0700)]
[LangRef] Clarify !associated
Notably, a global variable with the metadata should generally not be referenced
by a function function. E.g. -fstack-size-section usage is fine, but
-fsanitize-coverage= used to have a linker GC problem (fixed by D97430).
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D104933
Aart Bik [Wed, 7 Jul 2021 23:09:22 +0000 (16:09 -0700)]
[mlir][sparse] updated setter/getter comments
For the getters, it is bad practice to keep the reference
around for too long, as explained in the new comment
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105599
Stanislav Mekhanoshin [Wed, 7 Jul 2021 19:28:30 +0000 (12:28 -0700)]
[AMDGPU] Set LoopInfo as preserved by SIAnnotateControlFlow
The pass does not change loops, it just adds calls.
Differential Revision: https://reviews.llvm.org/D105583
Louis Dionne [Thu, 8 Jul 2021 16:14:31 +0000 (12:14 -0400)]
[libc++][ci] Stop testing on GCC previous, since we don't support it anymore
This is the first of a few commits that update the CI to match the
recently officialized compiler support policy. I'm staging those
changes to try and keep the CI green at all times, accounting how
builders refresh their Docker image.
Nikita Popov [Thu, 8 Jul 2021 15:49:56 +0000 (17:49 +0200)]
[IR] Restore vector support for deprecated CreateGEP methods
As pointed out in post-commit review on rG8e22539067d9, it's
necessary to call getScalarType() to support GEPs with a vector
base. Dropping that call was an oversight on my side.
Louis Dionne [Tue, 6 Jul 2021 19:47:29 +0000 (15:47 -0400)]
[libc++][docs] Update documentation to reflect libc++'s compiler support policy
In https://lists.llvm.org/pipermail/llvm-dev/2021-March/148881.html, we
discussed updating the compiler support policy for libc++ to match more
closely what we do actually support.
This commit enshrines that policy decision in libc++'s documentation.
Differential Revision: https://reviews.llvm.org/D105563
Louis Dionne [Thu, 8 Jul 2021 15:11:07 +0000 (11:11 -0400)]
[libc++] Workaround failures with modules on Clang ToT
Jeremy Morse [Wed, 2 Jun 2021 14:58:03 +0000 (15:58 +0100)]
[DebugInfo][InstrRef][4/4] Support DBG_INSTR_REF through all backend passes
This is a cleanup patch -- we're now able to support all flavours of
variable location in instruction referencing mode. This patch updates
various tests for debug instructions to be broader: numerous code paths
try to ignore debug isntructions, and they now have to ignore the
additional DBG_PHI and DBG_INSTR_REFs that we can generate.
A small amount of rework happens for LiveDebugVariables: as we don't need
to track live intervals through regalloc any more, we can get away with
unlinking debug instructions before regalloc, then re-inserting them after.
Note that this isn't (yet) true of DBG_VALUE_LISTs, they still have to go
through live interval tracking.
In SelectionDAG, add a helper lambda that emits half-formed DBG_INSTR_REFs
for arguments in instr-ref mode, DBG_VALUE otherwise. This is one of the
final locations where DBG_VALUEs are emitted for vreg arguments.
X86InstrInfo now un-sets the debug instr number on SUB instructions that
get mutated into CMP instructions. As the instruction no longer computes a
subtraction, we can't use it for variable locations.
Differential Revision: https://reviews.llvm.org/D88898
LLVM GN Syncbot [Thu, 8 Jul 2021 15:35:54 +0000 (15:35 +0000)]
[gn build] Port
321c2ea91cb1
Mark de Wever [Wed, 7 Jul 2021 19:27:27 +0000 (21:27 +0200)]
[libc++][NFC] Move monostate to its own header.
The format library uses `std::monostate`, but not a `std::variant`.
Moving `std::monostate` to its own header allows the format library to
reduce the amount of included code.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D105582