platform/upstream/llvm.git
3 years agoMake namespace handling uniform across dialect backends.
Federico Lebrón [Mon, 14 Sep 2020 20:01:07 +0000 (20:01 +0000)]
Make namespace handling uniform across dialect backends.

Now backends spell out which namespace they want to be in, instead of relying on
clients #including them inside already-opened namespaces. This also means that
cppNamespaces should be fully qualified, and there's no implicit "::mlir::"
prepended to them anymore.

Reviewed By: mehdi_amini

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

3 years ago[Asan] Fix false leak report
Vitaly Buka [Mon, 14 Sep 2020 20:32:14 +0000 (13:32 -0700)]
[Asan] Fix false leak report

If user thread is in the allocator, the allocator
may have no pointer into future user's part of
the allocated block. AddrIsInside ignores such
pointers and lsan reports a false memory leak.

Reviewed By: morehouse

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

3 years ago[docs][NewPM] Add docs for writing NPM passes
Arthur Eubanks [Tue, 1 Sep 2020 01:36:11 +0000 (18:36 -0700)]
[docs][NewPM] Add docs for writing NPM passes

As to not conflict with the legacy PM example passes under
llvm/lib/Transforms/Hello, this is under HelloNew. This makes the
CMakeLists.txt and general directory structure less confusing for people
following the example.

Much of the doc structure was taken from WritinAnLLVMPass.rst.

This adds a HelloWorld pass which simply prints out each function name.

More will follow after this, e.g. passes over different units of IR, analyses.
https://llvm.org/docs/WritingAnLLVMPass.html contains a lot more.

Reviewed By: ychen, asbirlea

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

3 years ago[gn build] Port 226d80ebe20
LLVM GN Syncbot [Mon, 14 Sep 2020 20:16:21 +0000 (20:16 +0000)]
[gn build] Port 226d80ebe20

3 years ago[MemProf] Rename HeapProfiler to MemProfiler for consistency
Teresa Johnson [Mon, 14 Sep 2020 16:12:13 +0000 (09:12 -0700)]
[MemProf] Rename HeapProfiler to MemProfiler for consistency

This is consistent with the clang option added in
7ed8124d46f94601d5f1364becee9cee8538265e, and the comments on the
runtime patch in D87120.

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

3 years ago[libc++] Add comment in atomic test to explain why part of it is disabled on Apple
Louis Dionne [Mon, 14 Sep 2020 20:12:47 +0000 (16:12 -0400)]
[libc++] Add comment in atomic test to explain why part of it is disabled on Apple

3 years ago[FastISel] Bail out of selectGetElementPtr for vector GEPs.
Craig Topper [Mon, 14 Sep 2020 19:52:54 +0000 (12:52 -0700)]
[FastISel] Bail out of selectGetElementPtr for vector GEPs.

The code that decomposes the GEP into ADD/MUL doesn't work properly
for vector GEPs. It can create bad COPY instructions or possibly
assert.

For now just bail out to SelectionDAG.

Fixes PR45906

3 years ago[ELF] Add documentation for --warn-backrefs: a GNU ld compatibility checking tool...
Fangrui Song [Tue, 8 Sep 2020 18:37:03 +0000 (11:37 -0700)]
[ELF] Add documentation for --warn-backrefs: a GNU ld compatibility checking tool (and lesser of layering detection)

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

3 years ago[PowerPC] Implement Thread Local Storage Support for Local Exec
Kamau Bridgeman [Fri, 11 Sep 2020 14:33:33 +0000 (10:33 -0400)]
[PowerPC] Implement Thread Local Storage Support for Local Exec

This patch is the initial support for the Local Exec Thread Local
Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.

Patch by: Kamau Bridgeman

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

3 years ago[AArch64] Add additional vecreduce fmax/fmin legalization tests (NFC)
Nikita Popov [Mon, 14 Sep 2020 19:11:56 +0000 (21:11 +0200)]
[AArch64] Add additional vecreduce fmax/fmin legalization tests (NFC)

Add a vector widening test with ninf flag to the existing fmax
tests, and mirror them over into fmin tests.

3 years ago[libc++] Use LLVM 11 instead of trunk on build bots
Louis Dionne [Mon, 14 Sep 2020 19:12:13 +0000 (15:12 -0400)]
[libc++] Use LLVM 11 instead of trunk on build bots

Somehow the snapshot of LLVM trunk we use was seeing failures.

