Carl Ritson [Tue, 17 Aug 2021 01:24:49 +0000 (10:24 +0900)]
[AMDGPU] Make BVH isel consistent with other MIMG opcodes
Suffix opcodes with _gfx10.
Remove direct references to architecture specific opcodes.
Add a BVH flag and apply this to diassembly.
Fix a number of disassembly errors on gfx90a target caused by
previous incorrect BVH detection code.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D108117
Matthias Springer [Tue, 17 Aug 2021 01:27:41 +0000 (10:27 +0900)]
[mlir][Analysis][NFC] Clean up FlatAffineValueConstraints
* Rename ids to values in FlatAffineValueConstraints.
* Overall cleanup of comments in FlatAffineConstraints and FlatAffineValueConstraints.
Differential Revision: https://reviews.llvm.org/D107947
Weverything [Mon, 16 Aug 2021 23:54:10 +0000 (16:54 -0700)]
Fix missing qualifier in template type diffing
Handle SubstTemplateTypeParmType so qualifiers do not get dropped from
the diagnostic message.
Matthias Springer [Tue, 17 Aug 2021 01:08:08 +0000 (10:08 +0900)]
[mlir][Analysis][NFC] Split FlatAffineConstraints class
* Extract "value" functionality of `FlatAffineConstraints` into a new derived `FlatAffineValueConstraints` class. Current users of `FlatAffineConstraints` can use `FlatAffineValueConstraints` without additional code changes, thus NFC.
* `FlatAffineConstraints` no longer associates dimensions with SSA Values. All functionality that requires this, is moved to `FlatAffineValueConstraints`.
* `FlatAffineConstraints` no longer makes assumptions about where Values associated with dimensions are coming from.
Differential Revision: https://reviews.llvm.org/D107725
Hongtao Yu [Mon, 16 Aug 2021 21:17:43 +0000 (14:17 -0700)]
[SamplePGO][NFC] Dump function profiles in order
Sample profiles are stored in a string map which is basically an unordered map. Printing out profiles by simply walking the string map doesn't enforce an order. I'm sorting the map in the decreasing order of total samples to enable a more stable dump, which is good for comparing two dumps.
Reviewed By: wenlei, wlei
Differential Revision: https://reviews.llvm.org/D108147
Nathan Chancellor [Tue, 17 Aug 2021 00:11:07 +0000 (17:11 -0700)]
[clang] Expose unreachable fallthrough annotation warning
The Linux kernel has a macro called IS_ENABLED(), which evaluates to a
constant 1 or 0 based on Kconfig selections, allowing C code to be
unconditionally enabled or disabled at build time. For example:
int foo(struct *a, int b) {
switch (b) {
case 1:
if (a->flag || !IS_ENABLED(CONFIG_64BIT))
return 1;
__attribute__((fallthrough));
case 2:
return 2;
default:
return 3;
}
}
There is an unreachable warning about the fallthrough annotation in the
first case because !IS_ENABLED(CONFIG_64BIT) can be evaluated to 1,
which looks like
return 1;
__attribute__((fallthrough));
to clang.
This type of warning is pointless for the Linux kernel because it does
this trick all over the place due to the sheer number of configuration
options that it has.
Add -Wunreachable-code-fallthrough, enabled under -Wunreachable-code, so
that projects that want to warn on unreachable code get this warning but
projects that do not care about unreachable code can still use
-Wimplicit-fallthrough without having to make changes to their code
base.
Fixes PR51094.
Reviewed By: aaron.ballman, nickdesaulniers
Differential Revision: https://reviews.llvm.org/D107933
Geoffrey Martin-Noble [Thu, 5 Aug 2021 23:29:59 +0000 (16:29 -0700)]
[MLIR] Add a bitcast method to DenseElementsAttr
This method bitcasts a DenseElementsAttr elementwise to one of the same
shape with a different element type.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D107612
Douglas Yung [Tue, 17 Aug 2021 00:01:57 +0000 (17:01 -0700)]
[tsan] Another attempt to fix GCC 8.3 build after D107911
This removes the -Werror compilation flag for x64 linux to work around a gcc bug.
GCC 8.3 reports '__tsan::v3::Event::type’ is too small to hold all values of ‘enum class __tsan::v3::EventType’
incorrectly which gets promoted to an error and causes the build to fail.
Fangrui Song [Mon, 16 Aug 2021 23:41:17 +0000 (16:41 -0700)]
[lldb] Fix -Wunused-but-set-variable
Hongtao Yu [Mon, 16 Aug 2021 16:21:13 +0000 (09:21 -0700)]
[SamplePGO] Fixing a memory issue when creating profiles on-demand
There is a on-dmeand creation of function profile during top-down processing in the sample loader when merging uninlined callees. During the profile creation, a stack string object is used to store a newly-created MD5 name, which is then used by reference as hash key in the profile map. This makes the hash key a dangling reference when later on the stack string object is deallocated.
The issue only happens with md5 profile use and was exposed by context split work for CS profile. I'm making a fix by storing newly created names in the reader.
Reviewed By: wenlei, wmi, wlei
Differential Revision: https://reviews.llvm.org/D108142
Duncan P. N. Exon Smith [Mon, 16 Aug 2021 23:18:11 +0000 (16:18 -0700)]
Clean up test for -f{,no-}implicit-modules-uses-lock
@arichardson pointed out in post-commit review for
https://reviews.llvm.org/D95583 (
b714f73defc8e075) that `-verify` has an
optional argument that works a lot like `FileCheck`'s `-check-prefix`.
Use it to simplify the test for `-fno-implicit-modules-use-lock`!
Vitaly Buka [Mon, 16 Aug 2021 23:15:57 +0000 (16:15 -0700)]
[tsan] Fix GCC 8.3 build after D107911
gcc 8.3 reports:
__tsan::v3::Event::type’ is too small to hold all values of ‘enum class __tsan::v3::EventType’
Arthur Eubanks [Mon, 16 Aug 2021 23:07:47 +0000 (16:07 -0700)]
[NFC] Remove/replace some confusing attribute getters on Function
Vitaly Buka [Sat, 14 Aug 2021 23:51:10 +0000 (16:51 -0700)]
[sanitizer] Define 32bit uptr as uint
This makes it consistent with uintptr_t.
It's
45138f788c9b3c4ac5d9ae4479841c411c15190e with Darwin fix.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D108163
Vitaly Buka [Mon, 16 Aug 2021 22:42:17 +0000 (15:42 -0700)]
Revert "[sanitizer] Fix MAC build after D108163"
They still fail to fix Darwin builds
https://green.lab.llvm.org/green/job/clang-stage1-RA/23399/consoleFull#
462858634a1ca8a51-895e-46c6-af87-
ce24fa4cd561
This reverts commit
ae0628f716cc05ad28adf963538a67e69d58d21d.
This reverts commit
2c6448cdc2f68f8c28fd0bd9404182b81306e6e6.
Min-Yih Hsu [Mon, 16 Aug 2021 00:19:33 +0000 (17:19 -0700)]
[M68k] Do not pass llvm::Function& to M68kCCState
Previously we're passing `llvm::Function&` into `M68kCCState` to lower
arguments in fastcc. However, that reference might not be available if
it's a library call and we only need its argument types. Therefore,
now we're simply passing a list of argument llvm::Type-s.
This fixes PR-50752.
Differential Revision: https://reviews.llvm.org/D108101
Afanasyev Ivan [Mon, 16 Aug 2021 22:26:57 +0000 (15:26 -0700)]
[AsmPrinter] fix nullptr dereference for MBBs with hasAddressTaken property without BB
Basic block pointer is dereferenced unconditionally for MBBs with
hasAddressTaken property.
MBBs might have hasAddressTaken property without reference to BB.
Backend developers must assign fake BB to MBB to workaround this issue
and it should be fixed.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D108092
Guillaume Chatelet [Mon, 16 Aug 2021 22:28:53 +0000 (22:28 +0000)]
[libc] dedup handling of size 4 for memset
Vitaly Buka [Mon, 16 Aug 2021 22:21:54 +0000 (15:21 -0700)]
[sanitizer] Fix MAC build after D108163
Guillaume Chatelet [Mon, 16 Aug 2021 22:12:00 +0000 (22:12 +0000)]
[libc] Optimize Loop strategy
Since the precondition for loop is `size >= T::kSize` we always expect
at least one run of the loop. This patch transforms the for-loop into a
do/while-loop which saves at least one test.
We also add a second template parameter to allow the Tail operation to
differ from the loop operation.
David Green [Mon, 16 Aug 2021 21:58:12 +0000 (22:58 +0100)]
[ARM] Create MQQPR and MQQQQPR register classes
Similar to the MQPR register class as the MVE equivalent to QPR, this
adds MQQPR and MQQQQPR register classes for the MVE equivalents of QQPR
and QQQQPR registers. The MVE MQPR seemed have worked out quite well,
and adding MQQPR and MQQQQPR allows us to a little more accurately
specify the number of registers, calculating register pressure limits a
little better.
Differential Revision: https://reviews.llvm.org/D107463
Kostya Kortchinsky [Mon, 16 Aug 2021 18:59:15 +0000 (11:59 -0700)]
[scudo] Use stdint types for internal types (redo)
This is a redo of D108089 that broke some 32-bit builds.
`scudo::uptr` was defined as an `unsigned long` on 32-b platform,
while a `uintptr_t` is usually defined as an `unsigned int`.
This worked, this was not consistent, particularly with regard to
format string specifiers.
As suggested by Vitaly, since we are including `stdint.h`, define
the internal scudo integer types to those.
Differential Revision: https://reviews.llvm.org/D108152
Vitaly Buka [Sat, 14 Aug 2021 23:51:10 +0000 (16:51 -0700)]
[sanitizer] Define 32bit uptr as uint
This makes it consistent with uintptr_t.
It's
45138f788c9b3c4ac5d9ae4479841c411c15190e with Darwin fix.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D108163
Rob Suderman [Mon, 16 Aug 2021 20:47:00 +0000 (13:47 -0700)]
[mlir][tosa] Fixed depthwise conv parallel/reduction indices order
Reduction axis should come after all parallel axis to work with vectorization.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D108005
Anshil Gandhi [Mon, 16 Aug 2021 20:56:01 +0000 (14:56 -0600)]
[Remarks] Emit optimization remarks for atomics generating CAS loop
Implements ORE in AtomicExpand pass to report atomics generating a
compare and swap loop.
Differential Revision: https://reviews.llvm.org/D106891
Jason Molenda [Mon, 16 Aug 2021 20:46:12 +0000 (13:46 -0700)]
Ah, fix formatting, I didn't notice lldb-instr's code
additions were unusually formatted.
Craig Topper [Mon, 16 Aug 2021 20:36:16 +0000 (13:36 -0700)]
[ARM][TypePromotion] Re-generate test checks. NFC
Tests were missing load/store alignment. One test in casts.ll had
no check lines.
Jason Molenda [Mon, 16 Aug 2021 20:40:07 +0000 (13:40 -0700)]
Correctly update reproducer hooks for SB API I added
In
9ea6dd5cfac0b233fbb148c1e2d0f81f816737c8 /
https://reviews.llvm.org/D88387 where I added skinny corefile
creation, I added new SB API and tried to manually update the hooks
for the reproducers. I missed a spot, and I should have used
lldb-instr to update the instrumentation automatically.
Evgenii Stepanov [Sat, 14 Aug 2021 00:15:52 +0000 (17:15 -0700)]
[hwasan] Ignore lit config.enable_aliases on non-x86.
This re-enables a number of Android tests that have been lost in
check-hwasan.
Differential Revision: https://reviews.llvm.org/D108064
Vyacheslav Zakharin [Fri, 13 Aug 2021 00:23:28 +0000 (17:23 -0700)]
[clang-offload-wrapper] Add standard notes for ELF offload images
The patch adds ELF notes into SHT_NOTE sections of ELF offload images
passed to clang-offload-wrapper.
The new notes use a null-terminated "LLVMOMPOFFLOAD" note name.
There are currently three types of notes:
VERSION: a string (not null-terminated) representing the ELF offload
image structure. The current version '1.0' does not put any restrictions
on the structure of the image. If we ever need to come up with a common
structure for ELF offload images (e.g. to be able to analyze the images
in libomptarget in some standard way), then we will introduce new versions.
PRODUCER: a vendor specific name of the producing toolchain.
Upstream LLVM uses "LLVM" (not null-terminated).
PRODUCER_VERSION: a vendor specific version of the producing toolchain.
Upstream LLVM uses LLVM_VERSION_STRING with optional <space> LLVM_REVISION.
All three notes are not mandatory currently.
Differential Revision: https://reviews.llvm.org/D99551
Stanislav Mekhanoshin [Mon, 9 Aug 2021 18:12:15 +0000 (11:12 -0700)]
Allow rematerialization of virtual reg uses
Currently isReallyTriviallyReMaterializableGeneric() implementation
prevents rematerialization on any virtual register use on the grounds
that is not a trivial rematerialization and that we do not want to
extend liveranges.
It appears that LRE logic does not attempt to extend a liverange of
a source register for rematerialization so that is not an issue.
That is checked in the LiveRangeEdit::allUsesAvailableAt().
The only non-trivial aspect of it is accounting for tied-defs which
normally represent a read-modify-write operation and not rematerializable.
The test for a tied-def situation already exists in the
/CodeGen/AMDGPU/remat-vop.mir,
test_no_remat_v_cvt_f32_i32_sdwa_dst_unused_preserve.
The change has affected ARM/Thumb, Mips, RISCV, and x86. For the targets
where I more or less understand the asm it seems to reduce spilling
(as expected) or be neutral. However, it needs a review by all targets'
specialists.
Differential Revision: https://reviews.llvm.org/D106408
Vincent Lee [Thu, 12 Aug 2021 05:08:56 +0000 (22:08 -0700)]
[lld-macho] Ignore LLVM segments to prevent duplicate syms
There was an instance of a third-party archive containing multiple
_llvm symbols from different files that clashed with each other
producing duplicate symbols. Symbols under the LLVM segment
don't seem to be producing any meaningful value, so just ignore them.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D108016
Gulfem Savrun Yeniceri [Mon, 16 Aug 2021 18:55:31 +0000 (18:55 +0000)]
[profile] Add static keyword to binary id functions
This patch adds static keyword to internal functions that write
binary id to restrict visibility to the file that they are declared.
Differential Revision: https://reviews.llvm.org/D108154
Geoffrey Martin-Noble [Mon, 16 Aug 2021 19:12:38 +0000 (12:12 -0700)]
[Bazel] Update for
957334382c
Update LLVM configuration to define `HAVE_UNW_ADD_DYNAMIC_FDE` for macOS
since https://github.com/llvm/llvm-project/commit/
957334382c moved that
to a define.
Differential Revision: https://reviews.llvm.org/D108157
Rong Xu [Mon, 16 Aug 2021 19:16:43 +0000 (12:16 -0700)]
Reapply commit
b7425e956
The commit
b7425e956: [NFC] fix typos
is harmless but was reverted by accident. Reapply.
Stanislav Mekhanoshin [Mon, 9 Aug 2021 17:18:52 +0000 (10:18 -0700)]
Prevent machine licm if remattable with a vreg use
Check if a remateralizable nstruction does not have any virtual
register uses. Even though rematerializable RA might not actually
rematerialize it in this scenario. In that case we do not want to
hoist such instruction out of the loop in a believe RA will sink
it back if needed.
This already has impact on AMDGPU target which does not check for
this condition in its isTriviallyReMaterializable implementation
and have instructions with virtual register uses enabled. The
other targets are not impacted at this point although will be when
D106408 lands.
Differential Revision: https://reviews.llvm.org/D107677
Nikita Popov [Sat, 14 Aug 2021 15:46:47 +0000 (17:46 +0200)]
[MemorySSA] Remove -enable-mssa-loop-dependency option
This option has been enabled by default for quite a while now.
The practical impact of removing the option is that MSSA use
cannot be disabled in default pipelines (both LPM and NPM) and
in manual LPM invocations. NPM can still choose to enable/disable
MSSA using loop vs loop-mssa.
The next step will be to require MSSA for LICM and drop the
AST-based implementation entirely.
Differential Revision: https://reviews.llvm.org/D108075
Robert Suderman [Mon, 16 Aug 2021 18:46:58 +0000 (11:46 -0700)]
[mlir][linalg] Clear unused linalg tc operations
These operations are not lowered to from any source dialect and are only
used for redundant tests. Removing these named ops, along with their
associated tests, will make migration to YAML operations much more
convenient.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D107993
Aart Bik [Mon, 16 Aug 2021 17:31:17 +0000 (10:31 -0700)]
[mlir][sparse][python] make imports more selective
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D108055
Nikita Popov [Sat, 14 Aug 2021 15:55:08 +0000 (17:55 +0200)]
[MemorySSA] Remove unnecessary MSSA dependencies
LoopLoadElimination, LoopVersioning and LoopVectorize currently
fetch MemorySSA when construction LoopAccessAnalysis. However,
LoopAccessAnalysis does not actually use MemorySSA and we can pass
nullptr instead.
This saves one MemorySSA calculation in the default pipeline, and
thus improves compile-time.
Differential Revision: https://reviews.llvm.org/D108074
Nikita Popov [Sat, 14 Aug 2021 14:21:56 +0000 (16:21 +0200)]
[PassBuilder] Don't use MemorySSA for standalone LoopRotate passes
Two standalone LoopRotate passes scheduled using
createFunctionToLoopPassAdaptor() currently enable MemorySSA.
However, while LoopRotate can preserve MemorySSA, it does not use
it, so requiring MemorySSA is unnecessary.
This change doesn't have a practical compile-time impact by itself,
because subsequent passes still request MemorySSA.
Differential Revision: https://reviews.llvm.org/D108073
Kostya Kortchinsky [Mon, 16 Aug 2021 18:13:48 +0000 (11:13 -0700)]
Revert "[scudo] Use stdint types for internal scudo types"
This reverts commit
5fc841d8a278ea16bae457deba35d0db6b716dd6.
Kostya Kortchinsky [Mon, 16 Aug 2021 18:12:35 +0000 (11:12 -0700)]
Revert "[NFC] Fix typos"
This reverts commit
b7425e956be60a73004d7ae5bb37da85872c29fb.
Alfsonso Gregory [Mon, 16 Aug 2021 18:07:50 +0000 (19:07 +0100)]
[Clang][AST][NFC] Resolve FIXME: Remove unused QualType ElementType member from the ASTContext class.
It is completely unused and not needed to be kept, so let us remove it.
Differential Revision: https://reviews.llvm.org/D107719
Kostya Kortchinsky [Sun, 15 Aug 2021 16:09:46 +0000 (09:09 -0700)]
[scudo] Use stdint types for internal scudo types
`scudo::uptr` was defined as an `unsigned long` on 32-b platform,
while a `uintptr_t` is usually defined as an `unsigned int`.
This worked, this was not consistent, particularly with regard to
format string specifiers.
As suggested by Vitaly, since we are including `stdint.h`, define
the internal `scudo` integer types to those.
Differential Revision: https://reviews.llvm.org/D108089
Rong Xu [Mon, 16 Aug 2021 17:15:30 +0000 (10:15 -0700)]
[NFC] Fix typos
s/senstive/senstive/g
Jordan Rupprecht [Mon, 16 Aug 2021 17:04:32 +0000 (10:04 -0700)]
[NFC][AArch64] Fix unused var in release build
Shilei Tian [Mon, 16 Aug 2021 16:49:59 +0000 (12:49 -0400)]
[NFC] Trim trailing whitespaces in `llvm/CMakeLists.txt`
Simon Pilgrim [Mon, 16 Aug 2021 16:25:34 +0000 (17:25 +0100)]
[X86] Add i128 funnel shift tests
Test coverage for D108058
Paul Robinson [Mon, 16 Aug 2021 16:27:48 +0000 (09:27 -0700)]
Fix whitespace typo in 94b4598
Nikita Popov [Sun, 15 Aug 2021 21:43:34 +0000 (23:43 +0200)]
[profile] Don't use pragma comment linker on mingw
At least when compiling with gcc, this is not supported and will
result in errors when linking against the profiler runtime. Only
use the pragma comment linker based code with MSVC, but not with
a mingw toolchain. This also undoes D107620, which shouldn't be
relevant anymore.
Differential Revision: https://reviews.llvm.org/D108095
Paul Robinson [Mon, 16 Aug 2021 15:42:21 +0000 (08:42 -0700)]
[PS4] stp[n]cpy not available on PS4
Raphael Isemann [Mon, 16 Aug 2021 15:39:10 +0000 (17:39 +0200)]
[lldb] Add tests for TypeSystemMap::GetTypeSystemForLanguage
Regression tests for D108088 .
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D108121
Craig Topper [Mon, 16 Aug 2021 15:42:00 +0000 (08:42 -0700)]
[TypePromotion] Don't mutate the result type of SwitchInst.
SwitchInst should have a void result type.
Add a check to the verifier to catch this error.
Reviewed By: samparker
Differential Revision: https://reviews.llvm.org/D108084
Louis Dionne [Mon, 16 Aug 2021 15:42:30 +0000 (11:42 -0400)]
[libc++][NFC] Replace uses of 'constexpr friend' by 'friend constexpr'
This is done for consistency, since that's what we do everywhere else
in the library.
Dimitry Andric [Sun, 15 Aug 2021 15:59:32 +0000 (17:59 +0200)]
[lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage
When assertions are turned off, the `llvm::Error` value created at the
start of this function is overwritten using the move-assignment
operator, but the success value is never checked. Whenever a TypeSystem
cannot be found or created, this can lead to lldb core dumping with:
Program aborted due to an unhandled Error:
Error value was Success. (Note: Success values must still be checked prior to being destroyed).
Fix this by not creating a `llvm::Error` value in advance, and directly
returning the result of `llvm::make_error` instead, whenever an error is
encountered.
See also: <https://bugs.freebsd.org/253881> and
<https://bugs.freebsd.org/257829>.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D108088
Simon Pilgrim [Mon, 16 Aug 2021 14:53:31 +0000 (15:53 +0100)]
[DAG] Fold concat_vectors(concat_vectors(x,y),concat_vectors(a,b)) -> concat_vectors(x,y,a,b)
Follow-up to D107068, attempt to fold nested concat_vectors/undefs, as long as both the vector and inner subvector types are legal.
This exposed the same issue in ARM's MVE LowerCONCAT_VECTORS_i1 (raised as PR51365) and AArch64's performConcatVectorsCombine which both assumed concat_vectors only took 2 subvector operands.
Differential Revision: https://reviews.llvm.org/D107597
Peyton, Jonathan L [Mon, 28 Jun 2021 21:27:27 +0000 (16:27 -0500)]
[OpenMP] Add a few small fixes
* Add comment to help ensure new construct data are added in two places
* Check for division by zero in the loop worksharing code
* Check for syntax errors in parrange parsing
Differential Revision: https://reviews.llvm.org/D105929
Peyton, Jonathan L [Tue, 13 Jul 2021 19:42:27 +0000 (14:42 -0500)]
[OpenMP] Fix incorrect parameters to sscanf_s call
On Windows, the documentation states that when using sscanf_s,
each %c and %s specifier must also have additional size parameter.
This patch adds the size parameter in the one place where %c is
used.
Differential Revision: https://reviews.llvm.org/D105931
Jeremy Morse [Mon, 16 Aug 2021 14:43:38 +0000 (15:43 +0100)]
Revert
54a61c94f93 and its follow up in
547b712500e
These were part of D107823, however asan has found something excitingly
wrong happening:
https://lab.llvm.org/buildbot/#/builders/5/builds/10543/steps/13/logs/stdio
Sanjay Patel [Mon, 16 Aug 2021 14:28:46 +0000 (10:28 -0400)]
[InstCombine] allow for constant-folding in GEP transform
This would crash the reduced test or as described in
https://llvm.org/PR51485
...because we can't mark a constant (-expression) with 'inbounds'.
Renato Golin [Mon, 16 Aug 2021 10:53:30 +0000 (11:53 +0100)]
Fix type in DenseMap<SmallBitVector, *> to match V.size()
Differential Revision: https://reviews.llvm.org/D108124
Jeremy Morse [Mon, 16 Aug 2021 14:28:56 +0000 (15:28 +0100)]
Suppress signedness-comparison warning
This is a follow-up to
54a61c94f93.
Kristóf Umann [Mon, 5 Jul 2021 13:11:46 +0000 (15:11 +0200)]
[analyzer] MallocChecker: Add a visitor to leave a note on functions that could have, but did not change ownership on leaked memory
This is a rather common feedback we get from out leak checkers: bug reports are
really short, and are contain barely any usable information on what the analyzer
did to conclude that a leak actually happened.
This happens because of our bug report minimizing effort. We construct bug
reports by inspecting the ExplodedNodes that lead to the error from the bottom
up (from the error node all the way to the root of the exploded graph), and mark
entities that were the cause of a bug, or have interacted with it as
interesting. In order to make the bug report a bit less verbose, whenever we
find an entire function call (from CallEnter to CallExitEnd) that didn't talk
about any interesting entity, we prune it (click here for more info on bug
report generation). Even if the event to highlight is exactly this lack of
interaction with interesting entities.
D105553 generalized the visitor that creates notes for these cases. This patch
adds a new kind of NoStateChangeVisitor that leaves notes in functions that
took a piece of dynamically allocated memory that later leaked as parameter,
and didn't change its ownership status.
Differential Revision: https://reviews.llvm.org/D105553
Jeremy Morse [Mon, 16 Aug 2021 13:46:52 +0000 (14:46 +0100)]
[DebugInfo][InstrRef] Honour too-much-debug-info cutouts
VarLoc based LiveDebugValues will abandon variable location propagation if
there are too many blocks and variable assignments in the function. If it
didn't, and we had (say) 1000 blocks and 1000 variables in scope, we'd end
up with 1 million DBG_VALUEs just at the start of blocks.
Instruction-referencing LiveDebugValues should honour this limitation too
(because the same limitation applies to it). Hoist the relevant command
line options into LiveDebugValues.cpp and pass it down into the
implementation classes as an argument to ExtendRanges. I've duplicated all
the run-lines in live-debug-values-cutoffs.mir to have an
instruction-referencing flavour.
Differential Revision: https://reviews.llvm.org/D107823
Riccardo Mori [Mon, 16 Aug 2021 13:52:24 +0000 (15:52 +0200)]
[Polly][Isl] Move to the new-polly-generator branch version of isl-noexceptions.h. 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.
With this commit we are moving from the `polly-generator` branch to the `new-polly-generator` branch that is more mantainable and is based on the official C++ interface `cpp-checked.h`.
Changes made:
- There are now many sublcasses for `isl::ast_node` representing different isl types. Use `isl::ast_node_for`, `isl::ast_node_user`, `isl::ast_node_block` and `isl::ast_node_mark` where needed.
- There are now many sublcasses for `isl::schedule_node` representing different isl types. Use `isl::schedule_node_mark`, `isl::schedule_node_extension`, `isl::schedule_node_band` and `isl::schedule_node_filter` where needed.
- Replace the `isl::*::dump` with `dumpIslObj` since the isl dump method is not exposed in the C++ interface.
- `isl::schedule_node::get_child` has been renamed to `isl::schedule_node::child`
- `isl::pw_multi_aff::get_pw_aff` has been renamed to `isl::pw_multi_aff::at`
- The constructor `isl::union_map(isl::union_pw_multi_aff)` has been replaced with the static method `isl::union_map::from()`
- Replace usages of `isl::val::add_ui` with `isl::val::add`
- `isl::union_set_list::alloc` is now a constructor
- All the `isl_size` values are now wrapped inside the class `isl::size` use `isl::size::release` to get the internal `isl_size` value where needed.
- `isl-noexceptions.h` has been generated by https://github.com/patacca/isl/commit/
73f5ed1f4d1f72582f731590ef9e43d9ab1956ad
No functional change intended.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D107225
Kristóf Umann [Wed, 7 Jul 2021 09:58:26 +0000 (11:58 +0200)]
[analyzer][NFC] Split the main logic of NoStoreFuncVisitor to an abstract NoStateChangeVisitor class
Preceding discussion on cfe-dev: https://lists.llvm.org/pipermail/cfe-dev/2021-June/068450.html
NoStoreFuncVisitor is a rather unique visitor. As VisitNode is invoked on most
other visitors, they are looking for the point where something changed -- change
on a value, some checker-specific GDM trait, a new constraint.
NoStoreFuncVisitor, however, looks specifically for functions that *didn't*
write to a MemRegion of interesting. Quoting from its comments:
/// Put a diagnostic on return statement of all inlined functions
/// for which the region of interest \p RegionOfInterest was passed into,
/// but not written inside, and it has caused an undefined read or a null
/// pointer dereference outside.
It so happens that there are a number of other similar properties that are
worth checking. For instance, if some memory leaks, it might be interesting why
a function didn't take ownership of said memory:
void sink(int *P) {} // no notes
void f() {
sink(new int(5)); // note: Memory is allocated
// Well hold on, sink() was supposed to deal with
// that, this must be a false positive...
} // warning: Potential memory leak [cplusplus.NewDeleteLeaks]
In here, the entity of interest isn't a MemRegion, but a symbol. The property
that changed here isn't a change of value, but rather liveness and GDM traits
managed by MalloChecker.
This patch moves some of the logic of NoStoreFuncVisitor to a new abstract
class, NoStateChangeFuncVisitor. This is mostly calculating and caching the
stack frames in which the entity of interest wasn't changed.
Descendants of this interface have to define 3 things:
* What constitutes as a change to an entity (this is done by overriding
wasModifiedBeforeCallExit)
* What the diagnostic message should be (this is done by overriding
maybeEmitNoteFor.*)
* What constitutes as the entity of interest being passed into the function (this
is also done by overriding maybeEmitNoteFor.*)
Differential Revision: https://reviews.llvm.org/D105553
Simon Pilgrim [Mon, 16 Aug 2021 12:12:13 +0000 (13:12 +0100)]
[X86] Add PR46315 test case
tashuang.zk [Mon, 16 Aug 2021 11:41:55 +0000 (13:41 +0200)]
[MLIR][DISC] Revise ParallelLoopTilingPass with inbound_check mode
Expand ParallelLoopTilingPass with an inbound_check mode.
In default mode, the upper bound of the inner loop is from the min op; in
inbound_check mode, the upper bound of the inner loop is the step of the outer
loop and an additional inbound check will be emitted inside of the inner loop.
This was 'FIXME' in the original codes and a typical usage is for GPU backends,
thus the outer loop and inner loop can be mapped to blocks/threads in seperate.
Differential Revision: https://reviews.llvm.org/D105455
Simon Pilgrim [Mon, 16 Aug 2021 11:57:05 +0000 (12:57 +0100)]
[InstCombine] Add PR38021 nuw test case.
Simon Pilgrim [Mon, 16 Aug 2021 11:30:52 +0000 (12:30 +0100)]
[InstCombine] Regenerate AddOverFlow.ll test checks.
Roman Lebedev [Mon, 16 Aug 2021 11:30:00 +0000 (14:30 +0300)]
Revert "[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not change `GEP` base pointer"
https://bugs.llvm.org/show_bug.cgi?id=51490 was filed.
This reverts commit
35a8bdc775817ce13a6c9b5cf81502052634aa1f.
Dmitry Vyukov [Mon, 16 Aug 2021 11:08:35 +0000 (13:08 +0200)]
tsan: fix unused var warnings in a test
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D108118
Florian Hahn [Mon, 16 Aug 2021 10:48:25 +0000 (11:48 +0100)]
[LoopPeel] Add test with multiple exit blocks branching to unreachable.
Add test as suggested by @ebedev.ri in D108108.
AndreyChurbanov [Mon, 16 Aug 2021 10:39:23 +0000 (13:39 +0300)]
[OpenMP] libomp: cleanup: minor fixes to silence static analyzer.
Added couple more checks to silence KlocWork static code analyzer.
Differential Revision: https://reviews.llvm.org/D107348
Kazushi (Jam) Marukawa [Fri, 13 Aug 2021 10:30:44 +0000 (19:30 +0900)]
[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly
Need to update a clang regression test for VE after
https://reviews.llvm.org/D93769.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D108069
David Sherwood [Mon, 16 Aug 2021 08:21:39 +0000 (09:21 +0100)]
[NFC] Remove unused code in llvm::createSimpleTargetReduction
Florian Hahn [Fri, 13 Aug 2021 10:23:58 +0000 (11:23 +0100)]
[PhaseOrdering] Add test for missed vectorization with vector::at calls.
This test illustrates missed vectorization of loops with multiple
std::vector::at calls, like
int sum(std::vector<int> *A, std::vector<int> *B, int N) {
int cost = 0;
for (int i = 0; i < N; ++i)
cost += A->at(i) + B->at(i);
return cost;
}
https://clang.godbolt.org/z/KbYoaPhvq
Florian Hahn [Fri, 13 Aug 2021 09:39:03 +0000 (10:39 +0100)]
[LoopUnroll] Add peeling tests with unreachable exits.
Dmitry Vyukov [Thu, 5 Aug 2021 15:18:17 +0000 (17:18 +0200)]
tsan: add new trace
Add structures for the new trace format,
functions that serialize and add events to the trace
and trace replaying logic.
Differential Revision: https://reviews.llvm.org/D107911
Florian Hahn [Mon, 16 Aug 2021 07:58:37 +0000 (08:58 +0100)]
Revert "[sanitizer] Define 32bit uptr as uint"
This reverts commit
45138f788c9b3c4ac5d9ae4479841c411c15190e.
It looks like this breaks building sanitizers on Darwin platforms on
Green Dragon
https://green.lab.llvm.org/green/job/clang-stage1-RA/23332/console
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o
/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/./bin/clang++ -DHAVE_RPC_XDR_H=0 -I/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/.. -Wall -std=c++14 -Wno-unused-parameter -O2 -g -DNDEBUG -arch armv7 -arch armv7s -arch arm64 -arch armv7k -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -stdlib=libc++ -miphoneos-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.5.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -g -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-format-pedantic -nostdinc++ -Wno-format -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -DSANITIZER_SUPPORTS_WEAK_HOOKS=0 -MD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizerNoHooks.ios.dir/sanitizer_stacktrace.cpp.o -c '/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp'
In file included from /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp:13:
In file included from /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h:15:
/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common.h:1068:14: error: 'operator new' takes type size_t ('unsigned long') as first parameter
inline void *operator new(__sanitizer::operator_new_size_type size,
^
1 error generated.
Roman Lebedev [Mon, 16 Aug 2021 07:53:15 +0000 (10:53 +0300)]
Revert "Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)"
This is still wrong, as failing bots suggest.
This reverts commit
3d9beefc7d713ad8462d92427ccd17b9532ce904.
Dmitry Vyukov [Thu, 12 Aug 2021 13:43:09 +0000 (15:43 +0200)]
sanitizers: compile with -O1 under debug
Tsan's check_memcpy.c test was disabled under debug because it failed.
But it points to real issues and does not help to just disable it.
I tried to enable it and see what fail and the first hit was default ctor for:
struct ChainedOriginDepotDesc {
u32 here_id;
u32 prev_id;
};
initializing these fields to 0's help partially,
but compiler still emits memset before calling ctor.
I did not try to see what's the next failure, because if it fails
on such small structs, it won't be realistic to fix everything
and keep working.
Compile runtimes with -O1 under debug instead.
It seems to fix all current failures. At least I run check-tsan
under clang/gcc x debug/non-debug and all combinations passed.
-O1 does not usually use too aggressive optimizations
and sometimes even makes debugging easier because machine code
is not exceedingly verbose.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D107962
Cullen Rhodes [Mon, 16 Aug 2021 07:31:55 +0000 (07:31 +0000)]
[AArch64][SME] Disable NEON in streaming mode
In streaming mode most of the NEON instruction set is illegal, disable
NEON when compiling with `+streaming-sve`, unless NEON is explictly
requested.
Subsequent patches will add support for the small subset of NEON
instructions that are legal in streaming mode.
Reviewed By: paulwalker-arm, david-arm
Differential Revision: https://reviews.llvm.org/D107902
Christian Sigg [Thu, 10 Jun 2021 06:56:15 +0000 (08:56 +0200)]
Reset all options in cl::ResetCommandLineParser()
Reset cl::Positional, cl::Sink and cl::ConsumeAfter options as well in cl::ResetCommandLineParser().
Reviewed By: rriddle, sammccall
Differential Revision: https://reviews.llvm.org/D103356
Dmitry Vyukov [Mon, 16 Aug 2021 07:43:26 +0000 (09:43 +0200)]
sanitizer_common: fix format string in LibIgnore
uptr should be printed with %zu.
Differential Revision: https://reviews.llvm.org/D108106
Tres Popp [Tue, 10 Aug 2021 11:53:59 +0000 (13:53 +0200)]
[mlir] Set top-down traversal for LinalgElementwiseOpFusion
The primary pattern for this pass clones many operations from producers
to consumers. Doing this top down prevents duplicated work when a
producer has multiple consumers, if it also is consuming another
linalg.generic.
As an example, a chain of ~2600 generics that are fused into ~70
generics was resulting in 16255 pattern invocations. This took 14
seconds on one machine but takes only 0.3 seconds with top-down
traversal.
Differential Revision: https://reviews.llvm.org/D107818
Sylvestre Ledru [Mon, 16 Aug 2021 07:07:33 +0000 (09:07 +0200)]
Add support of the future Debian (Debian 12 - Bookworm)
https://wiki.debian.org/DebianBookworm
ETA: 2023
Nathan Ridge [Wed, 28 Jul 2021 05:58:28 +0000 (01:58 -0400)]
[clangd] Do not show inlay hints pertaining to code in other files
Fixes https://github.com/clangd/clangd/issues/817
Differential Revision: https://reviews.llvm.org/D106934
Craig Topper [Mon, 16 Aug 2021 04:31:12 +0000 (12:31 +0800)]
[X86] Support avx512fp16 compare instructions in the IntelInstPrinter.
This enables printing of the mnemonics that contain the predicate
in the Intel printer. This requires accounting for the memory size
that is explicitly printed in Intel syntax. Those changes have been
synced to the ATT printer as well.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D108093
Fangrui Song [Mon, 16 Aug 2021 04:19:04 +0000 (21:19 -0700)]
[test] Change llvm-xray options to use the preferred double-dash forms and change -f= to -f
Fangrui Song [Mon, 16 Aug 2021 04:09:35 +0000 (21:09 -0700)]
[docs] Change llvm-xray options to use the preferred double-dash forms
Sanjay Patel [Sun, 15 Aug 2021 18:14:33 +0000 (14:14 -0400)]
[Analysis][SimplifyLibCalls] improve function signature check for memcmp
This would assert/crash as shown in:
https://llvm.org/PR50850
The matching for bcmp/bcopy should probably also be updated,
but that's another patch.
David Blaikie [Sun, 15 Aug 2021 19:30:52 +0000 (12:30 -0700)]
Add missing triple for test
Craig Topper [Sun, 15 Aug 2021 19:00:54 +0000 (12:00 -0700)]
[X86] Prevent accidentally accepting cmpeqsh as a valid mnemonic.
We should only accept as vcmpeqsh.
Same for all the other 31 comparison values.
Craig Topper [Sun, 15 Aug 2021 18:42:33 +0000 (11:42 -0700)]
[X86] Modify the commuted load isel pattern for VCMPSHZrm to match VCMPSSZrm/VCMPSDZrm.
This allows commuting any immediate value. The previous code only
commuted equality immediates. This was inherited from an earlier
version of VCMPSSZrm/VCMPSDZrm.
David Blaikie [Sat, 14 Aug 2021 19:46:08 +0000 (12:46 -0700)]
DWARFVerifier: Check section-relative references at the end of the section
This ensures that debug_types references aren't looked for in
debug_info section.
Behavior is still going to be questionable in an unlinked object file -
since cross-cu references could refer to symbols in another .debug_info
(or, in theory, .debug_types) chunk - but if a producer only uses
ref_addr to refer to things within the same .debug_info chunk in an
object file (eg: whole program optimization/LTO - producing two CUs into
a single .debug_info section in an object file - the ref_addrs there
could be resolved relative to that .debug_info chunk, not needing to
consider comdat (DWARFv5 type units or other creatures) chunks of
.debug_info, etc)
Craig Topper [Sun, 15 Aug 2021 18:35:20 +0000 (11:35 -0700)]
[X86] Add vcmpsh/vcmpph to X86InstrInfo::commuteInstructionImpl.
They were already added to findCommuteOpIndices, but they also
need to be in X86InstrInfo::commuteInstructionImpl in order
to adjust the immediate control.
Craig Topper [Sun, 15 Aug 2021 18:32:28 +0000 (11:32 -0700)]
[X86] Add some tests to show incorrect commuting of vcmpsh instructions.
Sanjay Patel [Sun, 15 Aug 2021 17:39:28 +0000 (13:39 -0400)]
[x86] split memcmp tests for 32/64-bit targets; NFC
memcmp is defined as taking a size_t length arg,
so that differs depending on pointer size of the
target.
We casually matched non-compliant function signatures
as memcmp, but that can cause crashing as seen with
PR50850.
If we fix that bug, these tests would no longer be
testing the expected behavior for a 32-bit target,
so I have duplicated all tests and adjusted them
to match the stricter definition of memcmp/bcmp
by changing the length arg to i32 on a 32-bit target.