Commit Graph

396818 Commits

Author SHA1 Message Date
Paul Robinson f62d0d48ea Fix whitespace typo in 94b4598 2021-08-16 09:28:06 -07:00
Nikita Popov 4cfb047d6a [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
2021-08-16 18:20:32 +02:00
Paul Robinson 94b4598d77 [PS4] stp[n]cpy not available on PS4 2021-08-16 09:06:52 -07:00
Raphael Isemann cf521e78df [lldb] Add tests for TypeSystemMap::GetTypeSystemForLanguage
Regression tests for D108088 .

Reviewed By: mib

Differential Revision: https://reviews.llvm.org/D108121
2021-08-16 18:00:01 +02:00
Craig Topper 92abb1cf90 [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
2021-08-16 08:54:34 -07:00
Louis Dionne 5ed162c8f9 [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.
2021-08-16 11:43:05 -04:00
Dimitry Andric 5033f0793f [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
2021-08-16 17:34:42 +02:00
Simon Pilgrim d6fe8d37c6 [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
2021-08-16 16:06:54 +01:00
Peyton, Jonathan L b4a1f441d9 [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
2021-08-16 10:02:49 -05:00
Peyton, Jonathan L 6eeb4c1f32 [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
2021-08-16 09:59:21 -05:00
Jeremy Morse 95fe61e639 Revert 54a61c94f9 and its follow up in 547b712500
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
2021-08-16 15:48:56 +01:00
Sanjay Patel de285eacb0 [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'.
2021-08-16 10:36:56 -04:00
Renato Golin a19747ea73 Fix type in DenseMap<SmallBitVector, *> to match V.size()
Differential Revision: https://reviews.llvm.org/D108124
2021-08-16 15:32:04 +01:00
Jeremy Morse 547b712500 Suppress signedness-comparison warning
This is a follow-up to 54a61c94f9.
2021-08-16 15:29:43 +01:00
Kristóf Umann 2d3668c997 [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
2021-08-16 16:19:00 +02:00
Jeremy Morse 54a61c94f9 [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
2021-08-16 15:06:40 +01:00
Riccardo Mori d3fdbda6b0 [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 73f5ed1f4d

No functional change intended.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D107225
2021-08-16 15:53:26 +02:00
Kristóf Umann c019142a89 [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
2021-08-16 15:03:22 +02:00
Simon Pilgrim 2c5c06c5cf [X86] Add PR46315 test case 2021-08-16 13:13:56 +01:00
tashuang.zk 2d45e332ba [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
2021-08-16 14:02:53 +02:00
Simon Pilgrim a7dc71130f [InstCombine] Add PR38021 nuw test case. 2021-08-16 12:57:18 +01:00
Simon Pilgrim 70ab32d388 [InstCombine] Regenerate AddOverFlow.ll test checks. 2021-08-16 12:57:17 +01:00
Roman Lebedev febcedf18c
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 35a8bdc775.
2021-08-16 14:30:29 +03:00
Dmitry Vyukov 79aed89ea3 tsan: fix unused var warnings in a test
Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D108118
2021-08-16 13:13:23 +02:00
Florian Hahn 38c3cebd7d [LoopPeel] Add test with multiple exit blocks branching to unreachable.
Add test as suggested by @ebedev.ri in D108108.
2021-08-16 11:53:18 +01:00
AndreyChurbanov 52cac541d4 [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
2021-08-16 13:39:23 +03:00
Kazushi (Jam) Marukawa 7313a6d87c [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
2021-08-16 18:34:29 +09:00
David Sherwood 9b19b77883 [NFC] Remove unused code in llvm::createSimpleTargetReduction 2021-08-16 09:50:45 +01:00
Florian Hahn 39cc0b8c68
[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
2021-08-16 09:43:30 +01:00
Florian Hahn 96d5a501c5
[LoopUnroll] Add peeling tests with unreachable exits. 2021-08-16 09:43:17 +01:00
Dmitry Vyukov c97318996f 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
2021-08-16 10:24:11 +02:00
Florian Hahn f7347dfa03
Revert "[sanitizer] Define 32bit uptr as uint"
This reverts commit 45138f788c.

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.
2021-08-16 09:08:24 +01:00
Roman Lebedev 2eb554a9fe
Revert "Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)"
This is still wrong, as failing bots suggest.

This reverts commit 3d9beefc7d.
2021-08-16 11:07:42 +03:00
Dmitry Vyukov 7142eb17fb 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
2021-08-16 10:01:50 +02:00
Cullen Rhodes 09507b5325 [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
2021-08-16 07:56:48 +00:00
Christian Sigg 93c55d5ea2 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
2021-08-16 09:56:22 +02:00
Dmitry Vyukov 7185007735 sanitizer_common: fix format string in LibIgnore
uptr should be printed with %zu.

Differential Revision: https://reviews.llvm.org/D108106
2021-08-16 09:45:42 +02:00
Tres Popp 2848f6966e [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
2021-08-16 09:26:49 +02:00
Sylvestre Ledru b8d451da86 Add support of the future Debian (Debian 12 - Bookworm)
https://wiki.debian.org/DebianBookworm

ETA: 2023
2021-08-16 09:11:31 +02:00
Nathan Ridge 47d9d55c66 [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
2021-08-16 01:58:23 -04:00
Craig Topper b82ce77b2b [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
2021-08-16 12:31:36 +08:00
Fangrui Song 935a6d4024 [test] Change llvm-xray options to use the preferred double-dash forms and change -f= to -f 2021-08-15 21:19:04 -07:00
Fangrui Song 676f16bed5 [docs] Change llvm-xray options to use the preferred double-dash forms 2021-08-15 21:09:35 -07:00
Sanjay Patel ca637014f1 [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.
2021-08-15 16:11:26 -04:00
David Blaikie 44d0a99a12 Add missing triple for test 2021-08-15 12:32:12 -07:00
Craig Topper ff95d2524a [X86] Prevent accidentally accepting cmpeqsh as a valid mnemonic.
We should only accept as vcmpeqsh.

Same for all the other 31 comparison values.
2021-08-15 12:00:56 -07:00
Craig Topper 819818f7d5 [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.
2021-08-15 11:43:56 -07:00
David Blaikie 62a4c2c10e 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)
2021-08-15 11:40:24 -07:00
Craig Topper 786b8fcc9b [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.
2021-08-15 11:36:13 -07:00
Craig Topper e5b15c0181 [X86] Add some tests to show incorrect commuting of vcmpsh instructions. 2021-08-15 11:36:13 -07:00