3 years ago[libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.
Tue Ly [Fri, 11 Sep 2020 14:33:33 +0000 (10:33 -0400)]
[libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.

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

3 years ago[Legalize][ARM][X86] Add float legalization for VECREDUCE
Nikita Popov [Sat, 12 Sep 2020 20:38:51 +0000 (22:38 +0200)]
[Legalize][ARM][X86] Add float legalization for VECREDUCE

This adds SoftenFloatRes, PromoteFloatRes and SoftPromoteHalfRes
legalizations for VECREDUCE, to fill the remaining hole in the SDAG
legalization. These legalizations simply expand the reduction and
let it be recursively legalized. For the PromoteFloatRes case at
least it is possible to do better than that, but it's pretty tricky
(because we need to consider the interaction of three different
vector legalizations and the type promotion) and probably not
really worthwhile.

I haven't added ExpandFloatRes support, as I am not familiar with
ppc_fp128.

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

3 years ago[ARM] Add more tests for vecreduce soft float legalization (NFC)
Nikita Popov [Mon, 14 Sep 2020 18:37:28 +0000 (20:37 +0200)]
[ARM] Add more tests for vecreduce soft float legalization (NFC)

This mirrors the existing fadd tests to fmul, fmin and fmax.

3 years ago[ms] [llvm-ml] Add basic support for SEH, including PROC FRAME
Eric Astor [Mon, 14 Sep 2020 18:32:33 +0000 (14:32 -0400)]
[ms] [llvm-ml] Add basic support for SEH, including PROC FRAME

Add basic support for SEH, including PROC FRAME

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Add support for size queries in MASM
Eric Astor [Mon, 14 Sep 2020 18:25:39 +0000 (14:25 -0400)]
[ms] [llvm-ml] Add support for size queries in MASM

Add support for size inference, sizeof, typeof, and lengthof.

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Fix struct padding logic
Eric Astor [Mon, 14 Sep 2020 18:11:29 +0000 (14:11 -0400)]
[ms] [llvm-ml] Fix struct padding logic

MASM structs are end-padded to have size a multiple of the smaller of the requested alignment and the size of their largest field (taken recursively, if they have a field of STRUCT type).

This matches the behavior of ml.exe and ml64.exe. Our original implementation followed the MASM 6.0 documentation, which instead specified that MASM structs were padded to a multiple of their requested alignment.

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Add missing built-in type aliases
Eric Astor [Mon, 14 Sep 2020 18:07:33 +0000 (14:07 -0400)]
[ms] [llvm-ml] Add missing built-in type aliases

Add signed aliases for integral types, as well as the "DF" abbreviation for the FWORD type.

Reviewed By: thakis

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

3 years ago[InstCombine] Simplify select operand based on equality condition
Nikita Popov [Thu, 10 Sep 2020 16:45:53 +0000 (18:45 +0200)]
[InstCombine] Simplify select operand based on equality condition

For selects of the type X == Y ? A : B, check if we can simplify A
by using the X == Y equality and replace the operand if that's
possible. We already try to do this in InstSimplify, but will only
fold if the result of the simplification is the same as B, in which
case the select can be dropped entirely. Here the select will be
retained, just one operand simplified.

As we are performing an actual replacement here, we don't have
problems with refinement / poison values.

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

3 years ago[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX
Nikita Popov [Sat, 12 Sep 2020 22:12:30 +0000 (00:12 +0200)]
[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX

Similar to D87415, this folds the various float min/max opcodes
with a constant INF or -INF operand, or FLT_MAX / -FLT_MAX operand
if the ninf flag is set. Some of the folds are only possible under
nnan.

The fminnum(X, INF) with nnan and fmaxnum(X, -INF) with nnan cases
are needed to improve the VECREDUCE_FMIN/FMAX lowerings on X86,
the rest is here for the sake of completeness.

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

3 years agoFix 132e57bc597bd3f50174b7d286c43f76b47f11c1
Walter Erquinigo [Mon, 14 Sep 2020 17:53:48 +0000 (10:53 -0700)]
Fix 132e57bc597bd3f50174b7d286c43f76b47f11c1

Compile error found in
http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/17403/steps/build/logs/stdio

Simple fix

3 years ago[libc++] Upgrade the Clang on build bots
Louis Dionne [Mon, 14 Sep 2020 17:51:23 +0000 (13:51 -0400)]
[libc++] Upgrade the Clang on build bots

3 years agoRetry of D84974
Walter Erquinigo [Wed, 2 Sep 2020 01:52:14 +0000 (18:52 -0700)]
Retry of D84974

- Fix a small issue caused by a conflicting name (GetObject) on Windows.
  The fix was to rename the internal GetObject function to
  GetNextFunction.

3 years agocollectBitParts - use const references. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 17:16:17 +0000 (18:16 +0100)]
collectBitParts - use const references. NFCI.

Fixes clang-tidy warnings first noticed on D87452.

3 years agoLet -basic-block-sections=labels emit basicblock metadata in a new .bb_addr_map secti...
Rahman Lavaee [Mon, 14 Sep 2020 17:16:44 +0000 (10:16 -0700)]
Let -basic-block-sections=labels emit basicblock metadata in a new .bb_addr_map section, instead of emitting special unary-encoded symbols.

This patch introduces the new .bb_addr_map section feature which allows us to emit the bits needed for mapping binary profiles to basic blocks into a separate section.
The format of the emitted data is represented as follows. It includes a header for every function:

|  Address of the function                      |  -> 8 bytes (pointer size)
|  Number of basic blocks in this function (>0) |  -> ULEB128

The header is followed by a BB record for every basic block. These records are ordered in the same order as MachineBasicBlocks are placed in the function. Each BB Info is structured as follows:

|  Offset of the basic block relative to function begin |  -> ULEB128
|  Binary size of the basic block                       |  -> ULEB128
|  BB metadata                                          |  -> ULEB128  [ MBB.isReturn() OR MBB.hasTailCall() << 1  OR  MBB.isEHPad() << 2 ]

The new feature will replace the existing "BB labels" functionality with -basic-block-sections=labels.
The .bb_addr_map section scrubs the specially-encoded BB symbols from the binary and makes it friendly to profilers and debuggers.
Furthermore, the new feature reduces the binary size overhead from 70% bloat to only 12%.

For more information and results please refer to the RFC: https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html

Reviewed By: MaskRay, snehasish

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

3 years ago[flang] Fix analyzed form of type-bound assignment
Tim Keith [Mon, 14 Sep 2020 16:59:49 +0000 (09:59 -0700)]
[flang] Fix analyzed form of type-bound assignment

Change the analyzed form of type-bound assignment to match that of call
statements. Resolve the binding name to a specific subprogram when
possible by using `GetBindingResolution`. Otherwise leave it as a
type-bound procedure call.

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

3 years ago[ELF] Define a reportRangeError() overload for thunks and tidy up recent PPC64 thunk...
Fangrui Song [Fri, 11 Sep 2020 16:31:37 +0000 (09:31 -0700)]
[ELF] Define a reportRangeError() overload for thunks and tidy up recent PPC64 thunk range errors

Prefer `errorOrWarn` to `fatal` for recoverable errors and graceful degradation
when --noinhibit-exec is specified.

Mention the destination symbol, otherwise the diagnostic is not really actionable.
Two errors are not tested but the patch does not intend to add the coverage.

Reviewed By: grimar

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

3 years ago[libc] Decouple string functions.
cgyurgyik [Mon, 14 Sep 2020 16:20:58 +0000 (12:20 -0400)]
[libc] Decouple string functions.

This revision removes dependencies that exist between different string functions. This allows for the libc user to use a specific function X of this library without also depending on Y and Z.

Reviewed By: sivachandra

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

3 years ago[flang] Correctly detect overlapping integer cases
Tim Keith [Mon, 14 Sep 2020 16:10:45 +0000 (09:10 -0700)]
[flang] Correctly detect overlapping integer cases

Integer case values were being compared as unsigned by operator<
on evaluate::value::Integer. Change that to signed so that overlap
can be detected correctly.

Explicit CompareUnsigned and BLT are still available if unsigned
comparison is needed.

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

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

3 years ago[InstSimplify] add folds for fmin/fmax with 'nnan'
Sanjay Patel [Mon, 14 Sep 2020 15:42:34 +0000 (11:42 -0400)]
[InstSimplify] add folds for fmin/fmax with 'nnan'

maximum(nnan X, +INF) --> +INF
minimum(nnan X, -INF) --> -INF

This is based on the similar codegen transform proposed in:
D87571

3 years agoSema: add support for `__attribute__((__swift_objc_members__))`
Saleem Abdulrasool [Tue, 8 Sep 2020 22:33:02 +0000 (22:33 +0000)]
Sema: add support for `__attribute__((__swift_objc_members__))`

This adds the `__swift_objc_members__` attribute to the semantic
analysis.  It allows for annotating ObjC interfaces to provide Swift
semantics indicating that the types derived from this interface will be
back-bridged to Objective-C to allow interoperability with Objective-C
and Swift.

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c

Differential Revision: https://reviews.llvm.org/D87395
Reviewed By: Aaron Ballman, Dmitri Gribenko

3 years ago[InstSimplify] allow folds for fmin/fmax with 'ninf'
Sanjay Patel [Mon, 14 Sep 2020 15:13:09 +0000 (11:13 -0400)]
[InstSimplify] allow folds for fmin/fmax with 'ninf'

maxnum(ninf X, +FLT_MAX) --> +FLT_MAX
minnum(ninf X, -FLT_MAX) --> -FLT_MAX

This is based on the similar codegen transform proposed in:
D87571

3 years ago[MemorySSA] Make sure PerformedPhiTrans is updated for each visited def.
Florian Hahn [Mon, 14 Sep 2020 14:51:17 +0000 (15:51 +0100)]
[MemorySSA] Make sure PerformedPhiTrans is updated for each visited def.

1ce82015f6d0 added a fix to restrict phi optimizations after phi
translations. But the current use of performedPhiTranslation only
checked whether phi translation happened for the first iterator and
missed cases where phi translations happens at subsequent
iterators/upwards defs.

This patch changes upward_defs_iteartor to take a pointer to a bool, so
we can easily ensure the final value includes all visited defs, while
still being able to conveniently use it with make_range & co.

3 years ago[MemorySSA] Precommit test case for PR47498.
Florian Hahn [Mon, 14 Sep 2020 14:33:50 +0000 (15:33 +0100)]
[MemorySSA] Precommit test case for PR47498.

3 years agoAssert we've found the size of each (non-overlapping) structure. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 14:37:47 +0000 (15:37 +0100)]
Assert we've found the size of each (non-overlapping) structure. NFCI.

Fixes clang static analyzer warning.

3 years ago[libcxx] ostream{,buf}_iterator::difference_type changes in C++20
Louis Dionne [Fri, 11 Sep 2020 14:15:56 +0000 (10:15 -0400)]
[libcxx] ostream{,buf}_iterator::difference_type changes in C++20

In C++20, since P0896R4, std::ostream_iterator and std::ostreambuf_iterator
must have std::ptrdiff_t instead of void as a difference_type.

Tests by Casey Carter (thanks!).

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

3 years agoAdd support for casting elements in vectors for certain Std dialect type conversion...
Lubomir Litchev [Wed, 9 Sep 2020 19:34:08 +0000 (12:34 -0700)]
Add support for casting elements in vectors for certain Std dialect type conversion operations.

Added support to the Std dialect cast operations to do casts in vector types when feasible.

Reviewed By: ftynse

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

3 years ago[InstSimplify] reduce code duplication for fmin/fmax folds; NFC
Sanjay Patel [Mon, 14 Sep 2020 14:32:11 +0000 (10:32 -0400)]
[InstSimplify] reduce code duplication for fmin/fmax folds; NFC

We use the same code structure for folding integer min/max.

3 years ago[InstSimplify] add/move tests for fmin/fmax; NFC
Sanjay Patel [Mon, 14 Sep 2020 14:24:19 +0000 (10:24 -0400)]
[InstSimplify] add/move tests for fmin/fmax; NFC

The new tests are duplicated from the sibling patch for codegen:
D87571

3 years ago[InstSimplify] fix test comments; NFC
Sanjay Patel [Mon, 14 Sep 2020 14:07:26 +0000 (10:07 -0400)]
[InstSimplify] fix test comments; NFC

3 years ago[XCOFF][AIX] Handle TOC entries that could not be reached by positive range in small...
jasonliu [Fri, 11 Sep 2020 14:26:26 +0000 (14:26 +0000)]
[XCOFF][AIX] Handle TOC entries that could not be reached by positive range in small code model

Summary:
In small code model, AIX assembler could not deal with labels that
could not be reached within the [-0x8000, 0x8000) range from TOC base.
So when generating the assembly, we would need to help the assembler
by subtracting an offset from the label to keep the actual value
within [-0x8000, 0x8000).

Reviewed By: hubert.reinterpretcast, Xiangling_L

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

3 years ago[ARM] Enable tail predication for reduction tests. NFC
David Green [Mon, 14 Sep 2020 13:26:10 +0000 (14:26 +0100)]
[ARM] Enable tail predication for reduction tests. NFC

3 years ago[InstSimplify] fix miscompiles with maximum/minimum intrinsics
Sanjay Patel [Mon, 14 Sep 2020 13:06:41 +0000 (09:06 -0400)]
[InstSimplify] fix miscompiles with maximum/minimum intrinsics

As discussed in the sibling codegen functionality patch D87571,
this transform was created with D52766, but it is not correct.

The incorrect test diffs were missed during review, but the
'TODO' comment about this functionality was still in the code -
we need 'nnan' to enable this fold.

3 years ago[AMDGPU] Don't cluster stores
Jay Foad [Wed, 3 Jun 2020 09:01:12 +0000 (10:01 +0100)]
[AMDGPU] Don't cluster stores

Clustering loads has caching benefits, but as far as I know there is no
advantage to clustering stores on any AMDGPU subtargets.

The disadvantage is that it tends to increase register pressure and
restricts scheduling freedom.

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

3 years agoAssert we've found both vector types. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 12:24:17 +0000 (13:24 +0100)]
Assert we've found both vector types. NFCI.

Fixes clang static analyzer warning about potential null dereferences.

3 years agoDon't dereference from a dyn_cast<>. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 12:04:44 +0000 (13:04 +0100)]
Don't dereference from a dyn_cast<>. NFCI.

Use cast<> instead which will assert if it fails and not just return null.

Fixes clang static analyzer warning.

3 years ago[llvm-readobj/elf] - Don't use unwrapOrError when reporting errors about SHT_DYNAMIC...
Georgii Rymar [Fri, 11 Sep 2020 10:29:33 +0000 (13:29 +0300)]
[llvm-readobj/elf] - Don't use unwrapOrError when reporting errors about SHT_DYNAMIC sections.

This changes messages reported to stop using dynamic section names (use `describe()` instead).
This allows to avoid `unwrapOrError` and improves diagnostics.

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

3 years ago[llvm-readobj] - Cleanup implementation LLVMStyle<ELFT>::printAddrsig().
Georgii Rymar [Fri, 11 Sep 2020 11:35:06 +0000 (14:35 +0300)]
[llvm-readobj] - Cleanup implementation LLVMStyle<ELFT>::printAddrsig().

It has following issues:
1) `getStaticSymbolName` returns `std::string`, but the code
   assigns a result to `Expected<std::string>`.
2) The code uses `unwrapOrError` and never tests the error reported.

This patch fixes these issues.

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

3 years ago[NFC] Add missing `const` statements in SCEV
Max Kazantsev [Mon, 14 Sep 2020 11:28:58 +0000 (18:28 +0700)]
[NFC] Add missing `const` statements in SCEV

3 years ago[llvm-readelf/obj] - Refine and generalize the code that is used to dump notes.
Georgii Rymar [Thu, 10 Sep 2020 12:26:23 +0000 (15:26 +0300)]
[llvm-readelf/obj] - Refine and generalize the code that is used to dump notes.

There is some code that can be shared between GNU/LLVM styles.
Also, this fixes 2 inconsistencies related to dumping unknown note types:
1) For GNU style we printed "Unknown note type: (0x00000003)" in some cases, and
   "Unknown note type (0x00000003)" (no colon) in other cases.
   GNU readelf always prints `:`. This patch removes the related code
   duplication and does the same.
