Commit Graph

366243 Commits

Author SHA1 Message Date
Diego Caballero 609f5e050c [mlir] Rename 'setInsertionPointAfter' to avoid ambiguity
Rename 'setInsertionPointAfter(Value)' API to avoid ambiguity with
'setInsertionPointAfter(Operation *)' for SingleResult operations which
implicitly convert to Value (see D86756).

Differential Revision: https://reviews.llvm.org/D87155
2020-09-15 13:58:42 -07:00
Guillaume Chatelet c3fd2a50ba [libc] Remove special case for 8 and 16 bytes
They don't seem to gain much in real apps and its better to favor less branches and smaller code.
2020-09-15 20:48:27 +00:00
Saleem Abdulrasool 7d26d6a1b0 Sema: add support for `__attribute__((__swift_bridged_typedef__))`
Extend the semantic attributes that clang processes for Swift to include
`swift_bridged_typedef`.  This attribute enables typedefs to be bridged
into Swift with a bridged name.

This is based on the work of the original changes in
8afaf3aad2

Differential Revision: https://reviews.llvm.org/D87396
Reviewed By: Aaron Ballman
2020-09-15 20:15:34 +00:00
Guillaume Chatelet c19fda9aa0 [libc] use stddef instead of string header 2020-09-15 20:12:55 +00:00
Huihui Zhang 3b7f5166bd [SLPVectorizer][SVE] Skip scalable-vector instructions before vectorizeSimpleInstructions.
For scalable type, the aggregated size is unknown at compile-time.
Skip instructions with scalable type to ensure the list of instructions
for vectorizeSimpleInstructions does not contains any scalable-vector instructions.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D87550
2020-09-15 13:10:15 -07:00
Guillaume Chatelet 00ba1a3de7 [libc] remove useless headers 2020-09-15 20:04:12 +00:00
Stephen Hines 516a01b5f3 Implement __isOSVersionAtLeast for Android
Add the implementation of __isOSVersionAtLeast for Android. Currently,
only the major version is checked against the API level of the platform
which is an integer. The API level is retrieved by reading the system
property ro.build.version.sdk (and optionally ro.build.version.codename
to see if the platform is released or not).

Patch by jiyong@google.com

Bug: 150860940
Bug: 134795810
Test: m

Reviewed By: srhines

Differential Revision: https://reviews.llvm.org/D86596
2020-09-15 12:54:06 -07:00
Ta-Wei Tu 38ecd61619 [TableGen] Fix invalid comparison function `SizeOrder` in `getMatchingSubClassWithSubRegs`
Building LLVM with -DEXPENSIVE_CHECKS fails with the following error
message with libstdc++ in debug mode:

Error: comparison doesn't meet irreflexive requirements,
assert(!(a < a)).

The patch fixes the comparison function SizeOrder by returning false
when comparing two equal items.
2020-09-15 15:48:43 -04:00
Matt Arsenault 7d6ca2ec57 InferAddressSpaces: Fix assert with unreachable code
Invalid IR in unreachable code is technically valid IR. In this case,
the address space of the value was never inferred, and we tried to
rewrite it with an invalid address space value which would assert.
2020-09-15 15:48:43 -04:00
Snehasish Kumar f1a3ab9044 [clang] Add a command line flag for the Machine Function Splitter.
This patch adds a command line flag for the machine function splitter
(added in rG94faadaca4e1).

-fsplit-machine-functions
Split machine functions using profile information (x86 ELF). On
other targets an error is emitted. If profile information is not
provided a warning is emitted notifying the user that profile
information is required.

Differential Revision: https://reviews.llvm.org/D87047
2020-09-15 12:41:58 -07:00
Muhammad Asif Manzoor d417488ef5 [AArch64][SVE] Add lowering for llvm fsqrt
Add the functionality to lower fsqrt for passthru variant

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D87707
2020-09-15 15:26:17 -04:00
Albion Fung 05aa997d51 [PowerPC] Implement __int128 vector divide operations
This patch implements __int128 vector divide operations for ISA3.1.

