platform/upstream/llvm.git
3 years ago[PowerPC] Fix missing TLS symbol type.
Stefan Pintilie [Wed, 2 Sep 2020 20:23:55 +0000 (15:23 -0500)]
[PowerPC] Fix missing TLS symbol type.

Previous implementations for the TLS models General Dynamic and Initial Exec
were missing the ELF::STT_TLS type on symbols that required the type. This patch
adds the type.

Reviewed By: sfertile, MaskRay

Differential Revision: https://reviews.llvm.org/D86777

3 years ago[llvm-readelf] - Move a bit of common code to printDynamicRelocHeader(). NFC.
Georgii Rymar [Wed, 2 Sep 2020 10:16:42 +0000 (13:16 +0300)]
[llvm-readelf] - Move a bit of common code to printDynamicRelocHeader(). NFC.

This helps to isolate printing of the relocation's summary header
in a single place.

Differential revision: https://reviews.llvm.org/D87042

3 years ago[llvm-readobj/elf] - Improve warning messages, reported for .stack_sizes sections.
Georgii Rymar [Tue, 1 Sep 2020 12:24:14 +0000 (15:24 +0300)]
[llvm-readobj/elf] - Improve warning messages, reported for .stack_sizes sections.

Instead of referring to stack sizes sections only by name, we can add
section indexes and types to warnings reported.

Differential revision: https://reviews.llvm.org/D86934

3 years agoRevert "Adding GDB PrettyPrinter for mlir::Identifier."
OCHyams [Thu, 3 Sep 2020 07:28:15 +0000 (08:28 +0100)]
Revert "Adding GDB PrettyPrinter for mlir::Identifier."

This reverts commit 9e9e6e698d8ef5dc5b7576058f2022aab2534a52.

This commit is causing builds that include the 'debuginfo-tests' project to
fail.

Apple has a public bot which shows the failure:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/23667/console

3 years ago[clang][aarch64] Drop experimental from __ARM_FEATURE_SVE_BITS macro
Cullen Rhodes [Thu, 3 Sep 2020 09:19:41 +0000 (09:19 +0000)]
[clang][aarch64] Drop experimental from  __ARM_FEATURE_SVE_BITS macro

The __ARM_FEATURE_SVE_BITS feature macro is specified in the Arm C
Language Extensions (ACLE) for SVE [1] (version 00bet5). From the spec,
where __ARM_FEATURE_SVE_BITS==N:

    When N is nonzero, indicates that the implementation is generating
    code for an N-bit SVE target and that the arm_sve_vector_bits(N)
    attribute is available.

This was defined in D83550 as __ARM_FEATURE_SVE_BITS_EXPERIMENTAL and
enabled under the -msve-vector-bits flag to simplify initial tests.
This patch drops _EXPERIMENTAL now there is support for the feature.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D86720

3 years agoRevert "[SCCP] Do not replace deref'able ptr with un-deref'able one."
Florian Hahn [Thu, 3 Sep 2020 09:28:42 +0000 (10:28 +0100)]
Revert "[SCCP] Do not replace deref'able ptr with un-deref'able one."

This reverts commit 3542feeb2077f267bff1ab98fb4bf20099f44bb8.

This seems to be causing issues with a sanitizer build
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-msan/builds/21677

3 years ago[SCCP] Do not replace deref'able ptr with un-deref'able one.
Florian Hahn [Thu, 3 Sep 2020 09:17:09 +0000 (10:17 +0100)]
[SCCP] Do not replace deref'able ptr with un-deref'able one.

Currently IPSCCP (and others like CVP/GVN) blindly propagate pointer
equalities. In certain cases, that leads to dereferenceable pointers
being replaced, as in the example test case.

I think this is not allowed, as it introduces an access of an
un-dereferenceable pointer. Note that the pointer is inbounds, but one
past the last element, so it is valid, but not dereferenceable.

This patch is mostly to highlight the issue and start a discussion.
Currently it only checks for specifically looking
one-past-the-last-element pointers with array typed bases.

This causes the mis-compile outlined in
https://stackoverflow.com/questions/55754313/is-this-gcc-clang-past-one-pointer-comparison-behavior-conforming-or-non-standar

In the test case, if we replace %p with the GEP for the store, we
subsequently determine that the store and the load cannot alias, because
they are to different underlying objects.

Note that Alive2 seems to think that the replacement is valid:
https://alive2.llvm.org/ce/z/2rorhk

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D85332

3 years ago[llvm-readelf/obj] - Cleanup the interface of `DumpStyle`. NFCI.
Georgii Rymar [Wed, 2 Sep 2020 15:06:45 +0000 (18:06 +0300)]
[llvm-readelf/obj] - Cleanup the interface of `DumpStyle`. NFCI.

We have 2 DumpStyles currently:
`class GNUStyle : public DumpStyle<ELFT>` and `class LLVMStyle : public DumpStyle<ELFT>`.

The problem of `DumpStyle` interface is that almost for each method
we provide `const ELFFile<ELFT> *` as argument. But in fact each of
dump styles keeps `ELFDumper<ELFT> *Dumper` which can be used to get an object from.

But since we use the `Obj` too often, I've decided to introduce a one more reference member
instead of reading it from the `Dumper` each time:
`const ELFFile<ELFT> &Obj;` This is kind of similar to `FileName` member which we have already:
it is also used to store a the file name which can be read from `Dumper->getElfObject()->getFileName()`.

I had to adjust the code which previously worked with a pointer to an object
and now works with a reference.

In a follow-up I am going to try to get rid of `const ELFObjectFile<ELFT>` arguments
which are still passed to a set of functions.

Differential revision: https://reviews.llvm.org/D87040

3 years ago[SCCP] Add test where dereferenceable ptr is replaced with un-dereferenceable one
Florian Hahn [Fri, 7 Aug 2020 12:21:53 +0000 (13:21 +0100)]
[SCCP] Add test where dereferenceable ptr is replaced with un-dereferenceable one

3 years ago[lldb/Interpreter] Fix language detection for the REPL InitFile
Med Ismail Bennani [Thu, 3 Sep 2020 08:05:51 +0000 (10:05 +0200)]
[lldb/Interpreter] Fix language detection for the REPL InitFile

Previously, before loading the REPL language-specific init file, lldb
checked the selected target language in which case it returned an unknown
language type with the REPL target.

Instead, the patch calls `Language::GetLanguagesSupportingREPLs` and
look for the first element of that set. In case lldb was not configured
with a REPL language, then, it will just stop sourcing the REPL init
file and fallback to the original logic (continuing with the default
init file).

rdar://65836048