2) For LLVM style in some cases we printed "Unknown note type (0x00000003)",
   but sometimes just "Unknown (0x00000003)". The latter is the right form, which
   is consistent with other unknowns that are printed in LLVM style.

Rebased on top of D87453.

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

3 years ago[llvm-readobj/elf][test] - Test all core note types properly.
Georgii Rymar [Thu, 10 Sep 2020 13:59:06 +0000 (16:59 +0300)]
[llvm-readobj/elf][test] - Test all core note types properly.

Currently we don't test all core note types that are defined in
`getCoreNoteTypeName` in ELFDumper.cpp.

Also we don't have a test for an unknown core note type.

This patch fixes it.

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

3 years ago[pstl] Support Threading Building Blocks 2020 (oneTBB) for "tbb" parallel backend.
Dvorskiy, Mikhail [Mon, 14 Sep 2020 11:20:32 +0000 (14:20 +0300)]
[pstl] Support Threading Building Blocks 2020 (oneTBB) for "tbb" parallel backend.

After the changes the "tbb" parallel backend will work with old TBB versions(TBB_INTERFACE_VERSION <= 12000) and new ones (TBB 2020 and greater)

More about oneTBB:
https://github.com/oneapi-src/oneTBB

Phabricator Review:
https://reviews.llvm.org/D87380