Differential Revision: https://reviews.llvm.org/D85453
2020-09-15 15:19:35 -04:00
Zequan Wu f975ae4867 [CodeGen][typeid] Emit typeinfo directly if type is known at compile-time
Differential Revision: https://reviews.llvm.org/D87425
2020-09-15 12:15:47 -07:00
Jonas Toth 69f98311ca [ASTMatchers] extract public matchers from const-analysis into own patch
The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are decompositionDecl and forEachArgumentWithParamType, that works
for calls through function pointers as well.

This is a reupload of https://reviews.llvm.org/D72505, that already landed,
but had to be reverted due to a GCC crash on powerpc
(https://reviews.llvm.org/rG4c48ea68e491cb42f1b5d43ffba89f6a7f0dadc4)

Because this took a long time to adress, i decided to redo this patch and
have a clean workflow.
I try to coordinate with someone that has a PPC to apply this patch and
test for the crash. If everything is fine, I intend to just commit.
If the crash is still happening, i hope to at least find the cause.

Differential Revision: https://reviews.llvm.org/D87588
2020-09-15 21:07:30 +02:00
Louis Dionne 583c8ce30c [libc++] Fix broken test for std::any and allocators
The test was not allocating the right number of bytes. This is my fault,
not Marshall's, as I was the one to write the tests for 39c8795141.
2020-09-15 15:01:52 -04:00
Arthur Eubanks 558e5c31b6 [Dominators][NewPM] Pin tests with -analyze to legacy PM
-analyze isn't supported in NPM. All affected tests have corresponding
NPM RUN line.
2020-09-15 11:59:00 -07:00
Arthur Eubanks d158e786cc [DemandedBits][NewPM] Pin some tests to legacy PM
All tests have corresponding NPM RUN lines.
-analyze doesn't work under NPM.
2020-09-15 11:55:58 -07:00
Greg Clayton 79f22b1f99 Fix .debug_aranges parsing.
Code was added that used llvm error checking to parse .debug_aranges, but the error check after parsing the DWARFDebugArangesSet was reversed and was causing no error to be returned with no valid address ranges being actually used. This meant we always would fall back onto creating out own address ranges by parsing the compile unit's ranges. This was causing problems for cases where the DW_TAG_compile_unit had a single address range by using a DW_AT_low_pc and DW_AT_high_pc attribute pair (not using a DW_AT_ranges attribute), but the .debug_aranges had correct split ranges. In this case we would end up using the single range for the compile unit that encompassed all of the ranges from the .debug_aranges section and would cause address resolving issues in LLDB where address lookups would fail for certain addresses.

Differential Revision: https://reviews.llvm.org/D87626
2020-09-15 11:50:57 -07:00
LLVM GN Syncbot 32a61531b8 [gn build] Port 3d42d54955 2020-09-15 18:32:17 +00:00
Florian Hahn 3d42d54955 [ConstraintElimination] Add constraint elimination pass.
This patch is a first draft of a new pass that adds a more flexible way
to eliminate compares based on more complex constraints collected from
dominating conditions.

In particular, it aims at simplifying conditions of the forms below
using a forward propagation approach, rather than instcomine-style
ad-hoc backwards walking of def-use chains.

    if (x < y)
      if (y < z)
        if (x < z) <- simplify

or

    if (x + 2 < y)
        if (x + 1 < y) <- simplify assuming no wraps

The general approach is to collect conditions and blocks, sort them by
dominance and then iterate over the sorted list. Conditions are turned
into a linear inequality and add it to a system containing the linear
inequalities that hold on entry to the block. For blocks, we check each
compare against the system and see if it is implied by the constraints
in the system.

We also keep a stack of processed conditions and remove conditions from
the stack and the constraint system once they go out-of-scope (= do not
dominate the current block any longer).

Currently there still are the least the following areas for improvements

* Currently large unsigned constants cannot be added to the system
  (coefficients must be represented as integers)
* The way constraints are managed currently is not very optimized.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D84547
2020-09-15 19:31:11 +01:00
Arthur Eubanks ca76d6e94a [Bugpoint][NewPM] Pin bugpoint to legacy PM
Bugpoint has lots of assumptions and hacks around the legacy PM, put off migrating it to NPM until later.
Fixes tests under BugPoint under NPM.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D87655
2020-09-15 11:29:10 -07:00
Craig Topper 05134877e6 [X86] Use Align in reduceMaskedLoadToScalarLoad/reduceMaskedStoreToScalarStore. Correct pointer info.
If we offset the pointer, we also need to offset the pointer info

Differential Revision: https://reviews.llvm.org/D87593
2020-09-15 11:22:02 -07:00
Louis Dionne d9c9a74d0d [libc++] Add missing friend keyword
Otherwise, we're declaring a non-static member function, and that
gives errors in C++11 because of the change of semantics between
C++11 and C++14 for non-const constexpr member functions.

This was always intended to be a friend declaration.
2020-09-15 14:21:05 -04:00
Arthur Eubanks 9853e84b54 [PostDominators][NewPM] Fix tests to work under NPM
Each test has a legacy PM pinned to legacy PM and a NPM RUN line.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87660
2020-09-15 11:19:01 -07:00
Arthur Eubanks 3f69b2140f [NewPM][opt] Fix -globals-aa not being recognized as alias analysis in NPM
Was missing MODULE_ALIAS_ANALYSIS, previously only FUNCTION_ALIAS_ANALYSIS was taken into account.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87664
2020-09-15 11:18:19 -07:00
Arthur Eubanks e0c7641de6 [RegionInfo][NewPM] Fix RegionInfo tests to work under NPM
Pin RUN lines with -analyze to legacy PM, add corresponding NPM RUN line if missing.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87658
2020-09-15 11:12:14 -07:00
Arthur Eubanks 6f66ad13c5 [DependenceAnalysis][NewPM] Fix tests to work under NPM
All tests had corresponding NPM lines, simply pin non-NPM lines to legacy PM.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D87665
2020-09-15 11:11:23 -07:00
Arthur Eubanks 54e1bf1154 [LoopAccessAnalysis][NewPM] Fix tests to work under NPM
Pin RUN lines with -analyze to legacy PM, add corresponding NPM RUN lines.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D87662
2020-09-15 11:06:47 -07:00
Alexey Bataev 738bab743b [OPENMP]Add support for allocate vars in untied tasks.
Local vars, marked with pragma allocate, mustbe allocate by the call of
the runtime function and cannot be allocated as other local variables.
Instead, we allocate a space for the pointer in private record and store
the address, returned by kmpc_alloc call in this pointer.
So, for untied tasks

```
 #pragma omp task untied
 {
   S s;
    #pragma omp allocate(s) allocator(allocator)
   s = x;
 }
```
compiler generates something like this:
```
struct task_with_privates {
  S *ptr;
};

void entry(task_with_privates *p) {
  S *s = p->s;
  switch(partid) {
  case 1:
    p->s = (S*)kmpc_alloc();
    kmpc_omp_task();
    br exit;
  case 2:
    *s = x;
    kmpc_omp_task();
    br exit;
  case 2:
    ~S(s);
    kmpc_free((void*)s);
    br exit;
  }
exit:
}
```

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86558
2020-09-15 13:39:14 -04:00
Nemanja Ivanovic 3bc3983f22 Fix bot failure after ccb4124a41
The test case has a check line for the option on a line that includes
the string lld surrounded by any characters. This causes failures
when said string is in the build path. What the test case presumably
means to test is the actual invocation of the LLD linker (i.e. a
linker that has that string as a suffix). This patch simply removes
the erroneous wildcard after the string.
2020-09-15 12:36:47 -05:00
Fangrui Song 03f1516d60 [MemoryBuffer] Revert unintended MemoryBuffer change from D86996
Fixes SupportsTest MemoryBufferTest.mmapVolatileNoNull
2020-09-15 10:21:05 -07:00
Florian Hahn 3a59628f3c Revert "[DSE] Switch to MemorySSA-backed DSE by default."
This reverts commit fb109c42d9.

Temporarily revert due to a mis-compile pointed out at D87163.
2020-09-15 18:07:56 +01:00
Petr Hosek 9c73e55510 Revert "[DebugInfo] Remove dots from getFilenameByIndex return value"
This is failing on Windows bots due to path separator normalization.

This reverts commit 042c235068.
2020-09-15 10:06:47 -07:00
Fangrui Song 4452cc4086 [VectorCombine] Don't vectorize scalar load under asan/hwasan/memtag/tsan
Similar to the tsan suppression in
`Utils/VNCoercion.cpp:getLoadLoadClobberFullWidthSize` (rL175034; load widening used by GVN),
the D81766 optimization should be suppressed under tsan due to potential
spurious data race reports:

  struct A {
    int i;
    const short s; // the load cannot be vectorized because
    int modify;    // it overlaps with bytes being concurrently modified
    long pad1, pad2;
  };
  // __tsan_read16 does not know that some bytes are undef and accessing is safe

Similarly, under asan, users can mark memory regions with
`__asan_poison_memory_region`. A widened load can lead to a spurious
use-after-poison error. hwasan/memtag should be similarly suppressed.

`mustSuppressSpeculation` suppresses asan/hwasan/tsan but not memtag, so
we need to exclude memtag in `vectorizeLoadInsert`.

Note, memtag suppression can be relaxed if the load is aligned to the
its granule (usually 16), but that is out of scope of this patch.

Reviewed By: spatel, vitalybuka

Differential Revision: https://reviews.llvm.org/D87538
2020-09-15 09:47:21 -07:00
Jonas Devlieghere 127faae752 [lldb] Add -l/--language option to script command
Make it possible to run the script command with a different language
than currently selected.

  $ ./bin/lldb -l python
  (lldb) script -l lua
  >>> io.stdout:write("Hello, World!\n")
  Hello, World!

When passing the language option and a raw command, you need to separate
the flag from the script code with --.

  $ ./bin/lldb -l python
  (lldb) script -l lua -- io.stdout:write("Hello, World!\n")
  Hello, World!

Differential revision: https://reviews.llvm.org/D86996
2020-09-15 09:40:17 -07:00
Simon Pilgrim a43e68b58b [X86][AVX] lowerShuffleWithSHUFPS - handle missed canonicalization cases.
PR47534 exposes a case where calling lowerShuffleWithSHUFPS directly from a derived repeated mask (found by is128BitLaneRepeatedShuffleMask) results in us using an non-canonicalized mask.

The missed canonicalization in this case is trivial - just commute the mask so we have more (swapped) LHS than RHS references so lowerShuffleWithSHUFPS can handle it.
2020-09-15 17:31:08 +01:00
Louis Dionne 4ddd985ca9 NFC: Add whitespace change to .git-blame-ignore-revs 2020-09-15 12:29:50 -04:00
Guozhi Wei 243ffd0cad [MachineBasicBlock] Fix a typo in function copySuccessor
The condition used to decide if need to copy probability should be reversed.

Differential Revision: https://reviews.llvm.org/D87417
2020-09-15 09:18:18 -07:00
Mark de Wever 74a9c6d7e1 [libc++] Add a benchmark for std::map operations
Before tackling http://llvm.org/PR38722, make sure there is a baseline
benchmark.

Differential Revision: https://reviews.llvm.org/D62778
2020-09-15 12:09:29 -04:00
jasonliu ec2b0a5197 [XCOFF] Run resource intense test only on platforms where it makes sense
This is a follow up commit for the issue raised in
https://reviews.llvm.org/D86879
2020-09-15 15:53:35 +00:00
Kristóf Umann dd1d5488e4 [analyzer][Liveness][NFC] Get rid of statement liveness, because such a thing doesn't exist
The summary and very short discussion in D82122 summarizes whats happening here.

In short, liveness talks about variables, or expressions, anything that
has a value. Well, statements just simply don't have a one.

Differential Revision: https://reviews.llvm.org/D82598
2020-09-15 17:43:02 +02:00
Valentin Clement 01f5fcd829 [mlir][openacc] Add loop op verifier
Add a verifier for the loop op in the OpenACC dialect. Check basic restriction
from 2.9 Loop construct from the OpenACC 3.0 specs.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D87546
2020-09-15 11:42:08 -04:00
Simon Pilgrim 2b42d53e5e SLPVectorizer.h - remove unnecessary AliasAnalysis.h include. NFCI.
Forward declare AAResults instead of the (old) AliasAnalysis type.

Remove includes from SLPVectorizer.cpp that are already included in SLPVectorizer.h.
2020-09-15 16:24:05 +01:00
Marshall Clow 39c8795141 [libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy objects in std::any
https://llvm.org/PR45099 notes (correctly) that we're inconsistent in memory
allocation in `std::any`. We allocate memory with `std::allocator<T>::allocate`,
construct with placement new, destroy by calling the destructor directly, and
deallocate by calling `delete`. Most of those are customizable by the user,
but in different ways.

The standard is silent on how these things are to be accomplished.
This patch makes it so we use `allocator_traits<allocator<T>>` for all
of these operations (allocate, construct, destruct, deallocate).
This is, at least, consistent.

Fixes https://llvm.org/PR45099.

Differential Revision: https://reviews.llvm.org/D81133
2020-09-15 11:04:59 -04:00
Sanjay Patel 8985755762 [InstSimplify] add limit folds for fmin/fmax
If the constant operand is the opposite of the min/max value,
then the result must be the other value.

This is based on the similar codegen transform proposed in:
D87571
2020-09-15 10:58:44 -04:00
Kristóf Umann 7c6f5b7fbf [analyzer] Add documentation for alpha.fuchsia.Lock and alpha.core.C11Lock
Differential Revision: https://reviews.llvm.org/D86532
2020-09-15 16:55:44 +02:00
Georgii Rymar 7df873f9c6 [llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred from the hash table, is broken.
Currently we might derive the dynamic symbol table size from the DT_HASH hash table (using its `nchain` field).
It is possible to crash dumpers with a broken relocation that refers to a symbol with an index
that is too large. To trigger it, the inferred size of the dynamic symbol table should go past the end of the object.

This patch adds a size validation + warning.

Differential revision: https://reviews.llvm.org/D86923
2020-09-15 17:44:16 +03:00
Gabor Marton a012bc4c42 [analyzer][StdLibraryFunctionsChecker] Elaborate the summary of fread and fwrite
Add the BufferSize argument constraint to fread and fwrite. This change
itself makes it possible to discover a security critical case, described
in SEI-CERT ARR38-C.

We also add the not-null constraint on the 3rd arguments.

In this patch, I also remove those lambdas that don't take any
parameters (Fwrite, Fread, Getc), thus making the code better
structured.

Differential Revision: https://reviews.llvm.org/D87081
2020-09-15 16:35:39 +02:00
Guillaume Chatelet e328456a9e [libc] Add missing TableGen dependency
Differential Revision: https://reviews.llvm.org/D87689
2020-09-15 14:26:04 +00:00
Guillaume Chatelet 00d6e7116c [libc] Add missing LibcFPTestHelpers library
Differential Revision: https://reviews.llvm.org/D87690
2020-09-15 14:25:34 +00:00