Differential Revision: https://reviews.llvm.org/D87076

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb] Make symbol list output from `image dump symtab` not depend on internal orderi...
Raphael Isemann [Thu, 3 Sep 2020 08:26:33 +0000 (10:26 +0200)]
[lldb] Make symbol list output from `image dump symtab` not depend on internal ordering of DenseMap

`image dump symtab` seems to output the symbols in whatever order they appear in
the DenseMap that is used to filter out symbols with non-unique addresses. As
DenseMap is a hash map this order can change at any time so the output of this
command is pretty unstable. This also causes the `Breakpad/symtab.test` to fail
with enabled reverse iteration (which reverses the DenseMap order to find issues
like this).

This patch makes the DenseMap a std::vector and uses a separate DenseSet to do
the address filtering. The output order is now dependent on the order in which
the symbols are read (which should be deterministic). It might also avoid a bit
of work as all the work for creating the Symbol constructor parameters is only
done when we can actually emplace a new Symbol.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D87036

3 years ago[lldb] Remove a stray semicolon, fixing pedantic GCC warnings. NFC.
Martin Storsjö [Thu, 3 Sep 2020 08:19:40 +0000 (11:19 +0300)]
[lldb] Remove a stray semicolon, fixing pedantic GCC warnings. NFC.

3 years ago[AArch64] Add asm directives for the remaining SEH unwind codes
Martin Storsjö [Sat, 15 Aug 2020 21:26:24 +0000 (00:26 +0300)]
[AArch64] Add asm directives for the remaining SEH unwind codes

Add support in llvm-readobj for displaying them and support in the
asm parsser, AArch64TargetStreamer and MCWin64EH for emitting them.

The directives for the remaining basic opcodes have names that
match the opcode in the documentation.

The directives for custom stack cases, that are named
MSFT_OP_TRAP_FRAME, MSFT_OP_MACHINE_FRAME, MSFT_OP_CONTEXT
and MSFT_OP_CLEAR_UNWOUND_TO_CALL, are given matching assembler
directive names that fit into the rest of the opcode naming;
.seh_trap_frame, .seh_context, .seh_clear_unwound_to_call

The opcode MSFT_OP_MACHINE_FRAME is mapped to the existing
opecode enum UOP_PushMachFrame that is used on x86_64, and also
uses the corresponding existing x86_64 directive name
.seh_pushframe.

Differential Revision: https://reviews.llvm.org/D86889

3 years ago[lldb] Remove debugserver specific string from TestAbortExitCode check
Raphael Isemann [Thu, 3 Sep 2020 07:54:37 +0000 (09:54 +0200)]
[lldb] Remove debugserver specific string from TestAbortExitCode check

The test only checks the exit code that the debug server sends back, but
not the following explanation which is different for debugserver and lldb-server.

3 years agoFix broken HUGE_VALF macro in llvm-c/DataTypes.h
Raphael Isemann [Thu, 3 Sep 2020 07:36:12 +0000 (09:36 +0200)]
Fix broken HUGE_VALF macro in llvm-c/DataTypes.h

Commit 3a29393b4709d15069130119cf1d136af4a92d77 removes the cmath/math.h
includes from the DataTypes.h header to speed up parsing. However the
DataTypes.h header was using this header to get the macro `HUGE_VAL` for its own
`HUGE_VALF` macro definition. Now the macro instead just expands into a plain
`HUGE_VAL` token which leads to compiler errors unless `math.h` was previously
included by the including source file. It also leads to compiler warnings with
enabled module builds which point out this inconsistency.

The correct way to fix this seems to be to just remove HUGE_VALF from the
header. llvm-c is not referencing that macro from what I can see and users
probably should just include the math headers if they need it (or define it on
their own for really old C versions).

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D83761

3 years ago[debugserver] Fix that debugserver's stop reply packets always return signal code 0
Raphael Isemann [Thu, 3 Sep 2020 07:17:03 +0000 (09:17 +0200)]
[debugserver] Fix that debugserver's stop reply packets always return signal code 0

If our process terminates due to an unhandled signal, we are supposed to get the
signal code via WTERMSIG. However, we instead try to get the exit status via
WEXITSTATUS which just ends up always calculating signal code 0 (at least on the
macOS implementation where it just shifts the signal code bits away and we're
left with only 0 bits).

The exit status calculation on the LLDB side also seems a bit off as it claims
an exit status that is just the signal code (instead of for example 128 + signal
code), but that will be another patch.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D86336

3 years ago[StackProtector] Fix crash with vararg due to not checking LocationSize validity.
Amara Emerson [Thu, 3 Sep 2020 06:17:48 +0000 (23:17 -0700)]
[StackProtector] Fix crash with vararg due to not checking LocationSize validity.

Differential Revision: https://reviews.llvm.org/D87074

3 years agoAdding GDB PrettyPrinter for mlir::Identifier.
Christian Sigg [Tue, 1 Sep 2020 13:43:38 +0000 (15:43 +0200)]
Adding GDB PrettyPrinter for mlir::Identifier.

This is the first bit from D73546. Primarily setting up the corresponding test. Will add more pretty printers in a separate revision.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D86937

3 years agoDecouple OpPassManager from the the MLIRContext (NFC)
Mehdi Amini [Thu, 3 Sep 2020 05:57:57 +0000 (05:57 +0000)]
Decouple OpPassManager from the the MLIRContext (NFC)

This is allowing to build an OpPassManager from a StringRef instead of an
Identifier, which enables building pipelines without an MLIRContext.
An identifier is still cached on-demand on the OpPassManager for efficiency
during the IR traversal.

3 years ago[mlir][Linalg] Wrong tile size for convolutions fixed
Jakub Lichman [Wed, 2 Sep 2020 14:02:40 +0000 (14:02 +0000)]
[mlir][Linalg] Wrong tile size for convolutions fixed

Sizes of tiles (subviews) are bigger by 1 than they should. Let's consider
1D convolution without batches or channels. Furthermore let m iterate over
the output and n over the kernel then input is accessed with m + n. In tiling
subview sizes for convolutions are computed by applying requested tile size
together with kernel size to the above mentioned expression thus let's say
for tile size of 2 the subview size is 2 + size(n), which is bigger by one
than it should since we move kernel only once. The problem behind it is that
range is not turned into closed interval before the composition. This commit
fixes the problem by turning ranges first into closed intervals by substracting
1 and after the composition back to half open by adding 1.

Differential Revision: https://reviews.llvm.org/D86638

3 years ago[lldb] Add reproducer verifier
Jonas Devlieghere [Mon, 31 Aug 2020 22:13:49 +0000 (15:13 -0700)]
[lldb] Add reproducer verifier