3 years ago[mlir] Check for type conversion success in std->llvm function conversion
Alex Zinenko [Thu, 3 Sep 2020 08:05:25 +0000 (10:05 +0200)]
[mlir] Check for type conversion success in std->llvm function conversion

Type converter may fail and return nullptr on unconvertible types. The function
conversion did not include a check and was attempting to use a nullptr type to
construct an LLVM function, leading to a crash. Add a check and return early.
The rest of the call stack propagates errors properly.

Fixes PR47403.

Reviewed By: mehdi_amini

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

3 years ago[CGP] Limit converting phi types to simple loads and stores
David Green [Mon, 14 Sep 2020 11:08:34 +0000 (12:08 +0100)]
[CGP] Limit converting phi types to simple loads and stores

Instcombine limits converting phi types to simple loads and stores. This
does the same in codegenprepare, not processing phis that are not
simple.

Note that volatile loads/store ISel will happily convert between float
and int. Atomics are more likely to always be integer. This just keeps
things simple and doesn't process either.

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

3 years ago[DSE] Only eliminate candidates that always store the same loc.
Florian Hahn [Mon, 14 Sep 2020 10:49:27 +0000 (11:49 +0100)]
[DSE] Only eliminate candidates that always store the same loc.

AliasAnalysis/MemoryLocation does not account for loops. Two
MemoryLocation can be must-overwrite, even if the first one writes
multiple locations in a loop.

This patch prevents removing such stores, by only considering candidates
that are known to be loop invariant, or executed in the same BB.

Currently the invariant check is quite conservative and only considers
Alloca and Alloca-like instructions and arguments as invariant base pointers.
It also considers GEPs with all constant indices and invariant bases as
invariant.

This can be improved in the future, but the current implementation has
only minor impact on the total number of stores eliminated (25903 vs
26047 for the baseline). There are some 2-10% swings for some individual
benchmarks. In roughly half of the cases, the number of stores removed
increases actually, because we skip candidates that are unlikely to be
valid candidates early.

3 years ago[DSE] Precommit test case for invalid elimination of store in loop.
Florian Hahn [Mon, 14 Sep 2020 10:56:13 +0000 (11:56 +0100)]
[DSE] Precommit test case for invalid elimination of store in loop.

3 years ago[ARM] Selects SSAT/USAT from correct LLVM IR
Meera Nakrani [Mon, 14 Sep 2020 10:57:41 +0000 (10:57 +0000)]
[ARM] Selects SSAT/USAT from correct LLVM IR

