Vitaly Buka [Sat, 6 Nov 2021 07:49:51 +0000 (00:49 -0700)]
[sanitizer] Intercept lstat on Linux
It's availible from GLIBC 2.33
Fixes use-of-uninitialized-value llvm/lib/Support/Unix/Path.inc:467:29 in llvm::sys::fs::remove(llvm::Twine const&, bool)
Serikzhan Kazi [Sat, 6 Nov 2021 06:53:18 +0000 (19:53 +1300)]
[clang-tidy] run-clang-tidy.py: analyze unique files only
The files in compile-commands.json can potentially include duplicates.
Change run-clang-tidy.py so that it does not run on the duplicate entries.
Differential Revision: https://reviews.llvm.org/D112926
Juneyoung Lee [Sat, 6 Nov 2021 06:39:19 +0000 (15:39 +0900)]
Revert "[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default"
This reverts commit
7584ef766a7219b6ee5a400637206d26e0fa98ac.
Juneyoung Lee [Sat, 6 Nov 2021 06:34:49 +0000 (15:34 +0900)]
[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions.
I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default.
Test updates are made as a separate patch: D108453
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D105169
Jonas Devlieghere [Sat, 6 Nov 2021 06:08:27 +0000 (23:08 -0700)]
[lldb] Fix C2360: initialization of 'identifier' is skipped by 'case' label
Make sure that every case has its own lexical block.
David Blaikie [Sat, 6 Nov 2021 06:00:05 +0000 (23:00 -0700)]
Fix lld test after dwarfdump array syntax change
Jonas Devlieghere [Sat, 6 Nov 2021 05:07:54 +0000 (22:07 -0700)]
[lldb] Don't set the OS for ARMGetSupportedArchitectureAtIndex
Don't set the OS when computing supported architectures in
PlatformDarwin::ARMGetSupportedArchitectureAtIndex.
Differential revision: https://reviews.llvm.org/D113159
David Blaikie [Sat, 6 Nov 2021 05:49:54 +0000 (22:49 -0700)]
DebugInfo: Simplified Template Names: drop unneeded space in arrays
Matching a recent clang change I've made, now 'int[3]' is formatted
without the space between the type and array bound. This commit updates
libDebugInfoDWARF/llvm-dwarfdump to match that formatting.
Jonas Devlieghere [Sat, 6 Nov 2021 03:41:28 +0000 (20:41 -0700)]
[lldb] Remove 'result' variable which is set but not used (NFC)
Jonas Devlieghere [Sat, 6 Nov 2021 03:31:07 +0000 (20:31 -0700)]
[lldb] Remove nested switches from ARMGetSupportedArchitectureAtIndex (NFC)
Remove the nested switches from the ARMGetSupportedArchitectureAtIndex
implementation.
Differential revision: https://reviews.llvm.org/D113155
Vladimir Vereschaka [Sat, 6 Nov 2021 03:58:21 +0000 (20:58 -0700)]
Revert "[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M"
This reverts commit
3255578ee1dbb5561025ac89cd33ba08e8f26efb.
Failed buildbot's Armv7 builds:
https://lab.llvm.org/buildbot/#/builders/60/builds/5303
Bin Cheng [Thu, 4 Nov 2021 10:07:24 +0000 (18:07 +0800)]
[RISCV]: Fix typo by abstracting VWholeLoad* classes
This patch abstracts VWholeLoad* classes into VWholeLoadN, simplifies
existing code as well as fixes a typo.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D109319
Bin Cheng [Thu, 4 Nov 2021 10:05:48 +0000 (18:05 +0800)]
[RISCV][NFC]: Refactor classes for load/store instructions of RVV
This patch refactors classes for load/store of V extension by:
- Introduce new class for VUnitStrideLoadFF and VUnitStrideSegmentLoadFF
so that uses of L/SUMOP* are not spread around different places.
- Reorder classes for Unit-Stride load/store in line with table
describing lumop/sumop in riscv-v-spec.pdf.
Reviewed By: HsiangKai, craig.topper
Differential Revision: https://reviews.llvm.org/D109318
Kazu Hirata [Sat, 6 Nov 2021 02:39:06 +0000 (19:39 -0700)]
[llvm] Use make_early_inc_range (NFC)
Kazu Hirata [Sat, 6 Nov 2021 02:30:14 +0000 (19:30 -0700)]
[Transforms] Fix a warning
This patch fixes:
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp:124:3:
error: default label in switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
by removing the default case.
wlei [Fri, 5 Nov 2021 03:51:04 +0000 (20:51 -0700)]
[llvm-profgen] Fix index out of bounds error while using ip.advance
Previously we assume there're some non-executing sections at the bottom of the text section so that we won't hit the array's bound. But on BOLTed binary, it turned out .bolt section is at the bottom of text section which can be profiled, then it crash llvm-profgen. This change try to fix it.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D113238
wren romano [Fri, 5 Nov 2021 22:15:39 +0000 (15:15 -0700)]
[mlir][sparse] Factoring magic numbers into a header
Addresses https://bugs.llvm.org/show_bug.cgi?id=52303
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D112962
David Blaikie [Fri, 5 Nov 2021 22:28:23 +0000 (15:28 -0700)]
DWARF Simplified Template Names: Narrow down the handling for operator overloads
Actually we can, for now, remove the explicit "operator" handling
entirely - since clang currently won't try to flag any of these as
rebuildable. That seems like a reasonable state for now, but it could be
narrowed down to only apply to conversion operators, most likely - but
would need more nuance for op> and op>> since they would be incorrectly
flagged as already having their template arguments (due to the trailing
'>').
Philip Reames [Fri, 5 Nov 2021 22:35:53 +0000 (15:35 -0700)]
[SCEV] Use constant range of RHS to prove NUW on narrow IV in trip count logic
The basic idea here is that given a zero extended narrow IV, we can prove the inner IV to be NUW if we can prove there's a value the inner IV must take before overflow which must exit the loop.
Differential Revision: https://reviews.llvm.org/D109457
Vitaly Buka [Fri, 5 Nov 2021 22:09:45 +0000 (15:09 -0700)]
[libFuzzer] Disable Msan on InternalStrnlen
It's called from ATTRIBUTE_NO_SANITIZE_MEMORY code.
It worked as expected if inlined and complained otherwise.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D113323
Zahira Ammarguellat [Mon, 1 Nov 2021 21:08:08 +0000 (14:08 -0700)]
In spir functions, llvm.dbg.declare intrinsics created
for parameters and locals need to refer to the stack
allocation in the alloca address space.
Roman Lebedev [Fri, 5 Nov 2021 21:53:08 +0000 (00:53 +0300)]
[NFC][CostModel] Add exhaustive test coverage for replication shuffles
This coverage has been brought to you by https://godbolt.org/z/nfc3cY1za
Scott Linder [Thu, 4 Nov 2021 15:22:48 +0000 (15:22 +0000)]
[NFC][Verifier] Remove redundant Module parameters
These `M` parameters shadow the `M` member in `VerifierSupport`, and
both always refer to the same module. Eliminate the redundant parameters
and always use the member.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D106474
Jay Foad [Thu, 4 Nov 2021 13:43:09 +0000 (13:43 +0000)]
[TwoAddressInstructionPass] Update existing physreg live intervals
In TwoAddressInstructionPass::processTiedPairs with
-early-live-intervals, update any preexisting physreg live intervals,
as well as virtreg live intervals. By default (without
-precompute-phys-liveness) physreg live intervals only exist for
registers that are live-in to some basic block.
Differential Revision: https://reviews.llvm.org/D113191
Valentin Clement [Fri, 5 Nov 2021 21:16:37 +0000 (22:16 +0100)]
Revert "[fir] Add fir.extract_value and fir.insert_value conversion"
This reverts commit
ea55503d7ca5b6ded73b0fd01a8c528f68e00521.
Leonard Chan [Fri, 5 Nov 2021 21:08:09 +0000 (14:08 -0700)]
[clang][asan] Add test for ensuring PR52382 is fixed
The fix for PR52382 was already introduced in D112732 which ensures that module
instrumentation always runs after function instrumentation. This adds a test
that ensures the PR is addressed and prevent regression.
Differential Revision: https://reviews.llvm.org/D113143
Roman Lebedev [Fri, 5 Nov 2021 16:11:55 +0000 (19:11 +0300)]
[IR] Improve member `ShuffleVectorInst::isReplicationMask()`
When we have an actual shuffle, we can impose the additional restriction
that the mask replicates the elements of the first operand, so we know
the replication factor as a ratio of output and op0 vector sizes.
Jonas Devlieghere [Fri, 5 Nov 2021 20:18:06 +0000 (13:18 -0700)]
[lldb] Use std::string instead of llvm::Twine in GDBRemoteCommunicationClient
From the documentation:
A Twine is not intended for use directly and should not be stored, its
implementation relies on the ability to store pointers to temporary
stack objects which may be deallocated at the end of a statement.
Twines should only be used accepted as const references in arguments,
when an API wishes to accept possibly-concatenated strings.
rdar://
84799118
Differential revision: https://reviews.llvm.org/D113314
Jonas Devlieghere [Fri, 5 Nov 2021 20:13:41 +0000 (13:13 -0700)]
[lldb] Improve 'lang objc tagged-pointer info' command
Don't try to get a class descriptor for a pointer that doesn't look like
a tagged pointer. Also print addresses as fixed-width hex and update the
test.
Arthur O'Dwyer [Thu, 4 Nov 2021 21:58:33 +0000 (17:58 -0400)]
[libc++] Fix hang in counting_semaphore::try_acquire
Before this patch, `try_acquire` blocks instead of returning false.
This is because `__libcpp_thread_poll_with_backoff` interprets zero
as meaning infinite, causing `try_acquire` to wait indefinitely.
Thanks to Pablo Busse (pabusse) for the patch!
Differential Revision: https://reviews.llvm.org/D98334
David Blaikie [Fri, 5 Nov 2021 19:54:39 +0000 (12:54 -0700)]
Add some support for pretty printing Twines containing std::string in gdb
This isn't perfect, since it doesn't use lazy_string - so if the
std::string does contain unprintable characters it might fail, but seems
better than nothing & LLVM doesn't generally store binary data in
std::strings.
Aart Bik [Thu, 4 Nov 2021 17:28:32 +0000 (10:28 -0700)]
[mlir][sparse] run more integration tests with and without SIMD
Reviewed By: wrengr
Differential Revision: https://reviews.llvm.org/D113205
Martin Storsjö [Fri, 5 Nov 2021 09:12:22 +0000 (11:12 +0200)]
[lldb] Use is_style_posix() for path style checks
Since
a8b54834a186f5570b49b614e31b961a9cf1cbfe, there are two
distinct Windows path styles, `windows_backslash` (with the old
`windows` being an alias for it) and `windows_slash`.
4e4883e1f394f7c47ff3adee48039aa8374bb8d0 added helpers for
inspecting path styles.
The newly added windows_slash path style doesn't end up used in
LLDB yet anyway, as LLDB is quite decoupled from most of
llvm::sys::path and uses its own FileSpec class. To take it in
use, it could be hooked up in `FileSpec::Style::GetNativeStyle`
(in lldb/source/Utility/FileSpec.cpp) just like in the `real_style`
function in llvm/lib/Support/Path.cpp in
df0ba47c36f6bd0865e3286853b76d37e037c2d7.
It is not currently clear whether there's a real need for using
the Windows path style with forward slashes in LLDB (if there's any
other applications interacting with it, expecting that style), and
what other changes in LLDB are needed for that to work, but this
at least makes some of the checks more ready for the new style,
simplifying code a bit.
Differential Revision: https://reviews.llvm.org/D113255
Martin Storsjö [Thu, 7 Oct 2021 11:31:32 +0000 (11:31 +0000)]
[unittests] [DWARF] Generalize path separator expectations
This fixes unit tests if running on Windows with a build configured
to prefer forward slashes.
Differential Revision: https://reviews.llvm.org/D113257
Martin Storsjö [Thu, 7 Oct 2021 10:36:46 +0000 (10:36 +0000)]
[DebugInfo] [PDB] Force injected source paths to use backslashes
This fixes lld/COFF/pdb-natvis.test (which only is run on Windows)
when using paths with forward slashes on Windows.
Differential Revision: https://reviews.llvm.org/D113265
Valentin Clement [Fri, 5 Nov 2021 19:49:09 +0000 (20:49 +0100)]
[fir] Remove getModel<Fortran::ISO::CFI_dim_t> in DescriptorModel.h
A windows buildbot complains about previous definiton after D112961.
Remove the extra definition until we can figure out if really needed.
Philip Reames [Fri, 5 Nov 2021 19:34:08 +0000 (12:34 -0700)]
Autogen tests for ease of future update
Martin Storsjö [Fri, 22 Oct 2021 21:48:54 +0000 (00:48 +0300)]
[libcxx] [test] Narrow down XFAILs regarding a MSVC mode specific bug to "windows-dll && msvc"
These tests don't fail when only windows-dll is set in mingw mode, as the
bug is specific to MSVC mode.
Differential Revision: https://reviews.llvm.org/D112348
Sanjay Patel [Fri, 5 Nov 2021 17:28:35 +0000 (13:28 -0400)]
[DAGCombiner] add fold for vselect based on mask of signbit, part 2
This is the 'or' sibling for the fold added with:
D113212
https://alive2.llvm.org/ce/z/tgnp7K
Note that neither of these transforms is poison-safe,
but it does not seem to matter at this level. We have
had the scalar version of D113212 for a long time, so
this is just making optimizer behavior consistent.
We do not have the scalar version of *this* fold,
however, so that is another follow-up.
Sanjay Patel [Fri, 5 Nov 2021 16:46:56 +0000 (12:46 -0400)]
[AArch] add tests for vselect; NFC
These are copy/pasted from the related test patterns in D113212.
Sanjay Patel [Fri, 5 Nov 2021 16:42:22 +0000 (12:42 -0400)]
[x86] add tests for vector select; NFC
River Riddle [Fri, 5 Nov 2021 18:43:26 +0000 (18:43 +0000)]
[mlir][DialectConversion] Legalize all live argument conversions
Previously we didn't materialize conversions for arguments in certain
cases as the implicit type propagation was being heavily relied on
by many patterns. Now that those patterns have been fixed to
properly handle type conversions, we can drop the special behavior.
Differential Revision: https://reviews.llvm.org/D113233
Yonghong Song [Fri, 5 Nov 2021 18:01:31 +0000 (11:01 -0700)]
Reland "[Attr] support btf_type_tag attribute"
This is to revert commit
f95bd18b5faa (Revert "[Attr] support
btf_type_tag attribute") plus a bug fix.
Previous change failed to handle cases like below:
$ cat reduced.c
void a(*);
void a() {}
$ clang -c reduced.c -O2 -g
In such cases, during clang IR generation, for function a(),
CGCodeGen has numParams = 1 for FunctionType. But for
FunctionTypeLoc we have FuncTypeLoc.NumParams = 0. By using
FunctionType.numParams as the bound to access FuncTypeLoc
params, a random crash is triggered. The bug fix is to
check against FuncTypeLoc.NumParams before accessing
FuncTypeLoc.getParam(Idx).
Differential Revision: https://reviews.llvm.org/D111199
Florian Hahn [Fri, 5 Nov 2021 16:45:49 +0000 (17:45 +0100)]
[AArch64][GISel] Optimize 8 and 16 bit variants of uaddo.
Try simplify G_UADDO with 8 or 16 bit operands to wide G_ADD and TBNZ if
result is only used in the no-overflow case. It is restricted to cases
where we know that the high-bits of the operands are 0. If there's an
overflow, then the the 9th or 17th bit must be set, which can be checked
using TBNZ.
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D111888
Deepak Panickal [Fri, 5 Nov 2021 17:39:57 +0000 (17:39 +0000)]
[mlir] Add callback to provide a pass pipeline to MlirOptMain
The callback can be used to provide a default pass pipeline.
Reviewed By: mehdi_amini, rriddle
Differential Revision: https://reviews.llvm.org/D113144
Shao-Ce SUN [Fri, 5 Nov 2021 17:39:14 +0000 (01:39 +0800)]
[RISCV] Support Zfhmin extension
According to RISC-V Unprivileged ISA 15.6.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D111866
Jon Chesterfield [Fri, 5 Nov 2021 17:34:27 +0000 (17:34 +0000)]
[libomptarget] Drop remote plugin cmake version requirement to match llvm
LLVM docs at https://llvm.org/docs/CMake.html#quick-start state 3.13.4
Reviewed By: atmnpatel
Differential Revision: https://reviews.llvm.org/D113271
Zarko Todorovski [Fri, 5 Nov 2021 16:37:42 +0000 (12:37 -0400)]
[AIX][Clang] Fix XL product name in AIX XL compatibility warning
Correct the XLC/C++ version in the warning message to use the information from
XL's -qversion output.
Reviewed By: rzurob
Differential Revision: https://reviews.llvm.org/D112847
Aart Bik [Thu, 4 Nov 2021 16:22:34 +0000 (09:22 -0700)]
[mlir][sparse] test for SIMD reduction chaining in consecutive vector loops
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D113197
Martin Liska [Fri, 5 Nov 2021 16:04:12 +0000 (17:04 +0100)]
sanitizer: Fix -Wpedantic GCC warning
Fixes:
sanitizer_stacktrace.h:212:5: warning: ISO C++ forbids braced-groups within expressions [-Wpedantic]
Differential Revision: https://reviews.llvm.org/D113292
Fangrui Song [Fri, 5 Nov 2021 17:02:49 +0000 (10:02 -0700)]
[llvm-readobj] Display DT_RELRSZ/DT_RELRENT as " (bytes)"
to match RELSZ/RELENT.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D113206
Nico Weber [Fri, 5 Nov 2021 16:43:06 +0000 (12:43 -0400)]
[gn build] Use `=` for of -fdebug-compilation-dir
-f flags usually use the `=` form. -fdebug-compilation-dir= has been
around for a few months now (since
0c2bb6b446c584ab, both LLVM 12.0
and 13.0 have it), so using it shouldn't be a big problem -- especially
since use_relative_paths_in_debug_info is opt-in anyways.
Arthur Eubanks [Fri, 5 Nov 2021 16:31:14 +0000 (09:31 -0700)]
[polly] Properly create and initialize new PM analysis managers
If we don't properly initialize all the analysis managers, we may be
missing analyses that other analyses depend on.
Fixes broken polly test, e.g.
https://lab.llvm.org/buildbot/#/builders/10/builds/7501.
Zarko Todorovski [Fri, 5 Nov 2021 15:27:59 +0000 (11:27 -0400)]
[clang] [Objective C] Inclusive language: use objcmt-allowlist-dir-path=<arg> instead of objcmt-white-list-dir-path=<arg>
Trying to update some options that don't at least have an inclusive language version.
This patch adds `objcmt-allowlist-dir-path` as a default alternative.
Reviewed By: akyrtzi
Differential Revision: https://reviews.llvm.org/D112591
Roman Lebedev [Fri, 5 Nov 2021 16:22:27 +0000 (19:22 +0300)]
[NFCI] InstructionTest: trim `InstructionsTest.ShuffleMaskIsReplicationMask_*` complexity
These tests have pretty high O() complexity due to their nature,
which leads to potentially-long runtimes.
While in release build for me they took ~1 and ~2 sec,
as noted in https://reviews.llvm.org/D113214#inline-1080479
they take minutes in debug build.
Fine-tune the amount of permutations they deal with,
without affecting the test coverage. After this,
they take <~10ms each for me (in release build),
hopefully that is good-enough for debug build too.
Roman Lebedev [Fri, 5 Nov 2021 16:13:06 +0000 (19:13 +0300)]
[NFC] Fix typo in comment for `isReplicationMask()`
This was mentioned in https://reviews.llvm.org/D113214#inline-1080385
but i forgot to stage the change before committing.
Kazu Hirata [Fri, 5 Nov 2021 16:14:32 +0000 (09:14 -0700)]
[Target] Use make_early_inc_range (NFC)
Whitney Tsang [Fri, 5 Nov 2021 15:19:56 +0000 (15:19 +0000)]
Add NoOpLoopNestPass and LOOPNEST_PASS macro
Having a NoOpLoopNestPass can ensure that only outermost loop is invoked
for a LoopNestPass with a lit test.
There are some existing passes that are implemented as LoopNestPass, but
they are still using LOOP_PASS macro.
It would be easier to identify LoopNestPasses with a LOOPNEST_PASS
macro.
Differential Revision: https://reviews.llvm.org/D113185
Craig Topper [Thu, 4 Nov 2021 21:55:22 +0000 (14:55 -0700)]
[RISCV] Enable FP extensions and ABI on fixed-vectors-bitcast.ll.
This improves our type coverage. We were only testing integer
insert and extract before due to the FP types not being enabled for
arguments and returns.
Differential Revision: https://reviews.llvm.org/D113217
Michael Liao [Fri, 5 Nov 2021 14:47:10 +0000 (10:47 -0400)]
[BranchRelaxation] Fix warning on unused variable. NFC.
David Green [Fri, 5 Nov 2021 15:05:09 +0000 (15:05 +0000)]
[InstCombine] Generalize sadd.sat combine to compute sign bits.
There is a combine in instcombine to transform a saturated add/sub into
a saddsat/ssubsat, currently handling inputs which are both sign
extended (https://alive2.llvm.org/ce/z/68qpTn). This can generalize to,
for example ashr of at least the bitwidth (https://alive2.llvm.org/ce/z/4TFyX-
and https://alive2.llvm.org/ce/z/qDWzFs for example). Which means it
generalizes further to "the number of sign bits", needing to be enough
to truncate to the size of the saturate. (An example using `or` for
instance: https://alive2.llvm.org/ce/z/EI_h_A).
So this patch makes use of ComputeNumSignBits (with the newly added
ComputeMinSignedBits) in matchSAddSubSat to generalize the fold to any
inputs with enough sign bits known, truncating the inputs to the new
size of the saturate.
Differential Revision: https://reviews.llvm.org/D112298
Valentin Clement [Fri, 5 Nov 2021 14:52:50 +0000 (15:52 +0100)]
[fir] Add fir.extract_value and fir.insert_value conversion
This patch add the conversion pattern for fir.extract_value
and fir.insert_value. fir.extract_value is lowered to llvm.extractvalue
anf fir.insert_value is lowered to llvm.insertvalue.
This patch also adds the type conversion for the BoxType and RecordType
needed to have some comprehensive tests.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D112961
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Nico Weber [Fri, 5 Nov 2021 14:50:24 +0000 (10:50 -0400)]
[gn build] Reformat all files
Ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.
No behavior change.
Alex Lorenz [Fri, 5 Nov 2021 05:01:33 +0000 (22:01 -0700)]
[clang] 'unused-but-set-variable' warning should not apply to __block objective-c pointers
The __block Objective-C pointers can be set but not used due to a commonly used lifetime extension pattern in Objective-C.
Differential Revision: https://reviews.llvm.org/D112850
Nico Weber [Fri, 5 Nov 2021 14:42:07 +0000 (10:42 -0400)]
[gn build] Use build-machine-independent paths in coverage information
This is possible after D106314 /
8773822c578a.
Makes the required prepare-code-coverage-artifact.py invocation a bit longer,
but that seems like a good tradeoff.
Differential Revision: https://reviews.llvm.org/D113282
Tres Popp [Fri, 5 Nov 2021 14:42:47 +0000 (15:42 +0100)]
Extend timeout of llvm/unittests:ir_tests
This test became much slower after
01d8759ac9
David Green [Fri, 5 Nov 2021 14:41:37 +0000 (14:41 +0000)]
[ValueTracking][InstCombine] Introduce and use ComputeMinSignedBits
This introduces a new ComputeMinSignedBits method for ValueTracking that
returns the BitWidth - SignBits + 1 from ComputeSignBits, and represents
the minimum bit size for the value as a signed integer. Similar to the
existing APInt::getMinSignedBits method, this can make some of the
reasoning around ComputeSignBits more natural.
See https://reviews.llvm.org/D112298
Simon Pilgrim [Fri, 5 Nov 2021 14:36:17 +0000 (14:36 +0000)]
[DAG] FoldConstantVectorArithmetic - remove SDNodeFlags argument
Another minor step towards merging FoldConstantVectorArithmetic into FoldConstantArithmetic.
We don't use SDNodeFlags in any constant folding inside DAG, so passing the Flags argument is a waste of time - an alternative would be to wire up FoldConstantArithmetic to take SDNodeFlags just-in-case we someday start using it, but we don't have any way to test it and I'd prefer to avoid dead code.
Differential Revision: https://reviews.llvm.org/D113276
Roman Lebedev [Fri, 5 Nov 2021 14:26:21 +0000 (17:26 +0300)]
[X86] `X86TTIImpl::getInterleavedMemoryOpCostAVX512()`: mask is i8 not i1
Even though AVX512's masked mem ops (unlike AVX1/2) have a mask
that is a `VF x i1`, replication of said masks happens after
promotion of it to `VF x i8`, so we should use `i8`, not `i1`,
when calculating the cost of mask replication.
Sanjay Patel [Fri, 5 Nov 2021 13:25:54 +0000 (09:25 -0400)]
[DAGCombiner] add fold for vselect based on mask of signbit
(X s< 0) ? Y : 0 --> (X s>> BW-1) & Y
We canonicalize to the icmp+select form in IR, and we already have this fold
for scalar select in SDAG, so I think it's an oversight that we don't have
the fold for vectors. It seems neutral for AArch64 and saves some instructions
on x86.
Whether we should also have the sibling folds for the inverse condition or
all-ones true value may depend on target-specific factors such as whether
there's an "and-not" instruction.
Differential Revision: https://reviews.llvm.org/D113212
Sanjay Patel [Thu, 4 Nov 2021 18:22:41 +0000 (14:22 -0400)]
[AArch64] add tests for vector select; NFC
Sanjay Patel [Thu, 4 Nov 2021 17:58:41 +0000 (13:58 -0400)]
[x86] add tests for vector select; NFC
Sanjay Patel [Wed, 3 Nov 2021 18:50:17 +0000 (14:50 -0400)]
[InstCombine] add signbit tests for icmp with trunc; NFC
LLVM GN Syncbot [Fri, 5 Nov 2021 13:54:25 +0000 (13:54 +0000)]
[gn build] Port
7a98761d74db
Roman Lebedev [Fri, 5 Nov 2021 13:50:24 +0000 (16:50 +0300)]
[IR][ShuffleVector] Introduce `isReplicationMask()` matcher
Avid readers of this saga may recall from previous installments,
that replication mask replicates (lol) each of the `VF` elements
in a vector `ReplicationFactor` times. For example, the mask for
`ReplicationFactor=3` and `VF=4` is: `<0,0,0,1,1,1,2,2,2,3,3,3>`.
More importantly, replication mask is used by LoopVectorizer
when using masked interleaved memory operations.
As discussed in previous installments, while it is used by LV,
and we **seem** to support masked interleaved memory operations on X86,
it's support in cost model leaves a lot to be desired:
until basically yesterday even for AVX512 we had no cost model for it.
As it has been witnessed in the recent
AVX2 `X86TTIImpl::getInterleavedMemoryOpCost()`
costmodel patches, while it is hard-enough to query the cost
of a particular assembly sequence [from llvm-mca],
afterwards the check lines LV costmodel tests must be updated manually.
This is, at the very least, boring.
Okay, now we have decent costmodel coverage for interleaving shuffles,
but now basically the same mind-killing sequence has to be performed
for replication mask. I think we can improve at least the second half
of the problem, by teaching
the `TargetTransformInfoImplCRTPBase::getUserCost()` to recognize
`Instruction::ShuffleVector` that are repetition masks,
adding exhaustive test coverage
using `-cost-model -analyze` + `utils/update_analyze_test_checks.py`
This way we can have good exhaustive coverage for cost model,
and only basic coverage for the LV costmodel.
This patch adds precise undef-aware `isReplicationMask()`,
with exhaustive test coverage.
* `InstructionsTest.ShuffleMaskIsReplicationMask` shows that
it correctly detects all the known masks.
* `InstructionsTest.ShuffleMaskIsReplicationMask_undef`
shows that replacing some mask elements in a known replication mask
still allows us to recognize it as a replication mask.
Note, with enough undef elts, we may detect a different tuple.
* `InstructionsTest.ShuffleMaskIsReplicationMask_Exhaustive_Correctness`
shows that if we detected the replication mask with given params,
then if we actually generate a true replication mask with said params,
it matches element-wise ignoring undef mask elements.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D113214
Roman Lebedev [Fri, 5 Nov 2021 13:50:23 +0000 (16:50 +0300)]
[NFC] Move CombinationGenerator from Exegesis to ADT
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D113213
David Sherwood [Thu, 4 Nov 2021 15:20:16 +0000 (15:20 +0000)]
[AArch64] Add target DAG combine for UUNPKHI/LO
When created a UUNPKLO/HI node with an undef input then the
output should also be undef. I've added a target DAG combine
function to ensure we avoid creating an unnecessary uunpklo/hi
instruction.
Differential Revision: https://reviews.llvm.org/D113266
Quinn Pham [Wed, 3 Nov 2021 19:41:24 +0000 (14:41 -0500)]
[NFC] Inclusive language: Remove instances of master in URLs
[NFC] This patch fixes URLs containing "master". Old URLs were either broken or
redirecting to the new URL.
Reviewed By: #libc, ldionne, mehdi_amini
Differential Revision: https://reviews.llvm.org/D113186
Simon Pilgrim [Fri, 5 Nov 2021 13:18:53 +0000 (13:18 +0000)]
[DAG] FoldConstantArithmetic - rename NumOps -> NumElts. NFC.
NumOps represents the number of elements for vector constant folding, rename this NumElts so in future we can the consistently use NumOps to represent the number of operands of the opcode.
Minor cleanup before trying to begin generalizing FoldConstantArithmetic to support opcodes other than binops.
Nico Weber [Fri, 5 Nov 2021 13:17:59 +0000 (09:17 -0400)]
[gn build] (manually) port
df0ba47c36f
Jingu Kang [Fri, 5 Nov 2021 10:59:42 +0000 (10:59 +0000)]
[AArch64] Fix a bug from a pattern for uaddv(uaddlp(x)) ==> uaddlv
A pattern has selected wrong uaddlv MI. It should be as below.
uaddv(uaddlp(v8i8)) ==> uaddlv(v8i8)
Differential Revision: https://reviews.llvm.org/D113263
Alfredo Dal'Ava Junior [Fri, 5 Nov 2021 12:23:24 +0000 (07:23 -0500)]
[FreeBSD] Do not mark __stack_chk_guard as dso_local
This symbol is defined in libc.so so it is definitely not DSO-Local.
Marking it as such causes problems on some platforms (such as PowerPC).
Differential revision: https://reviews.llvm.org/D109090
Martin Liska [Thu, 4 Nov 2021 07:54:14 +0000 (08:54 +0100)]
Enable -Wformat-pedantic and fix fallout.
Differential Revision: https://reviews.llvm.org/D113172
Simon Pilgrim [Fri, 5 Nov 2021 12:00:47 +0000 (12:00 +0000)]
[DAG] FoldConstantArithmetic - fold bitlogic(bitcast(x),bitcast(y)) -> bitcast(bitlogic(x,y))
To constant fold bitwise logic ops where we've legalized constant build vectors to a different type (e.g. v2i64 -> v4i32), this patch adds a basic ability to peek through the bitcasts and perform the constant fold on the inner operands.
The MVE predicate v2i64 regressions will be addressed by future support for basic v2i64 type support.
One of the yak shaving fixes for D113192....
Differential Revision: https://reviews.llvm.org/D113202
David Green [Fri, 5 Nov 2021 12:00:03 +0000 (12:00 +0000)]
[InstCombine] Add additional tests for converting to sadd.sat with sign bits. NFC
Valentin Clement [Fri, 5 Nov 2021 11:54:12 +0000 (12:54 +0100)]
[fir] Add fir.select and fir.select_rank FIR to LLVM IR conversion patterns
The `fir.select` and `fir.select_rank` are lowered to llvm.switch.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D113089
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Fraser Cormack [Mon, 1 Nov 2021 16:41:46 +0000 (16:41 +0000)]
[LangRef][VP] Document vp.gather and vp.scatter intrinsics
This patch fleshes out the missing documentation for the final two VP
intrinsics introduced in D99355: `llvm.vp.gather` and `llvm.vp.scatter`.
It does so mostly by deferring to the `llvm.masked.gather` and
`llvm.masked.scatter` intrinsics, respectively.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D112997
Alex Zinenko [Fri, 5 Nov 2021 11:05:02 +0000 (12:05 +0100)]
[mlir][python] fix constructor generation for optional operands in presence of segment attribute
The ODS-based Python op bindings generator has been generating incorrect
specification of the operand segment in presence if both optional and variadic
operand groups: optional groups were treated as variadic whereas they require
separate treatement. Make sure it is the case. Also harden the tests around
generated op constructors as they could hitherto accept the code for both
optional and variadic arguments.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D113259
Simon Pilgrim [Fri, 5 Nov 2021 11:00:19 +0000 (11:00 +0000)]
[X86] Enable v32i16 rotate lowering on non-BWI targets
Fixes one of the regressions in D113192
David Green [Fri, 5 Nov 2021 10:57:38 +0000 (10:57 +0000)]
[ARM] Extra MVE constant select test. NFC
Fraser Cormack [Mon, 1 Nov 2021 14:40:09 +0000 (14:40 +0000)]
[LangRef][VP] Document vp.load and vp.store intrinsics
This patch fleshes out the missing documentation for two of the VP
intrinsics introduced in D99355: `llvm.vp.load` and `llvm.vp.store`. It
does so mostly by deferring to the `llvm.masked.load` and
`llvm.masked.store` intrinsics, respectively.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D112930
Clement Courbet [Fri, 5 Nov 2021 09:45:28 +0000 (10:45 +0100)]
[Sema][NFC] Add tests for builtin spaceship operator.
In preparation for D112453.
Riccardo Mori [Fri, 5 Nov 2021 10:14:39 +0000 (11:14 +0100)]
[Polly][Isl] Use the function unsignedFromIslSize to manage a isl::size object. NFCI
This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in lib/External/isl/include/isl/isl-noxceptions.h and the official isl C++ interface.
In the official interface the type `isl::size` cannot be casted to an unsigned without previously having checked if it contains a valid value with the function `isl::size::is_error()`.
For this reason two helping functions have been added:
- `IslAssert`: assert that no errors are present in debug builds and just disables the mandatory error check in non-debug builds
- `unisgnedFromIslSIze`: cast the `isl::size` object to `unsigned`
Changes made:
- Add the functions `IslAssert` and `unsignedFromIslSize`
- Add the utility function `rangeIslSize()`
- Retype `MaxDisjunctsInDomain` from `int` to `unsigned`
- Retype `RunTimeChecksMaxAccessDisjuncts` from `int` to `unsigned`
- Retype `MaxDimensionsInAccessRange` from `int` to `unsigned`
- Replaced some usages of `isl_size` to `unsigned` since we aim not to use `isl_size` anymore
- `isl-noexceptions.h` has been generated by https://github.com/patacca/isl/commit/
e704f73c88f0b4d88e62e447bdb732cf5914094b
No functional change intended.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D113101
Chen Zheng [Fri, 5 Nov 2021 03:22:17 +0000 (03:22 +0000)]
[PowerPC] use correct selection for v16i8/v8i16 splat load
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D113236
Jay Foad [Fri, 5 Nov 2021 09:53:35 +0000 (09:53 +0000)]
Revert "[TwoAddressInstructionPass] Update existing physreg live intervals"
This reverts commit
ec0e1e88d24fadb2cb22f431d66b22ee1b01cd43.
It was pushed by mistake.
Jay Foad [Fri, 5 Nov 2021 08:22:09 +0000 (08:22 +0000)]
[AMDGPU] NFC formatting fixes in SIMemoryLegalizer
Jay Foad [Thu, 4 Nov 2021 13:43:09 +0000 (13:43 +0000)]
[TwoAddressInstructionPass] Update existing physreg live intervals
In TwoAddressInstructionPass::processTiedPairs with
-early-live-intervals, update any preexisting physreg live intervals,
as well as virtreg live intervals. By default (without
-precompute-phys-liveness) physreg live intervals only exist for
registers that are live-in to some basic block.
Differential Revision: https://reviews.llvm.org/D113191
Matthias Springer [Fri, 5 Nov 2021 08:47:44 +0000 (17:47 +0900)]
[mlir][linalg][bufferize] Move bufferizesToAliasOnly to extraClassDecls
By doing so, the method can no longer be reimplemented.
Differential Revision: https://reviews.llvm.org/D113248
Christian Sigg [Thu, 4 Nov 2021 08:05:53 +0000 (09:05 +0100)]
Fix `insertFunctionArguments()` block argument order.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D113171
Tres Popp [Fri, 5 Nov 2021 09:04:14 +0000 (10:04 +0100)]
Add Bazel support for LLVM_WINDOWS_PREFER_FORWARD_SLASH
This was added in
df0ba47c36f6bd0865e3286853b76d37e037c2d7