Add a reproducer verifier that catches:

 - Missing or invalid home directory
 - Missing or invalid working directory
 - Missing or invalid module/symbol paths
 - Missing files from the VFS

The verifier is enabled by default during replay, but can be skipped by
passing --reproducer-no-verify.

Differential revision: https://reviews.llvm.org/D86497

3 years ago[lldb] Pass -fno-objc-exceptions for objcxx targets
Jonas Devlieghere [Thu, 3 Sep 2020 04:58:06 +0000 (21:58 -0700)]
[lldb] Pass -fno-objc-exceptions for objcxx targets

When compiling an Objective-C++ file, __has_feature(cxx_exceptions) will
return true with -fno-exceptions but without -fno-objc-exceptions. This
was causing LLVM_ENABLE_EXCEPTIONS to be defined for a subset of files.

3 years agoRevert "[NewPM][Lint] Port -lint to NewPM"
Arthur Eubanks [Thu, 3 Sep 2020 04:34:20 +0000 (21:34 -0700)]
Revert "[NewPM][Lint] Port -lint to NewPM"

This reverts commit 883399c8402188520870f99e7d8b3244f000e698.

3 years ago[NewPM][Lint] Port -lint to NewPM
Arthur Eubanks [Wed, 2 Sep 2020 21:28:27 +0000 (14:28 -0700)]
[NewPM][Lint] Port -lint to NewPM

This also changes -lint from an analysis to a pass. It's similar to
-verify, and that is a normal pass, and lives in llvm/IR.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D87057

3 years ago[lldb] Always record both the working and home directory.
Jonas Devlieghere [Thu, 3 Sep 2020 03:48:50 +0000 (20:48 -0700)]
[lldb] Always record both the working and home directory.

Treat the home directory like the current working directory and always
capture both in the VFS.

3 years ago[CodeGenPrepare][X86] Teach optimizeGatherScatterInst to turn a splat pointer into...
Craig Topper [Thu, 3 Sep 2020 03:44:12 +0000 (20:44 -0700)]
[CodeGenPrepare][X86] Teach optimizeGatherScatterInst to turn a splat pointer into GEP with scalar base and 0 index

This helps SelectionDAGBuilder recognize the splat can be used as a uniform base.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D86371

3 years ago[X86] Add a /tune: option for clang-cl
Craig Topper [Thu, 3 Sep 2020 02:03:28 +0000 (19:03 -0700)]
[X86] Add a /tune: option for clang-cl

We recently added support for -mtune. This patch adds /tune: so we can specify the tune CPU from clang-cl. MSVC doesn't support this but icc does.

Differential Revision: https://reviews.llvm.org/D86820

3 years ago[mlir][spirv] Add block read and write from SPV_INTEL_subgroups
Artur Bialas [Thu, 3 Sep 2020 02:52:29 +0000 (19:52 -0700)]
[mlir][spirv] Add block read and write from SPV_INTEL_subgroups

Added support to OpSubgroupBlockReadINTEL and OpSubgroupBlockWriteINTEL

Differential Revision: https://reviews.llvm.org/D86876

3 years ago[lldb/Gui] zero-initialize children_stop_id
Jordan Rupprecht [Thu, 3 Sep 2020 02:42:54 +0000 (19:42 -0700)]
[lldb/Gui] zero-initialize children_stop_id

This is currently causing msan warnings in the API tests when run under msan, e.g. `commands/gui/basic/TestGuiBasic.py`.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D86825

3 years agoAdd code owners of new MachO port
Greg McGary [Thu, 3 Sep 2020 02:32:12 +0000 (19:32 -0700)]
Add code owners of new MachO port

3 years agoFix for PR46384. Failure on weak dllimport.
Sunil Srivastava [Thu, 3 Sep 2020 02:12:24 +0000 (19:12 -0700)]
Fix for PR46384. Failure on weak dllimport.

Differential Revision: https://reviews.llvm.org/D86907

3 years ago[compiler-rt] Don't build llvm-lit in RUNTIMES-BUILD
Jinsong Ji [Wed, 2 Sep 2020 20:41:15 +0000 (20:41 +0000)]
[compiler-rt] Don't build llvm-lit in RUNTIMES-BUILD

With runtimes-build, we lost map config for llvm-lit, so we can NOT run
lit from source dir anymore.
All the subdir target like: ninja check-llvm-codegen-powerpc will fail
too.

We will get some cfg error like:
  File "../lvm-project/llvm/test/lit.cfg.py", line 21, in <module>
    config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
AttributeError: 'NoneType' object has no attribute 'use_lit_shell'

This is reset of map config in llvm-lit rebuild.
We already have llvm-lit in runtimes-build, so don't build it.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D87002

3 years ago[InstCombine] Fix a couple crashes with extractelement on a scalable vector.
Eli Friedman [Tue, 1 Sep 2020 23:20:18 +0000 (16:20 -0700)]
[InstCombine] Fix a couple crashes with extractelement on a scalable vector.

Differential Revision: https://reviews.llvm.org/D86989

3 years ago[llvm-dwarfdump] Warn user when it encounters no null terminated strings.
Xing GUO [Thu, 3 Sep 2020 00:49:51 +0000 (08:49 +0800)]
[llvm-dwarfdump] Warn user when it encounters no null terminated strings.

When llvm-dwarfdump encounters no null terminated strings, we should
warn user about it rather than ignore it and print nothing.

Before this patch, when llvm-dwarfdump dumps a .debug_str section whose
content is "abc", it prints:

```
.debug_str contents:
```

After this patch:

```
.debug_str contents:
warning: no null terminated string at offset 0x0
```

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D86998

3 years ago[asan_symbolize] Remove --use-symbol-table=true which is the default
Fangrui Song [Thu, 3 Sep 2020 00:34:35 +0000 (17:34 -0700)]
[asan_symbolize] Remove --use-symbol-table=true which is the default