LLVM will canonicalize conditional selectors to a different pattern than the old code that was used.
This is updating the function to match the new expected patterns and select SSAT or USAT when successful.
Tests have also been updated to use the new patterns.

Differential Review: https://reviews.llvm.org/D87379

3 years ago[SyntaxTree][List] `assertInvariants` for `List`s
Eduardo Caldas [Mon, 14 Sep 2020 08:20:19 +0000 (08:20 +0000)]
[SyntaxTree][List] `assertInvariants` for `List`s

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

3 years ago[SyntaxTree] Provide `List::classof`
Eduardo Caldas [Mon, 14 Sep 2020 07:58:30 +0000 (07:58 +0000)]
[SyntaxTree] Provide `List::classof`

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

3 years ago[SyntaxTree][List] Fix: `ParameterDeclarationList` is the `List` inside `ParametersAn...
Eduardo Caldas [Mon, 14 Sep 2020 07:56:39 +0000 (07:56 +0000)]
[SyntaxTree][List] Fix: `ParameterDeclarationList` is the `List` inside `ParametersAndQualifiers`

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

3 years ago[ARM][MVE] Tail-predication: check get.active.lane.mask's TC value
Sjoerd Meijer [Wed, 9 Sep 2020 13:39:51 +0000 (14:39 +0100)]
[ARM][MVE] Tail-predication: check get.active.lane.mask's TC value

This adds additional checks for the original scalar loop tripcount value, i.e.
get.active.lane.mask second argument, and perform several sanity checks to see
if it is of the form that we expect similarly like we already do for the IV
which is the first argument of get.active.lane.

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

3 years ago[SVE] In LoopIdiomRecognize::isLegalStore bail out for scalable vectors
David Sherwood [Thu, 10 Sep 2020 07:40:17 +0000 (08:40 +0100)]
[SVE] In LoopIdiomRecognize::isLegalStore bail out for scalable vectors

The function LoopIdiomRecognize::isLegalStore looks for stores in loops
that could be transformed into memset or memcpy. However, the algorithm
currently requires that we know how big the store is at runtime, i.e.
that the store size will not overflow an unsigned integer. For scalable
vectors we cannot guarantee this so I have changed the code to bail out
for now. In addition, even if we add a way to query the maximum value of
vscale in future we will still need to update the algorithm to cope with
non-constant strides. The additional cost associated with calculating
the memset and memcpy arguments will need to be taken into account as
well.

This patch also fixes up an implicit TypeSize -> uint64_t cast,
thereby removing a warning. I've added tests here showing a fixed
width vector loop being transformed into memcpy, and a scalable
vector loop remaining unchanged:

  Transforms/LoopIdiom/memcpy-vectors.ll

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

3 years agoAMDGPU/GlobalISel Check for NoNaNsFPMath in isKnownNeverSNaN
Petar Avramovic [Mon, 14 Sep 2020 10:03:36 +0000 (12:03 +0200)]
AMDGPU/GlobalISel Check for NoNaNsFPMath in isKnownNeverSNaN

Check for NoNaNsFPMath function attribute in isKnownNeverSNaN.
Function attributes are in held in 'TargetMachine.Options'.
Among other things, this allows selection of some patterns imported
in D87351 since G_FCANONICALIZE is not generated when isKnownNeverSNaN
returns true in lowerFMinNumMaxNum.

However we notice some incorrect results since function attributes are
not correctly written in TargetMachine.Options when next function is
processed. Take a look at @v_test_no_global_nnans_med3_f32_pat0_srcmod0,
it has "no-nans-fp-math"="false" but TargetMachine.Options still has it
set to true since first function in test file had this attribute set to
true. This will be fixed in D87511.

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

3 years agoAMDGPU/GlobalISel/Emitter Recognize additional 'same operand checks'
Petar Avramovic [Mon, 14 Sep 2020 09:37:14 +0000 (11:37 +0200)]
AMDGPU/GlobalISel/Emitter Recognize additional 'same operand checks'

The "name" of a non-leaf complex pattern (MY_PAT $op1, $op2) is
"MY_PAT:op1:op2" and the ones with same "name" represent same operand.
Add 'same operand check' for this case.

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

3 years agoAMDGPU/GlobalISel Add test for non-leaf complex patterns
Petar Avramovic [Mon, 14 Sep 2020 09:18:21 +0000 (11:18 +0200)]
AMDGPU/GlobalISel Add test for non-leaf complex patterns

GlobalIsel emitter does not import patterns where complex sub-operand
of a non-leaf complex pattern is referenced more then once. Multiple
references of complex patterns with same name and same sub-operands
represent the same operand. Document this with a test.

3 years ago[LegalizeDAG] Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warni...
Simon Pilgrim [Mon, 14 Sep 2020 10:09:15 +0000 (11:09 +0100)]
[LegalizeDAG] Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

3 years ago[clangd] makeStringError,make_error<StringError> -> error()
Sam McCall [Mon, 14 Sep 2020 09:33:12 +0000 (11:33 +0200)]
[clangd] makeStringError,make_error<StringError> -> error()

3 years ago[CodeGen][X86] Regenerate minmax reduction sequence tests to match arithmetic tests.
Simon Pilgrim [Mon, 14 Sep 2020 09:27:35 +0000 (10:27 +0100)]
[CodeGen][X86] Regenerate minmax reduction sequence tests to match arithmetic tests.

avx512-reduceIntrin.c wasn't bothering with the exhaustive alloca/store/load/bitcast checks and avx512-reduceMinMaxIntrin.c shouldn't need to either.

This makes it a lot easier to maintain as the update script still doesn't work properly on x86 targets

3 years ago[clangd] Track tweaks that fail the apply stage
Kadir Cetinkaya [Fri, 11 Sep 2020 09:40:54 +0000 (11:40 +0200)]
[clangd] Track tweaks that fail the apply stage

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

3 years ago[DebugInstrRef][1/9] Add fields for instr-ref variable locations
Jeremy Morse [Mon, 14 Sep 2020 08:55:38 +0000 (09:55 +0100)]
[DebugInstrRef][1/9] Add fields for instr-ref variable locations

Add a DBG_INSTR_REF instruction and a "debug instruction number" field to
MachineInstr. The two allow variable values to be specified by
identifying where the value is computed, rather than the register it lies
in, like so:

  %0 = fooinst, debug-instr-number 1
  [...]
  DBG_INSTR_REF 1, 0

See the original RFC for motivation:
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139440.html

This patch is NFCI; it only adds fields and other boiler plate.

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

3 years ago[gn build] Port 30667c967d3
LLVM GN Syncbot [Mon, 14 Sep 2020 08:53:33 +0000 (08:53 +0000)]
[gn build] Port 30667c967d3

3 years ago[clangd] Add error() function for creating formatv-style llvm::Errors. NFC
Sam McCall [Wed, 8 Jul 2020 19:49:38 +0000 (21:49 +0200)]
[clangd] Add error() function for creating formatv-style llvm::Errors. NFC

Summary:
This is considerably terser than the makeStringError and friends, and
avoids verbosity cliffs that discourage adding log information.

It follows the syntax used in log/elog/vlog/dlog that have been successful.

The main caveats are:
 - it's strictly out-of-place in logger.h, though kind of fits thematically and
   in implementation
 - it claims the "error" identifier, which seems a bit too opinionated
   to put higher up in llvm

I've updated some users of StringError mostly at random - there are lots
more mechanical changes but I'd like to get this reviewed before making
them all.

Reviewers: kbobyrev, hokein

Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

3 years agoAMDGPU/GlobalISel/Emitter Support for predicate code that uses operands
Petar Avramovic [Mon, 14 Sep 2020 08:39:25 +0000 (10:39 +0200)]
AMDGPU/GlobalISel/Emitter Support for predicate code that uses operands

Predicates with 'let PredicateCodeUsesOperands = 1' want to examine
matched operands. When we encounter predicate code that uses operands,
analyze its named operand arguments and create a map between argument
index and name. Later, when leaf node with name is encountered, emit
GIM_RecordNamedOperand that will store that operand at its argument
index in operand list. This operand list will be an argument to c++
code of the predicate.

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

3 years ago[JumpThreading] Fix an incorrect Modified status
David Stenberg [Mon, 14 Sep 2020 07:38:54 +0000 (09:38 +0200)]
[JumpThreading] Fix an incorrect Modified status

This fixes PR47297.

When ProcessBlock() was able to constant fold the terminator's
condition, but not do any more transformations, the function would
return false, which would lead to the JumpThreading pass returning an
incorrect modified status. This patch makes so that ProcessBlock()
returns true in such cases. This will trigger an unnecessary invocation
of ProcessBlock() in such cases, but this should be rare to occur.

This was caught using the check introduced by D80916.

Reviewed By: efriedma

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

3 years ago[compiler-rt] [netbsd] Use internal_ptrace() instead of ptrace()
Kamil Rytarowski [Mon, 14 Sep 2020 08:10:49 +0000 (10:10 +0200)]
[compiler-rt] [netbsd] Use internal_ptrace() instead of ptrace()

3 years ago[UnifyLoopExits] Fix non-deterministic iteration order
Jay Foad [Fri, 11 Sep 2020 21:00:36 +0000 (22:00 +0100)]
[UnifyLoopExits] Fix non-deterministic iteration order

This was causing random minor codegen differences in shaders compiled
with the AMDGPU backend.

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

3 years ago[ARM] Fix so immediates and pc relative checks
Simon Wallis [Mon, 14 Sep 2020 07:52:59 +0000 (08:52 +0100)]
[ARM] Fix so immediates and pc relative checks

Treating an SoImm offset as a multiple of 4 between -1020 and 1020
mis-handles the second of a pair of 16-bit constants where the offset is a multiple of 2 but not a multiple of 4,
leading to an LLVM ERROR: out of range pc-relative fixup value

For 32-bit and larger (64-bit) constants, continue to treat an SoImm offset as a multiple of 4 between -1020 and 1020.
For smaller (16-bit) constants, treat an SoImm offset as a multiple of 1 between -255 and 255.

Reviewed By: efriedma

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

3 years ago[CodeGen] Fix bug in IncrementPointer
David Sherwood [Thu, 10 Sep 2020 10:54:58 +0000 (11:54 +0100)]
[CodeGen] Fix bug in IncrementPointer

In an earlier patch I meant to add the correct flags to the ADD
node when incrementing the pointer, but forgot to pass them to
SelectionDAG::getNode.

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

3 years ago[analyzer][z3] Use more elaborate Z3 variable names
Balazs Benics [Mon, 14 Sep 2020 06:43:56 +0000 (08:43 +0200)]
[analyzer][z3] Use more elaborate Z3 variable names

Previously, it was a tedious task to comprehend Z3 dumps.
We will use the same name prefix just as we use in the corresponding dump method

For all `SymbolData` values:
    `$###` -> `conj_$###`
    `$###` -> `derived_$###`
    `$###` -> `extent_$###`
    `$###` -> `meta_$###`
    `$###` -> `reg_$###`

Reviewed By: xazax.hun,mikhail.ramalho

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

3 years ago[analyzer][docs][NFC] Document the ento namespace in the llvm/Lexicon
Balazs Benics [Mon, 14 Sep 2020 06:43:56 +0000 (08:43 +0200)]
[analyzer][docs][NFC] Document the ento namespace in the llvm/Lexicon

Document the `ento` namespace in the Lexicon according to @nicolas17 on the
mailing list (http://lists.llvm.org/pipermail/cfe-dev/2020-August/066577.html).

The analyzer lived at different namespaces at different times.
Originally lived at the `GR` aka. (Graph Reachability)  namespace [7], later it
moved under the `ento` namespace [9].

The Static Analyzer's code lived at many other places as well:
`Analysis` -[2]-> `Checker` -[5]-> `GR` -[10]> `entoSA` -[11]-> `StaticAnalyzer`

The relevant code motion, refactor commits, cfe-dev mailing in chronological
order:
 1) 2008-03-15 Make a major restructuring of the clang tree: introduce a ...
    7a51313d8a0a358bb92eb5dbf8fd846b7c48e7fe
 2) 2010-01-25 Split libAnalysis into two libraries: libAnalysis and libChecker
    d6b8708643219776b1f0f41df32c5eccf065ed5b
 3) 2010-12-21 Reorganization of Checker files
    http://lists.llvm.org/pipermail/cfe-dev/2010-December/012694.html
 4) 2010-12-22 Refactoring: include/clang/Checker -> include/clang/GR
    8d602a8aa8e6697509465d8a5473fc41cb1a382e
 5) 2010-12-22 Refactoring: lib/Checker -> lib/GR
    2ff5ab1516e48c2fff0138f953d887b5e695214b
 6) 2010-12-22 Refactoring: Move checkers into lib/GR/Checkers and their own
    a700e976b658860418bc145ec0bdacd4f1db3264
 7) 2010-12-22 Refactoring: Move stuff into namespace 'GR'
    ca08fba4141f1d3ae6193b3c81fb6ba8fb10d7dc
 8) 2010-12-22 Refactoring: Drop the 'GR' prefix.
    1696f508e2fe95793ca8bb70d78b88023b6b8625
 9) 2010-12-23 Rename static analyzer namespace 'GR' to 'ento'
    98857c986078c6e6a10910628dbabf75ae735b76