3 years agoRevert de6caf871be79dc7549aebe4e4fb57d52f6ed202 and 51128b670d4f757132e927c4f3dd78d25...
Walter Erquinigo [Thu, 3 Sep 2020 00:05:19 +0000 (17:05 -0700)]
Revert de6caf871be79dc7549aebe4e4fb57d52f6ed202 and 51128b670d4f757132e927c4f3dd78d257d37f70 (https://reviews.llvm.org/D84974)

The tests seem to be timing out in all linux bots. Need further analysis.

Revert "run in terminal"

This reverts commit de6caf871be79dc7549aebe4e4fb57d52f6ed202.

3 years agoTweak `mlir-linalg-ods-gen` library dependency: only MLIRIR is needed, not the entire...
Mehdi Amini [Wed, 2 Sep 2020 23:57:47 +0000 (23:57 +0000)]
Tweak `mlir-linalg-ods-gen` library dependency: only MLIRIR is needed, not the entire parser (NFC)

3 years ago[MLIR][Affine][VectorOps] Vectorize uniform values in SuperVectorizer
Diego Caballero [Wed, 2 Sep 2020 21:56:43 +0000 (00:56 +0300)]
[MLIR][Affine][VectorOps] Vectorize uniform values in SuperVectorizer

This patch adds basic support for vectorization of uniform values to SuperVectorizer.
For now, only invariant values to the target vector loops are considered uniform. This
enables the vectorization of loops that use function arguments and external definitions
to the vector loops. We could extend uniform support in the future if we implement some
kind of divergence analysis algorithm.

Reviewed By: nicolasvasilache, aartbik

Differential Revision: https://reviews.llvm.org/D86756

3 years ago[libc++] Avoid including <sys/cdefs.h> on non-Apple platforms in <ctime>
Louis Dionne [Wed, 2 Sep 2020 22:11:26 +0000 (18:11 -0400)]
[libc++] Avoid including <sys/cdefs.h> on non-Apple platforms in <ctime>

3 years ago[PowerPC] Fix broken kill flag after MI peephole
Nemanja Ivanovic [Wed, 2 Sep 2020 22:04:35 +0000 (17:04 -0500)]
[PowerPC] Fix broken kill flag after MI peephole

The test case in https://bugs.llvm.org/show_bug.cgi?id=47373 exposed
two bugs in the PPC back end. The first one was fixed in commit
27714075848e7f05a297317ad28ad2570d8e5a43 but the test case had to
be added without -verify-machineinstrs due to the second bug.
This commit fixes the use-after-kill that is left behind by the
PPC MI peephole optimization.

3 years agoFix de6caf871be79dc7549aebe4e4fb57d52f6ed202
Walter Erquinigo [Wed, 2 Sep 2020 21:46:20 +0000 (14:46 -0700)]
Fix de6caf871be79dc7549aebe4e4fb57d52f6ed202

Failure found in
http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/16855

The issue is a header not being included

3 years ago[VectorCombine][SVE] Do not fold bitcast shuffle for scalable type.
Huihui Zhang [Wed, 2 Sep 2020 22:02:04 +0000 (15:02 -0700)]
[VectorCombine][SVE] Do not fold bitcast shuffle for scalable type.

First, shuffle cost for scalable type is not known for scalable type;
Second, we cannot reason if the narrowed shuffle mask for scalable type
is a splat or not.

E.g., Bitcast splat vector from type <vscale x 4 x i32> to <vscale x 8 x i16>
will involve narrowing shuffle mask <vscale x 4 x i32> zeroinitializer to
<vscale x 8 x i32> with element sequence of <0, 1, 0, 1, ...>, which cannot be
reasoned if it's a valid splat or not.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D86995

3 years agoImprove error handling for SmallVector programming errors
Geoffrey Martin-Noble [Wed, 2 Sep 2020 22:00:26 +0000 (15:00 -0700)]
Improve error handling for SmallVector programming errors

This patch changes errors in `SmallVector::grow` that are independent of
memory capacity to be reported using report_fatal_error or
std::length_error instead of report_bad_alloc_error, which falsely signals
an OOM.

It also cleans up a few related things:
- makes report_bad_alloc_error to print the failure reason passed
  to it.
- fixes the documentation to indicate that report_bad_alloc_error
  calls `abort()` not "an assertion"
- uses a consistent name for the size/capacity argument to `grow`
  and `grow_pod`

Reviewed By: mehdi_amini, MaskRay

Differential Revision: https://reviews.llvm.org/D86892

3 years agoUse an Identifier instead of an OperationName internally for OpPassManager identifica...
Mehdi Amini [Wed, 2 Sep 2020 20:09:07 +0000 (20:09 +0000)]
Use an Identifier instead of an OperationName internally for OpPassManager identification (NFC)

This allows to defers the check for traits to the execution instead of forcing it on the pipeline creation.
In particular, this is making our pipeline creation tolerant to dialects not being loaded in the context yet.

Reviewed By: rriddle, GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D86915

3 years ago[mlir][Affine] Support affine vector loads/stores in LICM
Diego Caballero [Wed, 2 Sep 2020 21:29:04 +0000 (00:29 +0300)]
[mlir][Affine] Support affine vector loads/stores in LICM

Make use of affine memory op interfaces in AffineLoopInvariantCodeMotion so
that it can also work on affine.vector_load and affine.vector_store ops.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D86986

3 years ago[ThinLTO] Fix a metadata lost issue with DICompileUnit import.
Hongtao Yu [Wed, 2 Sep 2020 16:51:30 +0000 (09:51 -0700)]
[ThinLTO] Fix a metadata lost issue with DICompileUnit import.

For ThinLTO importing we don't need to import all the fields of the DICompileUnit, such as enums, macros, retained types lists. The importation of those fields were previously disabled by setting their value map entries to nullptr. Unfortunately a metadata node can be shared by multiple metadata operands. Setting the map entry to nullptr might result in not importing other metadata unexpectedly.  The issue is fixed by explicitly setting the original DICompileUnit fields (still a copy of the source module metadata) to null.

Reviewed By: wenlei, dblaikie

Differential Revision: https://reviews.llvm.org/D86675

3 years agorun in terminal
Walter Erquinigo [Wed, 2 Sep 2020 01:52:14 +0000 (18:52 -0700)]
run in terminal

3 years ago[scudo][standalone] Enable secondary cache release on Fuchsia
Kostya Kortchinsky [Fri, 28 Aug 2020 18:44:39 +0000 (11:44 -0700)]
[scudo][standalone] Enable secondary cache release on Fuchsia

I had left this as a TODO, but it turns out it wasn't complicated.
By specifying `MAP_RESIZABLE`, it allows us to keep the VMO which we
can then use for release purposes.
`releasePagesToOS` also had to be called the "proper" way, as Fuchsia
requires the `Offset` field to be correct. This has no impact on
non-Fuchsia platforms.

Differential Revision: https://reviews.llvm.org/D86800

3 years agoPerform an extra consistency check when searching ModuleManager's
Adrian Prantl [Wed, 2 Sep 2020 20:48:44 +0000 (13:48 -0700)]
Perform an extra consistency check when searching ModuleManager's
cache for implicit modules.

The ModuleManager's use of FileEntry nodes as the keys for its map of
loaded modules is less than ideal. Uniqueness for FileEntry nodes is
maintained by FileManager, which in turn uses inode numbers on hosts
that support that. When coupled with the module cache's proclivity for
turning over and deleting stale PCMs, this means entries for different
module files can wind up reusing the same underlying inode. When this
happens, subsequent accesses to the Modules map will disagree on the
ModuleFile associated with a given file.

In general, it is not sufficient to resolve this conundrum with a type
like FileEntryRef that stores the name of the FileEntry node on first
access because of path canonicalization issues. However, the paths
constructed for implicit module builds are fully under Clang's
control. We *can*, therefore, rely on their structure being consistent
across operating systems and across subsequent accesses to the Modules
map.

To mitigate the effects of inode reuse, perform an extra name check when
implicit modules are returned from the cache. This has the effect of
forcing reused FileEntry nodes to stomp over existing-but-stale entries
in the cache, which simulates a miss - exactly the desired behavior.

rdar://48443680

Patch by Robert Widmann!

Differential Revision: https://reviews.llvm.org/D86823

3 years agoRevert "[clang] Add missing .def files to Clang's modulemap"
Adrian Prantl [Wed, 2 Sep 2020 21:14:26 +0000 (14:14 -0700)]
Revert "[clang] Add missing .def files to Clang's modulemap"

This reverts commit e0e7eb2e2648aee83caf2ecfe2972ce2f653d306.

[the commit this fixes up was reverted]

3 years ago[mlir][Affine] Fix AffineLoopInvariantCodeMotion
Diego Caballero [Wed, 2 Sep 2020 19:26:57 +0000 (22:26 +0300)]
[mlir][Affine] Fix AffineLoopInvariantCodeMotion

Make sure that memory ops that are defined inside the loop are registered
as such in 'defineOp'. In the test provided, the 'mulf' op was hoisted
outside the loop nest even when its 'affine.load' operand was not.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D86982

3 years ago[PowerPC] Do not legalize vector FDIV without VSX
Nemanja Ivanovic [Wed, 2 Sep 2020 20:30:19 +0000 (15:30 -0500)]
[PowerPC] Do not legalize vector FDIV without VSX

Quite a while ago, we legalized these nodes as we added custom
handling for reciprocal estimates in the back end. We have since
moved to target-independent combines but neglected to turn off
legalization. As a result, we can now get selection failures on
non-VSX subtargets as evidenced in the listed PR.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=47373

3 years ago[APInt] New member function setBitVal
Jay Foad [Wed, 2 Sep 2020 15:14:58 +0000 (16:14 +0100)]
[APInt] New member function setBitVal

Differential Revision: https://reviews.llvm.org/D87033

3 years ago[PowerPC] Update MemorySanitizer test to cater for number of CPUs > 1024
Ahsan Saghir [Wed, 2 Sep 2020 19:13:23 +0000 (14:13 -0500)]
[PowerPC] Update MemorySanitizer test to cater for number of CPUs > 1024

MemorySanitizer test fails on systems with more than 1024 CPUs.
This patch updates the test to make it work for machines that
have more than 1024 CPUs. This helps to fix errors on the PowerPC
sanitizer bot.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D87053

3 years agoRevert "[HIP] Change default --gpu-max-threads-per-block value to 1024"
Yaxun (Sam) Liu [Wed, 2 Sep 2020 18:53:06 +0000 (14:53 -0400)]
Revert "[HIP] Change default --gpu-max-threads-per-block value to 1024"

Temporarily revert commit 04abbb3a78186aa92809866b43217c32cba90b71
due to regressions in some HIP apps due backend issues revealed by
this change.

Will re-commit it when backend issues are fixed.

3 years ago[flang] Implement nonstandard OPEN statement CARRIAGECONTROL specifier
peter klausler [Wed, 2 Sep 2020 17:37:48 +0000 (10:37 -0700)]
[flang] Implement nonstandard OPEN statement CARRIAGECONTROL specifier

Differential Revision: https://reviews.llvm.org/D87052

3 years agoMake sure that llvm-ml uses MASM integer lexing when in --as-lex mode
Eric Astor [Wed, 2 Sep 2020 20:03:01 +0000 (16:03 -0400)]
Make sure that llvm-ml uses MASM integer lexing when in --as-lex mode

3 years ago[libcxx] Fix whitespace error
Michael Schellenberger Costa [Wed, 2 Sep 2020 19:42:56 +0000 (21:42 +0200)]
[libcxx] Fix whitespace error

3 years ago[lldb/test] Fix TestPlatform*.py Windows failures (NFC)
Med Ismail Bennani [Wed, 2 Sep 2020 19:31:09 +0000 (21:31 +0200)]
[lldb/test] Fix TestPlatform*.py Windows failures (NFC)

This patch fixes the windows failures introduced by `addb514`:
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/18671/steps/test/logs/stdio

This macro, used in the test to check the platform, was missing a `_`,
making the test behave like it was run from a UNIX platform.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[libTooling] Restore defaults for matchers in makeRule.
Yitzhak Mandelbaum [Wed, 2 Sep 2020 18:47:29 +0000 (18:47 +0000)]
[libTooling] Restore defaults for matchers in makeRule.

This patch restores the default traversal for Transformer's `makeRule` to
`TK_AsIs`. The implicit mode has proven problematic.

Differential Revision: https://reviews.llvm.org/D87048

3 years ago[GCDAProfiling] Suppress -Wprio-ctor-dtor for GCC>=9 and remove unused write_string...
Fangrui Song [Wed, 2 Sep 2020 19:21:06 +0000 (12:21 -0700)]
[GCDAProfiling] Suppress -Wprio-ctor-dtor for GCC>=9 and remove unused write_string/length_of_string

The `__attribute__((destructor(100)))` diagnostic does not have a
warning option in GCC 8 (before r264853) and thus cannot be suppressed.

3 years agoAdd constexpr to pair
Michael Schellenberger Costa [Wed, 2 Sep 2020 19:20:33 +0000 (21:20 +0200)]
Add constexpr to pair

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D80558

3 years ago[PowerPC] Implemented Vector Multiply Builtins
Albion Fung [Wed, 2 Sep 2020 19:16:09 +0000 (14:16 -0500)]
[PowerPC] Implemented Vector Multiply Builtins

This patch implements the builtins for Vector Multiply Builtins (vmulxxd family of instructions), and adds the appropriate test cases for these builtins. The builtins utilize the vector multiply instructions itnroduced with ISA 3.1.

Differential Revision:  https://reviews.llvm.org/D83955

3 years agoStore an Identifier instead of a StringRef for the OperationName inside an AbstractOp...
Mehdi Amini [Wed, 2 Sep 2020 19:10:36 +0000 (19:10 +0000)]
Store an Identifier instead of a StringRef for the OperationName inside an AbstractOperation (NFC)

Instead of storing a StringRef, we keep an Identifier which otherwise requires a lock on the context to retrieve.
This will allow to get an Identifier for any registered Operation for "free".

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D86994

3 years agoFix a -Wparenthesis warning in 8ff44e644bb7, NFC
Erik Pilkington [Wed, 2 Sep 2020 17:30:27 +0000 (13:30 -0400)]
Fix a -Wparenthesis warning in 8ff44e644bb7, NFC

3 years ago[AST] Fix handling of long double and bool in __builtin_bit_cast
Erik Pilkington [Wed, 2 Sep 2020 16:23:17 +0000 (12:23 -0400)]
[AST] Fix handling of long double and bool in __builtin_bit_cast

On x86, long double has 6 unused trailing bytes. This patch changes the
constant evaluator to treat them as though they were padding bytes, so reading
from them results in an indeterminate value, and nothing is written for them.
Also, fix a similar bug with bool, but instead of treating the unused bits as
padding, enforce that they're zero.

Differential revision: https://reviews.llvm.org/D76323

3 years ago[clang] Add missing .def files to Clang's modulemap
Raphael Isemann [Wed, 2 Sep 2020 16:01:18 +0000 (18:01 +0200)]
[clang] Add missing .def files to Clang's modulemap

These new .def files weren't marked as textual so they ended up being compiled
into the Clang module (which completely defeats the purpose of .def files).

3 years ago[gn build] Fix COMPILER_RT_HAS_* defines for libclang_rt.profile
Nico Weber [Wed, 2 Sep 2020 18:28:42 +0000 (14:28 -0400)]
[gn build] Fix COMPILER_RT_HAS_* defines for libclang_rt.profile

The cmake build uses COMPILER_RT_TARGET_HAS_* in the CMakeLists.txt
but then translates it to -DCOMPILER_RT_HAS_* flags which the
c++ code checks for. So we need to define the latter, not the former.

3 years ago[TSan][libdispatch] Fix compilation error on Linux
Julian Lettner [Wed, 2 Sep 2020 18:20:47 +0000 (11:20 -0700)]
[TSan][libdispatch] Fix compilation error on Linux

The interceptor for the block variants of the API references the
function versions (via `REAL(name##_f)`).  On Linux, this accesses the
underlying "real pointer", defined by the interceptor macro.  So we need
to declare interceptors in the right order to avoid undefined symbol
compiler error:
```
error: no member named 'real_dispatch_async_and_wait_f' in namespace '__tsan::__interception'
```

rdar://68181542

3 years agoRevert "Move all fields of '-cc1' option related classes into def file databases"
Douglas Yung [Wed, 2 Sep 2020 17:35:42 +0000 (10:35 -0700)]
Revert "Move all fields of '-cc1' option related classes into def file databases"

This reverts commit c4a2a1307484cffe94a291c42572775411bac8d8.

This commit was causing a test failure: http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/1068

3 years ago[Bindings] Move LLVMAddInstructionSimplifyPass to Scalar.cpp
Arthur Eubanks [Wed, 2 Sep 2020 16:22:50 +0000 (09:22 -0700)]
[Bindings] Move LLVMAddInstructionSimplifyPass to Scalar.cpp

Should not be with the pass, but alongside all the other C bindings.

Reviewed By: sroland

Differential Revision: https://reviews.llvm.org/D87041

3 years ago[clang-format] Parse double-square attributes as pointer qualifiers
Alex Richardson [Wed, 2 Sep 2020 16:44:00 +0000 (17:44 +0100)]
[clang-format] Parse double-square attributes as pointer qualifiers

Before: x = (foo *[[clang::attr]]) * v;
After:  x = (foo *[[clang::attr]])*v;

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D86721

3 years ago[flang] Support multiple CookedSource instances
peter klausler [Mon, 31 Aug 2020 19:22:24 +0000 (12:22 -0700)]
[flang] Support multiple CookedSource instances

These are owned by an instance of a new class AllCookedSources.

This removes the need for a Scope to own a string containing
a module's cooked source stream, and will enable errors to be
emitted when parsing module files in the future.

Differential Revision: https://reviews.llvm.org/D86891

3 years ago[AMDGPU][MC] Corrected parser to avoid generation of excessive error messages
Dmitry Preobrazhensky [Wed, 2 Sep 2020 16:42:18 +0000 (19:42 +0300)]
[AMDGPU][MC] Corrected parser to avoid generation of excessive error messages

Summary of changes:
- Changed parser to eliminate generation of excessive error messages;
- Corrected lit tests to match all expected error messages;
- Corrected lit tests to guard against unwanted extra messages (added option "--implicit-check-not=error:");
- Added missing checks and fixed some typos in tests.

See bug 46907: https://bugs.llvm.org/show_bug.cgi?id=46907

Reviewers: arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D86940

3 years ago[flang] Make -fget-symbols-sources output deterministic
peter klausler [Tue, 1 Sep 2020 23:55:43 +0000 (16:55 -0700)]
[flang] Make -fget-symbols-sources output deterministic

The DumpSymbolsSources() routine ordered its output by the addresses
of the names of the symbols, and was susceptible to variation across
environments.  Fixed by using a multimap using the values of the names.

Differential Revision: https://reviews.llvm.org/D87035

3 years ago[libc++] Remove definition of _LIBCPP_ALIGNOF for GCC in C++03 mode
Louis Dionne [Wed, 2 Sep 2020 16:29:42 +0000 (12:29 -0400)]
[libc++] Remove definition of _LIBCPP_ALIGNOF for GCC in C++03 mode

That definition is known to be potentially incorrect, and we don't support
GCC in C++03 mode anyway.

3 years ago[libc++] Fix incorrect usage of __STDC_HOSTED__
hyd-dev [Wed, 2 Sep 2020 16:22:29 +0000 (12:22 -0400)]
[libc++] Fix incorrect usage of __STDC_HOSTED__

D56913 introduced the _LIBCPP_FREESTANDING macro and guarded its
definition by:

#ifndef __STDC_HOSTED__
#  define _LIBCPP_FREESTANDING
#endif

However, __STDC_HOSTED__ is defined as 0 in freestanding implementations
instead of undefined, which means that _LIBCPP_FREESTANDING would never
get defined. This patch corrects the above as:

#if __STDC_HOSTED__ == 0
#  define _LIBCPP_FREESTANDING
#endif

Differential Revision: https://reviews.llvm.org/D86055

3 years ago[libc++] Re-apply the workaround for timespec_get not always being available in Apple...
Louis Dionne [Wed, 2 Sep 2020 14:36:48 +0000 (10:36 -0400)]
[libc++] Re-apply the workaround for timespec_get not always being available in Apple SDKs

This commit re-applies 99f3b231cb21, which was reverted in 814242572731
because it broke the modules build. The modules failure was a circular
dependency between the Darwin module and __config. Specifically, the
issue was that if <__config> includes a system header, the std_config
module depends on the Darwin module. However, the Darwin module already
depends on the std_config header because some of its headers include
libc++ headers like <ctype.h> (they mean to include the C <ctype.h>,
but libc++ headers are first in the header search path).

This is fixed by moving the workaround to <ctime> only.

https://llvm.org/PR47208
rdar://68157284

3 years agoMake -fvisibility-inlines-hidden apply to static local variables in inline functions...
Erik Pilkington [Wed, 2 Sep 2020 00:17:00 +0000 (20:17 -0400)]
Make -fvisibility-inlines-hidden apply to static local variables in inline functions on Darwin

This effectively disables r340386 on Darwin, and provides a command line flag
to opt into/out of this behaviour. This change is needed to compile certain
Apple headers correctly.

rdar://47688592

Differential revision: https://reviews.llvm.org/D86881

3 years ago[IRGen] Fix an assert when __attribute__((used)) is used on an ObjC method
Erik Pilkington [Tue, 1 Sep 2020 15:52:28 +0000 (11:52 -0400)]
[IRGen] Fix an assert when __attribute__((used)) is used on an ObjC method

This assert doesn't really make sense for functions in general, since they
start life as declarations, and there isn't really any reason to require them
to be defined before attributes are applied to them.

rdar://67895846

3 years ago[ms] [llvm-ml] Add support for line continuations in MASM
Eric Astor [Wed, 2 Sep 2020 16:11:29 +0000 (12:11 -0400)]
[ms] [llvm-ml] Add support for line continuations in MASM

Add support for line continuations (the "backslash operator") in MASM by modifying the Parser's Lex method.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D83347

3 years ago[X86][SSE] Fold vselect(pshufb,pshufb) -> or(pshufb,pshufb)
Simon Pilgrim [Wed, 2 Sep 2020 15:53:41 +0000 (16:53 +0100)]
[X86][SSE] Fold vselect(pshufb,pshufb) -> or(pshufb,pshufb)

If the PSHUFBs have no other uses, then we can force the unselected elements to zero to OR them instead, avoiding both an extra mask load and a costly variable blend.

Eventually we should try to bring this into shuffle combining, once we can more easily convert between shuffles + select patterns.

3 years ago[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks
Ehsan Toosi [Fri, 31 Jul 2020 13:20:37 +0000 (15:20 +0200)]
[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks

In this PR, the users of BufferPlacement can configure
BufferAssginmentTypeConverter. These new configurations would give the user more
freedom in the process of converting function signature, and return and call
operation conversions.

These are the new features:
    - Accepting callback functions for decomposing types (i.e. 1 to N type
    conversion such as unpacking tuple types).
    - Defining ResultConversionKind for specifying whether a function result
    with a certain type should be appended to the function arguments list or
    should be kept as function result. (Usage:
    converter.setResultConversionKind<MemRefType>(AppendToArgumentList))
    - Accepting callback functions for composing or decomposing values (i.e. N
    to 1 and 1 to N value conversion).

Differential Revision: https://reviews.llvm.org/D85133

3 years ago[lldb/Host] Add missing proc states
Jordan Rupprecht [Wed, 2 Sep 2020 15:24:06 +0000 (08:24 -0700)]
[lldb/Host] Add missing proc states

The /proc/<pid>/status parsing is missing a few cases:
- Idle
- Parked
- Dead

If we encounter an unknown proc state, this leads to an msan warning. In reality, we only check that the state != Zombie, so it doesn't really matter that we handle all cases, but handle them anyway (current list: [1]). Also explicitly set it to unknown if we encounter an unknown state. There will still be an msan warning if the proc entry has no `State:` line, but that should not happen.

Use a StringSwitch to make the handling of proc states a little more compact.

[1] https://github.com/torvalds/linux/blob/master/fs/proc/array.c

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D86818

3 years ago[IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is...
Congzhe Cao [Wed, 2 Sep 2020 15:02:58 +0000 (11:02 -0400)]
[IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is optimized to return undef

In IPSCCP when a function is optimized to return undef, it should clear the returned attribute for all its input arguments
and its corresponding call sites.

The bug is exposed when the value of an input argument of the function is assigned to a physical register and
because of the argument having a returned attribute, the value of this physical register will continue to be used
as the function return value right after the call instruction returns, even if the value that this register holds may
be clobbered during the function call. This potentially results in incorrect values being used afterwards.

Reviewed By: jdoerfert, fhahn

Differential Revision: https://reviews.llvm.org/D84220

3 years ago[NFC] [PowerPC] Add FMA flag propagation test
Qiu Chaofan [Wed, 2 Sep 2020 15:09:48 +0000 (23:09 +0800)]
[NFC] [PowerPC] Add FMA flag propagation test

3 years ago[lldb/Target] Add custom interpreter option to `platform shell`
Med Ismail Bennani [Fri, 28 Aug 2020 13:38:39 +0000 (15:38 +0200)]
[lldb/Target] Add custom interpreter option to `platform shell`

This patch adds the ability to use a custom interpreter with the
`platform shell` command. If the user set the `-s|--shell` option
with the path to a binary, lldb passes it down to the platform's
`RunShellProcess` method and set it as the shell to use in
`ProcessLaunchInfo to run commands.

Note that not all the Platforms support running shell commands with
custom interpreters (i.e. RemoteGDBServer is only expected to use the
default shell).

This patch also makes some refactoring and cleanups, like swapping
CString for StringRef when possible and updating `SBPlatformShellCommand`
with new methods and a new constructor.

rdar://67759256

Differential Revision: https://reviews.llvm.org/D86667

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[ImplicitNullChecks] NFC: Refactor dependence safety check
Anna Thomas [Wed, 2 Sep 2020 14:19:10 +0000 (10:19 -0400)]
[ImplicitNullChecks] NFC: Refactor dependence safety check

After computing dependence, we check if it is safe to hoist by
identifying if it clobbers any liveIns in the sibling block (NullSucc).
This check is moved to its own function which will be used in the
soon-to-be modified dependence checking algorithm for implicit null
checks pass.

Tests-Run: lit tests on X86/implicit-*

3 years ago[ImplicitNullChecks] NFC: Separated out checks and added comments
Anna Thomas [Wed, 2 Sep 2020 14:06:27 +0000 (10:06 -0400)]
[ImplicitNullChecks] NFC: Separated out checks and added comments

Separated out some checks in isSuitableMemoryOp and added comments
explaining why some of those checks are done.

Tests-Run:X86 implicit null checks tests.

3 years ago[libc++] Make some testing utilities constexpr
Louis Dionne [Tue, 1 Sep 2020 21:13:24 +0000 (17:13 -0400)]
[libc++] Make some testing utilities constexpr

This will be needed in order to test constexpr std::vector.

3 years agoRevert "[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks"
Lei Zhang [Wed, 2 Sep 2020 13:24:36 +0000 (09:24 -0400)]
Revert "[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks"

This reverts commit 94f5d248772ba0f1f9c8b0746fe75a5d246c5540 because
of failing the following tests:

MLIR :: Dialect/Linalg/tensors-to-buffers.mlir
MLIR :: Transforms/buffer-placement-preparation-allowed-memref-results.mlir
MLIR :: Transforms/buffer-placement-preparation.mlir

3 years ago[GlobalOpt] Fix an incorrect Modified status
David Stenberg [Wed, 2 Sep 2020 06:46:53 +0000 (08:46 +0200)]
[GlobalOpt] Fix an incorrect Modified status

When marking a global variable constant, and simplifying users using
CleanupConstantGlobalUsers(), the pass could incorrectly return false if
there were still some uses left, and no further optimizations was done.

This was caught using the check introduced by D80916.

This fixes PR46749.

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D85837

3 years ago[mlir][VectorToSCF] 128 byte alignment of alloc ops
Jakub Lichman [Wed, 26 Aug 2020 16:41:04 +0000 (16:41 +0000)]
[mlir][VectorToSCF] 128 byte alignment of alloc ops

Added 128 byte alignment to alloc ops created in VectorToSCF pass.
128b alignment was already introduced to this pass but not to all alloc
ops. This commit changes that by adding 128b alignment to the remaining ops.
The point of specifying alignment is to prevent possible memory alignment errors
on weakly tested architectures.

Differential Revision: https://reviews.llvm.org/D86454

3 years ago[InstCombine] Transform 1.0/sqrt(X) * X to X/sqrt(X)
Venkataramanan Kumar [Wed, 2 Sep 2020 12:23:48 +0000 (08:23 -0400)]
[InstCombine] Transform 1.0/sqrt(X) * X to X/sqrt(X)

These transforms will now be performed irrespective of the number of uses for the expression "1.0/sqrt(X)":
1.0/sqrt(X) * X => X/sqrt(X)
X * 1.0/sqrt(X) => X/sqrt(X)

We already handle more general cases, and we are intentionally not creating extra (and likely expensive)
fdiv ops in IR. This pattern is the exception to the rule because we always expect the Backend to reduce
X/sqrt(X) to sqrt(X), if it has the necessary (reassoc) fast-math-flags.

Ref: DagCombiner optimizes the X/sqrt(X) to sqrt(X).

Differential Revision: https://reviews.llvm.org/D86726

3 years ago[VectorCombine] allow vector loads with mismatched insert type
Sanjay Patel [Wed, 2 Sep 2020 12:09:24 +0000 (08:09 -0400)]
[VectorCombine] allow vector loads with mismatched insert type

This is an enhancement to D81766 to allow loading the minimum target
vector type into an IR vector with a different number of elements.

In one of the motivating tests from PR16739, SLP creates <2 x float>
load ops mixed with <4 x float> insert ops, so we want to handle that
pattern in addition to potential oversized vectors created by the
vectorizers.

For now, we are assuming the insert/extract subvector with undef is
free because there is no exact corresponding TTI modeling for that.

Differential Revision: https://reviews.llvm.org/D86160

3 years agoMove all fields of '-cc1' option related classes into def file databases
Daniel Grumberg [Wed, 19 Aug 2020 15:16:43 +0000 (16:16 +0100)]
Move all fields of '-cc1' option related classes into def file databases

Once the new option parsing system is committed, this will allow to generate a
check to ensure that correct command line generation happens

Differential Revision: https://reviews.llvm.org/D86290

3 years ago[Test] Simplify test by removing unneeded variable
Max Kazantsev [Wed, 2 Sep 2020 11:26:11 +0000 (18:26 +0700)]
[Test] Simplify test by removing unneeded variable

3 years ago[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks
Ehsan Toosi [Fri, 31 Jul 2020 13:20:37 +0000 (15:20 +0200)]
[mlir] Extend BufferAssignmentTypeConverter with result conversion callbacks

In this PR, the users of BufferPlacement can configure
BufferAssginmentTypeConverter. These new configurations would give the user more
freedom in the process of converting function signature, and return and call
operation conversions.

These are the new features:
    - Accepting callback functions for decomposing types (i.e. 1 to N type
    conversion such as unpacking tuple types).
    - Defining ResultConversionKind for specifying whether a function result
    with a certain type should be appended to the function arguments list or
    should be kept as function result. (Usage:
    converter.setResultConversionKind<MemRefType>(AppendToArgumentList))
    - Accepting callback functions for composing or decomposing values (i.e. N
    to 1 and 1 to N value conversion).

Differential Revision: https://reviews.llvm.org/D85133

3 years ago[SVE] Don't reorder subvector/binop sequences when the resulting binop is not legal.
Paul Walker [Fri, 21 Aug 2020 12:38:55 +0000 (13:38 +0100)]
[SVE] Don't reorder subvector/binop sequences when the resulting binop is not legal.

When lowering fixed length vector operations for SVE the subvector
operations are used extensively to marshall data between scalable
and fixed-length vectors. This means that sequences like:

  extract_subvec(binop(insert_subvec(a), insert_subvec(b)))

are very common. DAGCombine only checks if the resulting binop is
legal or can be custom lowered when undoing such sequences. When
it's custom lowering that is introducing them the result is an
infinite legalise->combine->legalise loop.

This patch extends the isOperationLegalOr... functions to include
a "LegalOnly" parameter to restrict the check to legal operations
only. Although isOperationLegal could be used it's common for
the affected code paths to be visited pre and post legalisation,
so the extra parameter keeps the code tidy.

Differential Revision: https://reviews.llvm.org/D86450

3 years ago[AMDGPU] Fix offset for REL32_HI relocs
Jay Foad [Tue, 1 Sep 2020 13:52:01 +0000 (14:52 +0100)]
[AMDGPU] Fix offset for REL32_HI relocs

The addend in a REL32 reloc needs to be adjusted to account for the
offset from the PC value returned by the s_getpc instruction to the
point where the reloc is applied. This was being done correctly for
(GOTPC)REL32_LO but not for (GOTPC)REL32_HI. This will only make a
difference if the target symbol happens to get loaded almost exactly
a multiple of 4G away from the relocated instructions.

Differential Revision: https://reviews.llvm.org/D86938