10) 2010-12-23 Rename headers: 'clang/GR' 'clang/EntoSA' and update Makefile
    ef33f0996c6a625767690395f3cfb41afb84db5a
11) 2010-12-23 Chris Lattner has strong opinions about directory
    d99bd55a5e092774214ba31fc5a871bfc31e711c
12) 2010-12-24 Remove the EntoSA directories.
    9d6af5328e3a61641a125b17125952fa1a6bf11d

Reviewed By: Szelethus,martong,ASDenysPetrov,xazax.hun

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

3 years ago[analyzer] Evaluate PredefinedExpressions
Balazs Benics [Mon, 14 Sep 2020 06:43:56 +0000 (08:43 +0200)]
[analyzer] Evaluate PredefinedExpressions

We did not evaluate such expressions, just returned `Unknown` for such cases.
After this patch, we will be able to access a unique value identifying a template instantiation via the value of the `PRETTY_FUNCTION` predefined expression.

Reviewed By: vsavchenko

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

3 years ago[llvm-cov gcov] Refactor counting and reporting
Fangrui Song [Mon, 14 Sep 2020 06:00:59 +0000 (23:00 -0700)]
[llvm-cov gcov] Refactor counting and reporting

The current organization of FileInfo and its referenced utility functions of
(GCOVFile, GCOVFunction, GCOVBlock) is messy. Some members of FileInfo are just
copied from GCOVFile. FileInfo::print (.gcov output and --intermediate output)
is interleaved with branch statistics and computation of line execution counts.
--intermediate has to do redundant .gcov output to gather branch statistics.

This patch deletes lots of code and introduces a clearer work flow:

```
fn collectFunction
  for each block b
    for each line lineNum
      let line be LineInfo of the file on lineNum
      line.exists = 1
      increment function's lines & linesExec if necessary
      increment line.count
      line.blocks.push_back(&b)

fn collectSourceLine
  compute cycle counts
  count = incoming_counts + cycle_counts
  if line.exists
    ++summary->lines
    if line.count
      ++summary->linesExec

fn collectSource
  for each line
    call collectSourceLine

fn main
  for each function
    call collectFunction
    print function summary
  for each source file
    call collectSource
    print file summary
    annotate the source file with line execution counts
  if -i
    print intermediate file
```

The output order of functions and files now follows the original order in
.gcno files.

3 years ago[AST][FPEnv] Keep FP options in trailing storage of CastExpr
Serge Pavlov [Sat, 12 Sep 2020 14:54:14 +0000 (21:54 +0700)]
[AST][FPEnv] Keep FP options in trailing storage of CastExpr

This is recommit of 6c8041aa0f, reverted in de044f7562 because of some
fails. Original commit message is below.

This change allow a CastExpr to have optional FPOptionsOverride object,
stored in trailing storage. Of all cast nodes only ImplicitCastExpr,
CStyleCastExpr, CXXFunctionalCastExpr and CXXStaticCastExpr are allowed
to have FPOptions.

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

3 years ago[CodeGenPrepare] Fix zapping dead operands of assume
Yevgeny Rouban [Mon, 14 Sep 2020 04:42:23 +0000 (11:42 +0700)]
[CodeGenPrepare] Fix zapping dead operands of assume

This patch fixes a problem of the commit 52cc97a0.
A test case is created to demonstrate the crash caused by
the instruction iterator invalidated by the recursive
removal of dead operands of assume. The solution restarts
from the blocks's first instruction in case CurInstIterator
is invalidated by RecursivelyDeleteTriviallyDeadInstructions().

Reviewed By: bkramer

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

3 years ago[docs] Document LLVM_EXTERNALIZE_DEBUGINFO CMake option
Dave Lee [Sun, 13 Sep 2020 23:54:47 +0000 (16:54 -0700)]
[docs] Document LLVM_EXTERNALIZE_DEBUGINFO CMake option

Add `LLVM_EXTERNALIZE_DEBUGINFO` to CMake.rst. This should help make dSYM
generation more discoverable.

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

3 years ago[SelectionDAG] Move ISD:PARITY formation from DAGCombine to SimplifyDemandedBits.
Craig Topper [Mon, 14 Sep 2020 02:51:20 +0000 (19:51 -0700)]
[SelectionDAG] Move ISD:PARITY formation from DAGCombine to SimplifyDemandedBits.

Previously, we formed ISD::PARITY by looking for (and (ctpop X), 1)
but the AND might be separated from the ctpop. For example if the
parity result is multiplied by 2, we'll pull the AND through the
shift.

So to handle more cases, move to SimplifyDemandedBits where we
can handle more cases that result in only the LSB of the CTPOP
being used.

3 years ago[JITLink] Improve formatting for Edge, Block and Symbol debugging output.
Lang Hames [Sun, 13 Sep 2020 21:22:20 +0000 (14:22 -0700)]
[JITLink] Improve formatting for Edge, Block and Symbol debugging output.

3 years ago[llvm-cov gcov][test] Unsupport Windows
Fangrui Song [Sun, 13 Sep 2020 22:17:14 +0000 (15:17 -0700)]
[llvm-cov gcov][test] Unsupport Windows

3 years ago[llvm-cov gcov] Add -r (--relative-only) && -s (--source-prefix)
Fangrui Song [Sun, 13 Sep 2020 21:54:20 +0000 (14:54 -0700)]
[llvm-cov gcov] Add -r (--relative-only) && -s (--source-prefix)

gcov 4.7 introduced the two options.
https://sourceware.org/pipermail/gcc-patches/2011-November/328782.html

-r only dumps files with relative paths or absolute paths with the prefix
specified by -s. The two options are useful filtering out system header files.

3 years ago[ARM] Add some fmin/fmax tests with commuted operands (NFC)
Nikita Popov [Sun, 13 Sep 2020 20:16:24 +0000 (22:16 +0200)]
[ARM] Add some fmin/fmax tests with commuted operands (NFC)

As well as vector commuted operands.

3 years agoPPCInstrInfo: Fix readability-inconsistent-declaration-parameter-name clang-tidy...
David Blaikie [Sun, 13 Sep 2020 20:08:17 +0000 (13:08 -0700)]
PPCInstrInfo: Fix readability-inconsistent-declaration-parameter-name clang-tidy warning

Reduces the chance of confusion when calling the function with
autocomplete (will show the more accurate/informative variable name),
etc.

3 years agoCorrect end-of-namespace comment to be clang-tidy/LLVM style appropriate
David Blaikie [Sun, 13 Sep 2020 20:07:58 +0000 (13:07 -0700)]
Correct end-of-namespace comment to be clang-tidy/LLVM style appropriate

3 years agoGCOVProfiling: Avoid use-after-move
David Blaikie [Sun, 13 Sep 2020 19:54:36 +0000 (12:54 -0700)]
GCOVProfiling: Avoid use-after-move

Turns out this was use-after-move of function_ref, which is trivially
copyable and movable, so the move did nothing and use after move was
safe.

But since this function_ref is being copied into a std::function, change
the function_ref to be std::function to avoid extra layers of type
erasure indirection - and then it's a real use after move, and fix that
by referring to the moved-to member variable rather than the moved-from
parameter.

3 years ago[SelectionDAG] Remove default for 'unsigned' Alignment for getLoad/getStore/getExtLoa...
Craig Topper [Sun, 13 Sep 2020 18:49:14 +0000 (11:49 -0700)]
[SelectionDAG] Remove default for 'unsigned' Alignment for getLoad/getStore/getExtLoad/getTruncStore. Add default for MaybeAlign version. NFCI

We want to remove the unsigned signatures eventually. This change
migrates any that don't explicitly pass an alignment.

3 years ago[ASTImporter] Add basic support for comparing Stmts and compare function bodies
Raphael Isemann [Sat, 12 Sep 2020 19:49:48 +0000 (21:49 +0200)]
[ASTImporter] Add basic support for comparing Stmts and compare function bodies

Right now the ASTImporter assumes for most Expr nodes that they are always equal
which leads to non-compatible declarations ending up being merged. This patch
adds the basic framework for comparing Stmts (and with that also Exprs) and
implements the custom checks for a few Stmt subclasses. I'll implement the
remaining subclasses in follow up patches (mostly because there are a lot of
subclasses and some of them require further changes like having GNU language in
the testing framework)

The motivation for this is that in LLDB we try to import libc++ source code and
some of the types we are importing there contain expressions (e.g. because they
use `enable_if<expr>`), so those declarations are currently merged even if they
are completely different (e.g. `enable_if<value> ...` and `enable_if<!value>
...` are currently considered equal which is clearly not true).

Reviewed By: martong, balazske

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

3 years ago[DAGCombiner] Propagate FMF flags in FMA folding
Qiu Chaofan [Sun, 13 Sep 2020 16:19:06 +0000 (00:19 +0800)]
[DAGCombiner] Propagate FMF flags in FMA folding

DAG combiner folds (fma a 1.0 b) into (fadd a b) but the flag isn't
propagated into new fadd. This patch fixes that.

Some code in visitFMA is redundant and such support for vector constants
is missing. Need follow-up patch to clean.

Reviewed By: spatel

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

3 years ago[CGP] Prevent optimizePhiType from iterating forever
David Green [Sun, 13 Sep 2020 15:11:01 +0000 (16:11 +0100)]
[CGP] Prevent optimizePhiType from iterating forever

The recently added optimizePhiType algorithm had no checks to make sure
it didn't continually iterate backward and forth between float and int
types. This means that given an input like store(phi(bitcast(load))), we
could convert that back and forth to store(bitcast(phi(load))). This
particular case would usually have been simplified to a different load
type (folding the bitcast into the load) before CGP, but other cases can
occur. The one that came up was phi(bitcast(phi)), where the two phi's
of different types were bitcast between. That was not helped by a dead
bitcast being kept around which could make conversion look profitable.

This adds an extra check of the bitcast Uses or Defs, to make sure that
at least one is grounded and will not end up being converted back. It
also makes sure that dead bitcasts are removed, and there is a minor
change to include newly created Phi nodes in the Visited set so that
they do not need to be revisited.

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

3 years ago[ARM] Add tests for fmin/max with largest/smallest float (NFC)
Nikita Popov [Sun, 13 Sep 2020 15:04:53 +0000 (17:04 +0200)]
[ARM] Add tests for fmin/max with largest/smallest float (NFC)

3 years ago[X86] Add test cases for PR11210
Simon Pilgrim [Sun, 13 Sep 2020 12:38:05 +0000 (13:38 +0100)]
[X86] Add test cases for PR11210

Demonstrates that redundant masked stores may be removed, as long as we're able to replace the AVX/AVX2 masked store with a generic masked store (constant mask or sign-extended bool vector mask).

3 years agoReland "[PowerPC] Implement instruction clustering for stores"
Qiu Chaofan [Sun, 13 Sep 2020 11:39:49 +0000 (19:39 +0800)]
Reland "[PowerPC] Implement instruction clustering for stores"

Commit 3c0b3250 introduced store fusion for PowerPC target, but it
brought failure under UB sanitizer and was reverted. This patch fixes
them.