platform/upstream/llvm.git
3 years agoCorrect examples after d3205bbca3e0002d76282878986993e7e7994779
Tyker [Tue, 27 Oct 2020 08:46:06 +0000 (09:46 +0100)]
Correct examples after d3205bbca3e0002d76282878986993e7e7994779

3 years ago[clang][RecoveryExpr] Add tests for ObjectiveC.
Haojian Wu [Tue, 27 Oct 2020 08:42:19 +0000 (09:42 +0100)]
[clang][RecoveryExpr] Add tests for ObjectiveC.

to demonstrate it works for some cases.

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

3 years agoUpdating llvm.mlir test to match recent IR change
Kiran Chandramohan [Tue, 27 Oct 2020 08:15:28 +0000 (08:15 +0000)]
Updating llvm.mlir test to match recent IR change

Recent change updated branch weights to use i64 instead of i32.
Updating llvm.mlir test to match this change.
https://reviews.llvm.org/D88609

3 years ago[clangd] Fix proto deps, for real this time.
Sam McCall [Tue, 27 Oct 2020 08:15:12 +0000 (09:15 +0100)]
[clangd] Fix proto deps, for real this time.

This is ugly (layering violation) but we can clean it up once we know it
works in CI.

3 years ago[Test] One more range check test
Max Kazantsev [Tue, 27 Oct 2020 07:50:00 +0000 (14:50 +0700)]
[Test] One more range check test

3 years ago[Syntax] Disallow invalid Node operations
Sam McCall [Mon, 26 Oct 2020 15:44:36 +0000 (16:44 +0100)]
[Syntax] Disallow invalid Node operations

Copy/move break invariants (move could be fixed).
Node/Tree should have no public constructors, they're abstract.
Destructor is private to enforce arena allocation.

(Making the constructor of all subclasses private doesn't seem worthwhile)

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

3 years ago[X86] Alternate implementation of D88194.
Craig Topper [Tue, 27 Oct 2020 07:20:03 +0000 (00:20 -0700)]
[X86] Alternate implementation of D88194.

This uses PreprocessISelDAG to replace the constant before
instruction selection instead of matching opcodes after.

Reviewed By: pengfei

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

3 years ago[X86] Encode global address in small code model
Wei Wang [Fri, 23 Oct 2020 05:54:16 +0000 (22:54 -0700)]
[X86] Encode global address in small code model

In small code model, program and its symbols are linked in the lower 2 GB of
the address space. Try encoding global address even when the range is unknown
in such case.

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

3 years ago[mlir] Fix TypeID lookup in GDB pretty printers.
Christian Sigg [Mon, 26 Oct 2020 21:13:59 +0000 (22:13 +0100)]
[mlir] Fix TypeID lookup in GDB pretty printers.

The TypeID instance was moved in D89153.

It wasn't caught that it broke MLIR pretty printers because pre-merge checks don't run check-debuginfo.

Avoid disabling all MLIR printers in case this happens again by catching the exception.

Reviewed By: stellaraccident

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

3 years ago[NFC] Factor away lambda's redundant parameter
Max Kazantsev [Tue, 27 Oct 2020 05:55:17 +0000 (12:55 +0700)]
[NFC] Factor away lambda's redundant parameter

3 years ago[clangd] Increase the TooMany limit for index-based textual navigation to 5
Nathan Ridge [Sun, 26 Apr 2020 04:45:51 +0000 (00:45 -0400)]
[clangd] Increase the TooMany limit for index-based textual navigation to 5

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

3 years ago[libTooling] Recognize sccache as a compiler wrapper in compilation database commands
Nathan Ridge [Sun, 4 Oct 2020 05:07:20 +0000 (01:07 -0400)]
[libTooling] Recognize sccache as a compiler wrapper in compilation database commands

sccache is a compiler caching tool similar to ccache.

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

3 years ago[GVN LoadPRE] Add an option to disable splitting backedge
Serguei Katkov [Tue, 20 Oct 2020 10:32:08 +0000 (17:32 +0700)]
[GVN LoadPRE] Add an option to disable splitting backedge

GVN Load PRE can split the backedge causing breaking the loop structure where the latch
contains the conditional branch with for example induction variable.

Different optimizations expect this form of the loop, so it is better to preserve it for some time.
This CL adds an option to control an ability to split backedge.

Default value is true so technically it is NFC and current behavior is not changed.

Reviewers: fedor.sergeev, mkazantsev, nikic, reames, fhahn
Reviewed By: mkazasntsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D89854

3 years ago[IndVars] Remove monotonic checks with unknown exit count
Max Kazantsev [Tue, 27 Oct 2020 04:35:16 +0000 (11:35 +0700)]
[IndVars] Remove monotonic checks with unknown exit count

Even if the exact exit count is unknown, we can still prove that this
exit will not be taken. If we can prove that the predicate is monotonic,
fulfilled on first & last iteration, and no overflow happened in between,
then the check can be removed.

Differential Revision: https://reviews.llvm.org/D87832
Reviewed By: apilipenko

3 years ago[Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no...
Shilei Tian [Tue, 27 Oct 2020 04:02:23 +0000 (00:02 -0400)]
[Clang][OpenMP] Avoid unnecessary privatization of mapper array when there is no user defined mapper

In current implementation, if it requires an outer task, the mapper array will be privatized no matter whether it has mapper. In fact, when there is no mapper, the mapper array only contains number of nullptr. In the libomptarget, the use of mapper array is `if (mappers_array && mappers_array[i])`, which means we can directly set mapper array to nullptr if there is no mapper. This can avoid unnecessary data copy.

In this patch, the data privatization will not be emitted if the mapper array is nullptr. When it comes to the emit of task body, the nullptr will be used directly.

Reviewed By: jdoerfert

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

3 years agoFix calls to (p)read on macOS when size > INT32_MAX
Jonas Devlieghere [Tue, 27 Oct 2020 03:31:33 +0000 (20:31 -0700)]
Fix calls to (p)read on macOS when size > INT32_MAX

On macOS, the read and pread syscalls return EINVAL when the number of
bytes to read exceeds INT32_MAX:

https://github.com/apple/darwin-xnu/blob/a449c6a3b8014d9406c2ddbdc81795da24aa7443/bsd/kern/sys_generic.c#L355

rdar://68751407

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

3 years agoReland [AlwaysInliner] Pass callee AAResults to InlineFunction()
Arthur Eubanks [Sat, 17 Oct 2020 00:21:12 +0000 (17:21 -0700)]
Reland [AlwaysInliner] Pass callee AAResults to InlineFunction()

Test copied from noalias-calls.ll with small changes.

Reviewed By: asbirlea

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

3 years agoUse uint64_t for branch weights instead of uint32_t
Arthur Eubanks [Wed, 30 Sep 2020 19:11:46 +0000 (12:11 -0700)]
Use uint64_t for branch weights instead of uint32_t

CallInst::updateProfWeight() creates branch_weights with i64 instead of i32.
To be more consistent everywhere and remove lots of casts from uint64_t
to uint32_t, use i64 for branch_weights.

Reviewed By: davidxl

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

3 years agoRevert "[AlwaysInliner] Pass callee AAResults to InlineFunction()"
Arthur Eubanks [Tue, 27 Oct 2020 03:23:18 +0000 (20:23 -0700)]
Revert "[AlwaysInliner] Pass callee AAResults to InlineFunction()"

This reverts commit 504fbec7a61cdfbb5f6e1b25cf14afe5195ccaf6.

Test failure.

3 years ago[CostModel][X86] teach TTI calculate cost of chain of vector inserts/extracts more...
Bing1 Yu [Tue, 27 Oct 2020 02:34:07 +0000 (10:34 +0800)]
[CostModel][X86] teach TTI calculate cost of chain of vector inserts/extracts more precisely and correctly:In each 128-lane, if there is at least one index is demanded and not all indices are demanded...

In each 128-lane, if there is at least one index is demanded and not all
indices are demanded and this 128-lane is not the first 128-lane of the
legalized-vector, then this 128-lane needs a extracti128;
If in each 128-lane, there is at least one index is demanded, this 128-lane
needs a inserti128.

The following cases will help you build a better understanding:
Assume we insert several elements into a v8i32 vector in avx2,
Case#1: inserting into 1th index needs vpinsrd + inserti128
Case#2: inserting into 5th index needs extracti128 + vpinsrd +
inserti128
Case#3: inserting into 4,5,6,7 index needs 4*vpinsrd + inserti128.

Reviewed By: pengfei, RKSimon

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

3 years ago[AlwaysInliner] Pass callee AAResults to InlineFunction()
Arthur Eubanks [Sat, 17 Oct 2020 00:21:12 +0000 (17:21 -0700)]
[AlwaysInliner] Pass callee AAResults to InlineFunction()

Test copied from noalias-calls.ll with small changes.

Reviewed By: asbirlea

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

3 years ago[PlaceSafepoints] Pin tests to legacy PM
Arthur Eubanks [Mon, 26 Oct 2020 20:21:39 +0000 (13:21 -0700)]
[PlaceSafepoints] Pin tests to legacy PM

This pass isn't used in tree and can be ported to the NPM later on if desired.

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

3 years agoPort -objc-arc-expand to NPM
Arthur Eubanks [Mon, 26 Oct 2020 18:59:23 +0000 (11:59 -0700)]
Port -objc-arc-expand to NPM

Reviewed By: asbirlea

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

3 years agoPort -objc-arc-apelim to NPM
Arthur Eubanks [Mon, 26 Oct 2020 18:46:30 +0000 (11:46 -0700)]
Port -objc-arc-apelim to NPM

Reviewed By: asbirlea

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

3 years ago[mlir][SymbolTable] Use Identifier instead of StringRef when looking up symbol name...
River Riddle [Tue, 27 Oct 2020 02:31:10 +0000 (19:31 -0700)]
[mlir][SymbolTable] Use Identifier instead of StringRef when looking up symbol name attributes

Using an Identifier is much more efficient for attribute lookups because it uses pointer comparison as opposed to string comparison.

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

3 years ago[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets
River Riddle [Tue, 27 Oct 2020 02:31:04 +0000 (19:31 -0700)]
[mlir][StorageUniquer] Refactor parametric storage to use sharded dense sets

This revisions implements sharding in the storage of parametric instances to decrease lock contention by sharding out the allocator/mutex/etc. to use for a specific storage instance based on the hash key. This is a somewhat common approach to reducing lock contention on data structures, and is used by the concurrent hashmaps provided by folly/java/etc. For several compilations tested, this removed all/most lock contention from profiles and reduced compile time by several seconds.

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

3 years ago[Clang][OpenMP] Fixed an issue of segment fault when using target nowait
Shilei Tian [Tue, 27 Oct 2020 02:32:18 +0000 (22:32 -0400)]
[Clang][OpenMP] Fixed an issue of segment fault when using target nowait

The implementation of target nowait just wraps the target region into a task. The essential four parameters (base ptr, ptr, size, mapper) are taken as firstprivate such that they will be copied to the private location. When there is no user-defined mapper, the mapper variable will be nullptr. However, it will be still copied to the corresponding place. Therefore, a memcpy will be generated and the source pointer will be nullptr, causing a segmentation fault. The root cause is when calling `emitOffloadingArraysArgument`, the last argument `Options` has a field about whether it requires a task. It only takes depend clause into account. In this patch, the nowait clause is also included.

There're two things that will be done in another patches:
1. target data nowait has not been supported yet. D90099 added the support.
2. When there is no mapper, the mapper array can be nullptr no matter whether it requires outer task or not. It can avoid an unnecessary data copy. This is an optimization that is covered in D90101.

Reviewed By: jdoerfert

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

3 years ago[LSR] fix typo in comments and rename for a new added hook.
Chen Zheng [Tue, 27 Oct 2020 02:29:22 +0000 (22:29 -0400)]
[LSR] fix typo in comments and rename for a new added hook.

3 years agoSourceManager: clang-format the SrcMgr namespace, NFC
Duncan P. N. Exon Smith [Tue, 27 Oct 2020 01:26:36 +0000 (21:26 -0400)]
SourceManager: clang-format the SrcMgr namespace, NFC

3 years agoIR: Simplify two loops walking ConstantDataSequential, NFC
Duncan P. N. Exon Smith [Mon, 26 Oct 2020 23:03:23 +0000 (19:03 -0400)]
IR: Simplify two loops walking ConstantDataSequential, NFC

Follow-up to b2b7cf39d596b1528cd64015575b3f5d1461c011.

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

3 years agoUpdate email addresses in CODE_OWNERS.
Craig Topper [Tue, 27 Oct 2020 01:51:04 +0000 (18:51 -0700)]
Update email addresses in CODE_OWNERS.

3 years agoTeach `-fsanitize=fuzzer` to respect `-static` and `-static-libstdc++` when adding...
Chandler Carruth [Sun, 24 May 2020 07:02:38 +0000 (00:02 -0700)]
Teach `-fsanitize=fuzzer` to respect `-static` and `-static-libstdc++` when adding C++ standard libraries.

Summary:
Makes linking the sanitizers follow the same logic as the rest of the
driver with respect to the static linking strategy for the C++ standard
library.

Subscribers: mcrosier, cfe-commits

Tags: #clang

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

3 years ago[AMDGPU] Move WQM Pass after MI Scheduler
Carl Ritson [Tue, 27 Oct 2020 00:55:55 +0000 (09:55 +0900)]
[AMDGPU] Move WQM Pass after MI Scheduler

Exec mask manipulation inserted by SIWholeQuadMode barriers to
instruction scheduling.  Move the entire pass after the machine
instruction scheduler and make changes so pass is correct for
non-SSA operation.  These changes should leave the pass still
usable pre-scheduler, although tests have be updated to reflect
post-scheduler results.

Reviewed By: nhaehnle

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

3 years ago[NPM] Port -slsr to NPM
TaWeiTu [Tue, 27 Oct 2020 01:21:07 +0000 (09:21 +0800)]
[NPM] Port -slsr to NPM

`-separate-const-offset-from-gep` has not yet be ported, so some tests are not updated.

Reviewed By: aeubanks

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

3 years agoIR: Add a comment at missing std::make_unique calls from b2b7cf39d596b1528cd64015575b...
Duncan P. N. Exon Smith [Tue, 27 Oct 2020 01:18:16 +0000 (21:18 -0400)]
IR: Add a comment at missing std::make_unique calls from b2b7cf39d596b1528cd64015575b3f5d1461c011, NFC

3 years ago[mlir][Pattern] Add a new FrozenRewritePatternList class
River Riddle [Tue, 27 Oct 2020 00:25:01 +0000 (17:25 -0700)]
[mlir][Pattern] Add a new FrozenRewritePatternList class

This class represents a rewrite pattern list that has been frozen, and thus immutable. This replaces the uses of OwningRewritePatternList in pattern driver related API, such as dialect conversion. When PDL becomes more prevalent, this API will allow for optimizing a set of patterns once without the need to do this per run of a pass.

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

3 years ago[mlir][NFC] Move around the code related to PatternRewriting to improve layering
River Riddle [Tue, 27 Oct 2020 00:24:17 +0000 (17:24 -0700)]
[mlir][NFC] Move around the code related to PatternRewriting to improve layering

There are several pieces of pattern rewriting infra in IR/ that really shouldn't be there. This revision moves those pieces to a better location such that they are easier to evolve in the future(e.g. with PDL). More concretely this revision does the following:

* Create a Transforms/GreedyPatternRewriteDriver.h and move the apply*andFold methods there.
The definitions for these methods are already in Transforms/ so it doesn't make sense for the declarations to be in IR.

* Create a new lib/Rewrite library and move PatternApplicator there.
This new library will be focused on applying rewrites, and will also include compiling rewrites with PDL.

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

3 years ago[mlir][Pattern] Refactor the Pattern class into a "metadata only" class
River Riddle [Tue, 27 Oct 2020 00:23:41 +0000 (17:23 -0700)]
[mlir][Pattern] Refactor the Pattern class into a "metadata only" class

The Pattern class was originally intended to be used for solely matching operations, but that use never materialized. All of the pattern infrastructure uses RewritePattern, and the infrastructure for pure matching(Matchers.h) is implemented inline. This means that this class isn't a useful abstraction at the moment, so this revision refactors it to solely encapsulate the "metadata" of a pattern. The metadata includes the various state describing a pattern; benefit, root operation, etc. The API on PatternApplicator is updated to now operate on `Pattern`s as nothing special from `RewritePattern` is necessary.

This refactoring is also necessary for the upcoming use of PDL patterns alongside C++ rewrite patterns.

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

3 years ago[mlir] Add a conversion pass between PDL and the PDL Interpreter Dialect
River Riddle [Tue, 27 Oct 2020 00:23:16 +0000 (17:23 -0700)]
[mlir] Add a conversion pass between PDL and the  PDL Interpreter Dialect

The conversion between PDL and the interpreter is split into several different parts.
** The Matcher:

The matching section of all incoming pdl.pattern operations is converted into a predicate tree and merged. Each pattern is first converted into an ordered list of predicates starting from the root operation. A predicate is composed of three distinct parts:
* Position
  - A position refers to a specific location on the input DAG, i.e. an
    existing MLIR entity being matched. These can be attributes, operands,
    operations, results, and types. Each position also defines a relation to
    its parent. For example, the operand `[0] -> 1` has a parent operation
    position `[0]` (the root).
* Question
  - A question refers to a query on a specific positional value. For
  example, an operation name question checks the name of an operation
  position.
* Answer
  - An answer is the expected result of a question. For example, when
  matching an operation with the name "foo.op". The question would be an
  operation name question, with an expected answer of "foo.op".

After the predicate lists have been created and ordered(based on occurrence of common predicates and other factors), they are formed into a tree of nodes that represent the branching flow of a pattern match. This structure allows for efficient construction and merging of the input patterns. There are currently only 4 simple nodes in the tree:
* ExitNode: Represents the termination of a match
* SuccessNode: Represents a successful match of a specific pattern
* BoolNode/SwitchNode: Branch to a specific child node based on the expected answer to a predicate question.

Once the matcher tree has been generated, this tree is walked to generate the corresponding interpreter operations.

 ** The Rewriter:
The rewriter portion of a pattern is generated in a very straightforward manor, similarly to lowerings in other dialects. Each PDL operation that may exist within a rewrite has a mapping into the interpreter dialect. The code for the rewriter is generated within a FuncOp, that is invoked by the interpreter on a successful pattern match. Referenced values defined in the matcher become inputs the generated rewriter function.

An example lowering is shown below:

```mlir
// The following high level PDL pattern:
pdl.pattern : benefit(1) {
  %resultType = pdl.type
  %inputOperand = pdl.input
  %root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
  pdl.rewrite %root {
    pdl.replace %root with (%inputOperand)
  }
}

// is lowered to the following:
module {
  // The matcher function takes the root operation as an input.
  func @matcher(%arg0: !pdl.operation) {
    pdl_interp.check_operation_name of %arg0 is "foo.op" -> ^bb2, ^bb1
  ^bb1:
    pdl_interp.return
  ^bb2:
    pdl_interp.check_operand_count of %arg0 is 1 -> ^bb3, ^bb1
  ^bb3:
    pdl_interp.check_result_count of %arg0 is 1 -> ^bb4, ^bb1
  ^bb4:
    %0 = pdl_interp.get_operand 0 of %arg0
    pdl_interp.is_not_null %0 : !pdl.value -> ^bb5, ^bb1
  ^bb5:
    %1 = pdl_interp.get_result 0 of %arg0
    pdl_interp.is_not_null %1 : !pdl.value -> ^bb6, ^bb1
  ^bb6:
    // This operation corresponds to a successful pattern match.
    pdl_interp.record_match @rewriters::@rewriter(%0, %arg0 : !pdl.value, !pdl.operation) : benefit(1), loc([%arg0]), root("foo.op") -> ^bb1
  }
  module @rewriters {
    // The inputs to the rewriter from the matcher are passed as arguments.
    func @rewriter(%arg0: !pdl.value, %arg1: !pdl.operation) {
      pdl_interp.replace %arg1 with(%arg0)
      pdl_interp.return
    }
  }
}
```

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

3 years agoSourceManager: Use the same fake SLocEntry whenever it fails to load
Duncan P. N. Exon Smith [Mon, 19 Oct 2020 22:30:49 +0000 (18:30 -0400)]
SourceManager: Use the same fake SLocEntry whenever it fails to load

Instead of putting a fake `SLocEntry` at `LoadedSLocEntryTable[Index]`
when it fails to load in `SourceManager::loadSLocEntry`, allocate a fake
one. Unless someone is sniffing the address of the returned `SLocEntry`
(doubtful), this won't be a functionality change. Note that
`SLocEntryLoaded[Index]` wasn't being set to `true` either before or
after this change so no accessor is every going to look at
`LoadedSLocEntryTable[Index]`.

As a side effect, drop the `mutable` from `LoadedSLocEntryTable`.

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

3 years ago[NFC] Use [MC]Register in RegAllocPBQP & RegisterCoalescer
Gaurav Jain [Thu, 22 Oct 2020 22:38:04 +0000 (15:38 -0700)]
[NFC] Use [MC]Register in RegAllocPBQP & RegisterCoalescer

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

3 years ago[lldb][NativePDB] fix test load-pdb.cpp
Zequan Wu [Tue, 27 Oct 2020 00:12:51 +0000 (17:12 -0700)]
[lldb][NativePDB] fix test load-pdb.cpp

3 years ago[clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding
Nathan James [Tue, 27 Oct 2020 00:03:42 +0000 (00:03 +0000)]
[clang][NFC] Rearrange Comment Token and Lexer fields to reduce padding

Rearrange the fields to reduce the size of the classes

Reviewed By: gribozavr2

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

3 years agoFix checking for C++98 ICEs in C++11-and-later mode to not consider use
Richard Smith [Mon, 26 Oct 2020 23:59:02 +0000 (16:59 -0700)]
Fix checking for C++98 ICEs in C++11-and-later mode to not consider use
of a reference to be acceptable.

3 years ago[PowerPC] Implement Set Boolean Condition Instructions
Amy Kwan [Mon, 26 Oct 2020 16:16:05 +0000 (11:16 -0500)]
[PowerPC] Implement Set Boolean Condition Instructions

This patch implements the set boolean condition instructions introduced in
POWER10.

The set boolean condition instructions (set[n]bc[r]) are used during
the following situations:
- sign/zero/any extending i1 to an i32 or i64,
- reg+reg, reg+imm or floating point comparisons being sign/zero extended to i32 or i64,
- spilling CR bits (using the setnbc instruction)

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

3 years ago[profile] Suppress spurious 'expected profile to require unlock' warning
Vedant Kumar [Mon, 26 Oct 2020 23:23:06 +0000 (16:23 -0700)]
[profile] Suppress spurious 'expected profile to require unlock' warning

In %c (continuous sync) mode, avoid attempting to unlock an
already-unlocked profile.

The profile is only locked when profile merging is enabled.

3 years ago[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.
Adrian Prantl [Mon, 26 Oct 2020 23:09:35 +0000 (16:09 -0700)]
[DebugInfo] Expose Fortran array debug info attributes through DIBuilder.

The support of a few debug info attributes specifically for Fortran
arrays have been added to LLVM recently, but there's no way to take
advantage of them through DIBuilder. This patch extends
DIBuilder::createArrayType to enable the settings of those attributes.

Patch by Chih-Ping Chen!

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

3 years ago[mlir][Linalg] Miscalleneous enhancements to cover more fusion cases.
MaheshRavishankar [Mon, 26 Oct 2020 23:16:40 +0000 (16:16 -0700)]
[mlir][Linalg] Miscalleneous enhancements to cover more fusion cases.

Adds support for
- Dropping unit dimension loops for indexed_generic ops.
- Folding consecutive folding (or expanding) reshapes when the result
  (or src) is a scalar.
- Fixes to indexed_generic -> generic fusion when zero-dim tensors are
  involved.

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

3 years agoExplicitly check for entry basic block, rather than relying on MachineBasicBlock...
Rahman Lavaee [Mon, 26 Oct 2020 23:15:56 +0000 (16:15 -0700)]
Explicitly check for entry basic block, rather than relying on MachineBasicBlock::pred_empty.

Sometimes in unoptimized code, we have dangling unreachable basic blocks with no predecessors. Basic block sections should be emitted for those as well. Without this patch, the included test fails with a fatal error in `AsmPrinter::emitBasicBlockEnd`.

Reviewed By: tmsriram

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

3 years agoFixed release build after D89170
Stanislav Mekhanoshin [Mon, 26 Oct 2020 22:55:59 +0000 (15:55 -0700)]
Fixed release build after D89170

3 years ago[mlir] Document 'ParentOneOf' with the HasParent trait
Stephen Neuendorffer [Mon, 26 Oct 2020 22:45:57 +0000 (15:45 -0700)]
[mlir] Document 'ParentOneOf' with the HasParent trait

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

3 years ago[cmake] Add LLVM_UBSAN_FLAGS, to allow overriding UBSan flags
Vedant Kumar [Thu, 15 Oct 2020 02:09:50 +0000 (19:09 -0700)]
[cmake] Add LLVM_UBSAN_FLAGS, to allow overriding UBSan flags

Allow overriding the default set of flags used to enable UBSan when
building llvm.

This can be used to test new checks or opt out of certain checks.

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

3 years agoIR: Clarify ownership of ConstantDataSequentials, NFC
Duncan P. N. Exon Smith [Fri, 23 Oct 2020 22:51:02 +0000 (18:51 -0400)]
IR: Clarify ownership of ConstantDataSequentials, NFC

Change `ConstantDataSequential::Next` to a
`unique_ptr<ConstantDataSequential>` and update `CDSConstants` to a
`StringMap<unique_ptr<ConstantDataSequential>>`, making the ownership
more obvious.

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

3 years ago[MLIR] Fix AttributeInterface declaration.
Ulysse Beaugnon [Mon, 26 Oct 2020 22:40:40 +0000 (23:40 +0100)]
[MLIR] Fix AttributeInterface declaration.

Substitues `Type` by `Attribute` in the declaration of AttributeInterface. It
looks like the code was written by copy-pasting the definition of TypeInterface,
but the substitution of Type by Attribute was missing at some places.

Reviewed By: rriddle, ftynse

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

3 years ago[CodeView] Emit static data members as S_CONSTANTs.
Amy Huang [Wed, 7 Oct 2020 21:52:02 +0000 (14:52 -0700)]
[CodeView] Emit static data members as S_CONSTANTs.

We used to only emit static const data members in CodeView as
S_CONSTANTS when they were used; this patch makes it so they are always emitted.

I changed CodeViewDebug.cpp to find the static const members from the
class debug info instead of creating DIGlobalVariables in the IR
whenever a static const data member is used.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47580

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

3 years ago[TargetRegisterInfo] Fix a couple of typos in the comments
Quentin Colombet [Mon, 26 Oct 2020 22:04:36 +0000 (15:04 -0700)]
[TargetRegisterInfo] Fix a couple of typos in the comments

Spotted by Nicolas Guillemot <nguillemot@apple.com>.

Thanks Nicolas!

NFC

3 years ago[mlir] Do not print back 0 alignment in LLVM dialect 'alloca' op
Alex Zinenko [Mon, 26 Oct 2020 18:29:28 +0000 (19:29 +0100)]
[mlir] Do not print back 0 alignment in LLVM dialect 'alloca' op

The alignment attribute in the 'alloca' op treats the '0' value as 'unset'.
When parsing the custom form of the 'alloca' op, ignore the alignment attribute
with if its value is '0' instead of actually creating it and producing a
slightly different textually yet equivalent semantically form in the output.

Reviewed By: rriddle

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

3 years ago[nfc] [lldb] Refactor DWARFUnit::GetDIE
Jan Kratochvil [Mon, 26 Oct 2020 22:17:27 +0000 (23:17 +0100)]
[nfc] [lldb] Refactor DWARFUnit::GetDIE

Reduce indentation of the code by early returns for failed code paths.

3 years ago[NFC] Fixing comment heading for MachineStableHash.h.
Puyan Lotfi [Mon, 26 Oct 2020 22:06:38 +0000 (18:06 -0400)]
[NFC] Fixing comment heading for MachineStableHash.h.

Wrong filename and description.

3 years ago[libc++] Remove the reliance of several <random> tests on <iostream>
Louis Dionne [Mon, 26 Oct 2020 21:55:36 +0000 (17:55 -0400)]
[libc++] Remove the reliance of several <random> tests on <iostream>

3 years ago[mlir] NFC: properly align IR in comments
Lei Zhang [Mon, 26 Oct 2020 21:54:46 +0000 (17:54 -0400)]
[mlir] NFC: properly align IR in comments

Reviewed By: aartbik

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

3 years ago[AMDGPU] Use flat scratch instructions where available
Stanislav Mekhanoshin [Wed, 21 Oct 2020 21:27:03 +0000 (14:27 -0700)]
[AMDGPU] Use flat scratch instructions where available

The support is disabled by default. So far there is instruction
selection, spilling, and frame elimination. It also changes SP
from unswizzled to swizzled as used by flat scratch instructions,
so it cannot be mixed with MUBUF stack access.

At the very least missing:

- GlobalISel;
- Some optimizations in frame elimination in between vector
  and scalar ALU;
- It shall finally allow to always materialize frame index
  as an SGPR, but that is not implemented and frame elimination
  cannot handle it yet;
- Unaligned and/or multidword flat scratch shall work, but it
  is legalized now for MUBUF;
- Operand folding cannot optimize FI like with MUBUF yet;
- It will need scaling the value of the SP/FP in the DWARF
  expression to recover the unswizzled scratch address;

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

3 years agoRun test only if X86 target is available
Kiran Chandramohan [Mon, 26 Oct 2020 21:26:10 +0000 (21:26 +0000)]
Run test only if X86 target is available

This fixes failures in AArch64 buildbots by running the
clang/test/CodeGen/X86/att-inline-asm-prefix.c only when the X86
target is available.

3 years agoPrepend "__uniq" to symbol names hash with -funique-internal-linkage-names.
Sriraman Tallam [Mon, 26 Oct 2020 21:20:35 +0000 (14:20 -0700)]
Prepend "__uniq" to symbol names hash with -funique-internal-linkage-names.

Prepend the module name hash with a fixed string ".__uniq." which helps tools
that consume sampled profiles and attribute it to functions to understand
that this symbol belongs to a unique internal linkage type symbol.

Symbols with suffixes can result from various optimizations in the compiler.
Function Multiversioning, function splitting, parameter constant propogation,
unique internal linkage names.

External tools like sampled profile aggregators combine profiles from multiple
runs of a binary. They use various heuristics with symbols that have suffixes
to try and attribute the profile to the right function instance. For instance
multi-versioned symbols like foo.avx, foo.sse4.2, etc even though different
should be attributed to the same source function if a single function is
versioned, using attribute target_clones (supported in GCC but yet to land in
LLVM). Similarly, functions that are split (split part having a .cold suffix)
could have profiles for both the original and split symbols but would be
aggregated and attributed to the original function that was split.

Unique internal linkage functions however have different source instances and
the aggregator must not put them together but attribute it to the appropriate
function instance. To be sure that we are dealing with a symbol of a unique
internal linkage function, we would like to prepend the hash with a known
string ".__uniq." which these tools can check to understand the suffix type.

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

3 years ago[libunwind] Add -Wno-dll-attribute-on-redeclaration when building for windows
Martin Storsjö [Fri, 23 Oct 2020 19:51:21 +0000 (22:51 +0300)]
[libunwind] Add -Wno-dll-attribute-on-redeclaration when building for windows

It's not worth trying to fix these warnings within libunwind, instead
silence them.

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

3 years ago[NFC] Remove max_align.c LIT testcase
Xiangling Liao [Mon, 26 Oct 2020 21:11:57 +0000 (17:11 -0400)]
[NFC] Remove max_align.c LIT testcase

Since we fixed the definition of `SuitableAlign`[https://reviews.llvm.org/D88659],
`max_align_t` and `__BIGGEST_ALIGNMENT__` are not necessarily the same always.

The original testcase was added here: https://reviews.llvm.org/D59048

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

3 years agoTest to check backtraces with machine function splitting.
Sriraman Tallam [Mon, 26 Oct 2020 20:42:18 +0000 (13:42 -0700)]
Test to check backtraces with machine function splitting.

clang supports option -fsplit-machine-functions and this test checks if the
backtraces are sane when functions are split.

With -fsplit-machine-functions, a function with profiles can get split into 2
parts, the original function containing hot code and a cold part as determined
by the profile info and the cold cutoff threshold.. The cold part gets the
".cold" suffix to disambiguate its symbol from the hot part and can be placed
arbitrarily in the address space.

This test checks if the back-trace looks correct when the cold part is executed.

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

3 years agoAvoid unnecessary uses of `MDNode::getTemporary`, NFC
Duncan P. N. Exon Smith [Fri, 23 Oct 2020 21:55:41 +0000 (17:55 -0400)]
Avoid unnecessary uses of `MDNode::getTemporary`, NFC

This is a long-delayed follow-up to
5e5b85098dbeaea2cfa5d01695b5d2982634d7dd.

`TempMDNode` includes a bunch of machinery for RAUW, and should only be
used when necessary. RAUW wasn't being used in any of these cases... it
was just a placeholder for a self-reference.

Where the real node was using `MDNode::getDistinct`, just replace the
temporary argument with `nullptr`.

Where the real node was using `MDNode::get`, the `replaceOperandWith`
call was "promoting" the node to a distinct one implicitly due to
self-reference detection in `MDNode::handleChangedOperand`. The
`TempMDNode` was serving a purpose by delaying uniquing, but it's way
simpler to just call `MDNode::getDistinct` in the first place.

Note that using a self-reference at all in these places is a hold-over
from before `distinct` metadata existed. It was an old trick to create
distinct nodes. It would be intrusive to change, including bitcode
upgrades, etc., and it's harmless so I'm not sure there's much value in
removing it from existing schemas. After this commit it still has a tiny
memory cost (in the extra metadata operand) but no more overhead in
construction.

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

3 years ago[libc++] Get rid of <iostream> in a filesystem test
Louis Dionne [Mon, 26 Oct 2020 20:56:35 +0000 (16:56 -0400)]
[libc++] Get rid of <iostream> in a filesystem test

3 years ago[MemProf] Decouple memprof build from COMPILER_RT_BUILD_SANITIZERS
Teresa Johnson [Mon, 26 Oct 2020 20:36:01 +0000 (13:36 -0700)]
[MemProf] Decouple memprof build from COMPILER_RT_BUILD_SANITIZERS

The MemProf compiler-rt support relies on some of the support only built
when COMPILER_RT_BUILD_SANITIZERS was enabled. This showed up in some
initial bot failures, and I addressed those by making the memprof
runtime build also conditional on COMPILER_RT_BUILD_SANITIZERS
(3ed77ecd0a5d5e5c33770f0f9d3d75cf2f80c80b). However, this resulted in
another inconsistency with how the tests were set up that was hit by
Chromium:
  https://bugs.chromium.org/p/chromium/issues/detail?id=1142191

Undo the original bot fix and address this with a more comprehensive fix
that enables memprof to be built even when COMPILER_RT_BUILD_SANITIZERS
is disabled, by also building the necessary pieces under
COMPILER_RT_BUILD_MEMPROF.

Tested by configuring with a similar command as to what was used in the
failing Chromium configure. I reproduced the Chromium failure, as well
as the original bot failure I tried to fix in
3ed77ecd0a5d5e5c33770f0f9d3d75cf2f80c80b, with that fix reverted.
Confirmed it now works.

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

3 years ago[AIX] Also error on -G for link-only step
Xiangling Liao [Mon, 26 Oct 2020 20:23:30 +0000 (16:23 -0400)]
[AIX] Also error on -G for link-only step

Error on -G on AIX for all modes(preprocess, assemble, compile, link).

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

3 years ago[InstCombine] add folds for icmp+ctpop
Sanjay Patel [Mon, 26 Oct 2020 20:28:01 +0000 (16:28 -0400)]
[InstCombine] add folds for icmp+ctpop

https://alive2.llvm.org/ce/z/XjFPQJ

  define void @src(i64 %value) {
    %t0 = call i64 @llvm.ctpop.i64(i64 %value)
    %gt = icmp ugt i64 %t0, 63
    %lt = icmp ult i64 %t0, 64
    call void @use(i1 %gt, i1 %lt)
    ret void
  }

  define void @tgt(i64 %value) {
    %eq = icmp eq i64 %value, -1
    %ne = icmp ne i64 %value, -1
    call void @use(i1 %eq, i1 %ne)
    ret void
  }

  declare i64 @llvm.ctpop.i64(i64) #1
  declare void @use(i1, i1)

3 years ago[InstCombine] add tests for ctpop at bitwidth limit; NFC
Sanjay Patel [Mon, 26 Oct 2020 20:24:35 +0000 (16:24 -0400)]
[InstCombine] add tests for ctpop at bitwidth limit; NFC

3 years ago[InstCombine] reduce code duplication in icmp intrinsic folds; NFC
Sanjay Patel [Mon, 26 Oct 2020 20:17:29 +0000 (16:17 -0400)]
[InstCombine] reduce code duplication in icmp intrinsic folds; NFC

3 years ago[libc++] NFC: Minor refactoring in filesystem_test_helper.h to ease readability
Louis Dionne [Mon, 26 Oct 2020 20:33:15 +0000 (16:33 -0400)]
[libc++] NFC: Minor refactoring in filesystem_test_helper.h to ease readability

The variable declarations interleaved with logic was really difficult
to read. Instead, simply have two different implementations for _WIN32
and others.

3 years ago[GWP-ASan] Refactor memory mapping functions
Kostya Kortchinsky [Thu, 22 Oct 2020 22:53:50 +0000 (15:53 -0700)]
[GWP-ASan] Refactor memory mapping functions

In preparation for Fuchsia support, this CL refactors the memory
mapping functions.

The new functions are as follows:
- for Freeslots and Metadata:
  `void *map(size_t Size, const char *Name) const;`
  `void unmap(void *Ptr, size_t Size) const;`
- for the Pool:
  `void *reservePool(size_t Size);`
  `void commitPool(void *Ptr, size_t Size) const;`
  `void decommitPool(void *Ptr, size_t Size) const;`
  `void unreservePool();`
  Note that those don't need a `Name` parameter as those are fixed per
  function. `{reserve,unreserve}Pool` are not `const` because they will
  modify platform specific class member on Fuchsia.

I added a plethora of `assert()` as the initial code was not enforcing
page alignment for sizes and addresses, which caused problem in the
initial Fuchsia draft. All sizes should now be properly rounded up to
a page.

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

3 years agollvm-reduce: Test reduction for D88684 ( ee6e25e4391a6d3ac0a3c89615474e512f44cda6 )
David Blaikie [Mon, 26 Oct 2020 20:14:55 +0000 (13:14 -0700)]
llvm-reduce: Test reduction for D88684 ( ee6e25e4391a6d3ac0a3c89615474e512f44cda6 )

3 years ago[BitCode] decode nossp fn attr
Nick Desaulniers [Mon, 26 Oct 2020 20:00:50 +0000 (13:00 -0700)]
[BitCode] decode nossp fn attr

I missed this in https://reviews.llvm.org/D87956.

Reviewed By: void

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

3 years agoFix SROA with a PHI mergig values from a same block
Stanislav Mekhanoshin [Thu, 22 Oct 2020 18:14:35 +0000 (11:14 -0700)]
Fix SROA with a PHI mergig values from a same block

This fixes the bug 47945. It is legal to have a PHI with values
from from the same block, but values must stay the same. In this
case it is illegal to merge different values.

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

3 years ago[clangd] Add back dependency on proto generated targets
Kirill Bobyrev [Mon, 26 Oct 2020 19:37:43 +0000 (20:37 +0100)]
[clangd] Add back dependency on proto generated targets

Previous attempts:

15f6bad6d74a993e366c8fc93a9c91f213ac6bc3
58d0ef2d0466a893ab400f6a9829057b9d851038

The combination results in both link- and build-time dependency which is
the desired behavior.

3 years agoSourceManager: Fix an SLocEntry memory regression introduced with FileEntryRef
Duncan P. N. Exon Smith [Fri, 16 Oct 2020 18:39:28 +0000 (14:39 -0400)]
SourceManager: Fix an SLocEntry memory regression introduced with FileEntryRef

4dc5573acc0d2e7c59d8bac2543eb25cb4b32984 added `FileEntryRef` in order to
help enable sharing of a `FileManager` between `CompilerInstance`s.

It also added a `StringRef` with the filename on `FileInfo`. This
doubled `sizeof(FileInfo)`, bloating `sizeof(SLocEntry)`, of which we
have one for each (loaded and unloaded) file and macro expansion. This
causes a memory regression in modules builds.

Move the filename down into the `ContentCache`, which is a side data
structure for `FileInfo` that does not impact `sizeof(SLocEntry)`. Once
`FileEntryRef` is used for `ContentCache::OrigEntry` this can go away.

Differential Revision: https://reviews.llvm.org/D89580
Radar-Id: rdar://59908826

3 years agoAdd release tarballs for libclc
Aaron Puchert [Mon, 26 Oct 2020 19:32:46 +0000 (20:32 +0100)]
Add release tarballs for libclc

Fixes PR47917.

Reviewed By: tstellar

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

3 years ago[ARM][SchedModels] Move IsLDMBaseRegInListPred to ARMSchedule.td. NFC
Evgeny Leviant [Mon, 26 Oct 2020 19:31:41 +0000 (22:31 +0300)]
[ARM][SchedModels] Move IsLDMBaseRegInListPred to ARMSchedule.td. NFC

This predicate is not specific to cortex-a57 and can be used in other processor
models as well.

3 years agoMake sure Objective-C category support in IncludeSorter handles top-level imports
Joe Turner [Mon, 26 Oct 2020 18:54:42 +0000 (11:54 -0700)]
Make sure Objective-C category support in IncludeSorter handles top-level imports

Currently, this would not correctly associate a category with the related include if it was top-level (i.e. no slashes in the path). This ensures that we explicitly think about that case.

Reviewed By: gribozavr2

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

3 years ago[clang-tidy] Silence unused variable warning in Release builds. NFCI.
Benjamin Kramer [Mon, 26 Oct 2020 19:20:23 +0000 (20:20 +0100)]
[clang-tidy] Silence unused variable warning in Release builds. NFCI.

ExpandModularHeadersPPCallbacks.cpp:55:15: warning: unused variable 'FileEntry'
    for (auto FileEntry : FilesToRecord)
              ^

3 years ago[mlir] Convert MemRefReinterpretCastOp to LLVM.
Alexander Belyaev [Fri, 23 Oct 2020 12:34:50 +0000 (14:34 +0200)]
[mlir] Convert MemRefReinterpretCastOp to LLVM.

https://llvm.discourse.group/t/rfc-standard-memref-cast-ops/1454/15

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

3 years agoRevert "Revert "Ensure that checkInitIsICE is called exactly once for every variable""
Zequan Wu [Mon, 26 Oct 2020 19:08:57 +0000 (12:08 -0700)]
Revert "Revert "Ensure that checkInitIsICE is called exactly once for every variable""

This reverts commit a2ac64dd905422ed84e273a98d846df022a5e2ec.

3 years agoRevert "Ensure that checkInitIsICE is called exactly once for every variable"
Zequan Wu [Mon, 26 Oct 2020 18:58:45 +0000 (11:58 -0700)]
Revert "Ensure that checkInitIsICE is called exactly once for every variable"
This causing `Assertion Result && "Could not evaluate expression"' failed` at https://bugs.chromium.org/p/chromium/issues/detail?id=1142009

This reverts commit 76c0092665867a6defcd328ba0d0d976eb65d991.

3 years ago[AMDGPU] Fix VC warning about singed/unsigned comparison. NFC.
Stanislav Mekhanoshin [Mon, 26 Oct 2020 18:53:40 +0000 (11:53 -0700)]
[AMDGPU] Fix VC warning about singed/unsigned comparison. NFC.

This is the warning reported in https://reviews.llvm.org/D89599

3 years ago[libc++] NFC: Consistent indentation for buildkite-pipeline.yml
Louis Dionne [Mon, 26 Oct 2020 18:53:59 +0000 (14:53 -0400)]
[libc++] NFC: Consistent indentation for buildkite-pipeline.yml

3 years ago[lldb][NativePDB] fix test load-pdb.cpp
Zequan Wu [Mon, 26 Oct 2020 18:37:56 +0000 (11:37 -0700)]
[lldb][NativePDB] fix test load-pdb.cpp

3 years ago[Clang][CodeGen] fix failed assertion
Nick Desaulniers [Mon, 26 Oct 2020 18:25:23 +0000 (11:25 -0700)]
[Clang][CodeGen] fix failed assertion

Ensure we can emit symbol aliases via function attribute
even when function signatures contain incomplete types.

Via bugreport:
https://reviews.llvm.org/D66492#2350947

Reviewed By: erichkeane

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

3 years ago[libc++abi] Make sure we can run the tests in Standalone mode
Louis Dionne [Mon, 26 Oct 2020 18:25:49 +0000 (14:25 -0400)]
[libc++abi] Make sure we can run the tests in Standalone mode

The tests would previously fail if the `python` executable wasn't found,
because we were missing the mandatory find_package.

3 years agoSourceManager: Return non-const references in getOrCreateContentCache and related...
Duncan P. N. Exon Smith [Fri, 23 Oct 2020 19:14:51 +0000 (15:14 -0400)]
SourceManager: Return non-const references in getOrCreateContentCache and related, NFC

Update a few APIs to return non-const references instead of pointers,
and remove associated `const_cast`s and non-null assertions.

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

3 years ago[AArch64] Extend tests for insertelement improvements.
Florian Hahn [Mon, 26 Oct 2020 17:05:40 +0000 (17:05 +0000)]
[AArch64] Extend tests for insertelement improvements.

Extends the tests added in a562dc82a8d9488d35ff535302716141bc6feaa3 to
cover more vector variants.

3 years ago[mlir][vector] Update doc strings for insert_map/extract_map and fix insert_map semantic
Thomas Raoux [Mon, 26 Oct 2020 17:28:48 +0000 (10:28 -0700)]
[mlir][vector] Update doc strings for insert_map/extract_map and fix insert_map semantic

Based on discourse discussion, fix the doc string and remove examples with
wrong semantic. Also fix insert_map semantic by adding missing operand for
vector we are inserting into.

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

3 years ago[SVE] Fix TypeSize warning in llvm::getGEPInductionOperand
Joe Ellis [Mon, 26 Oct 2020 17:40:31 +0000 (17:40 +0000)]
[SVE] Fix TypeSize warning in llvm::getGEPInductionOperand

We do not need to use the implicit cast here. We can instead can rely on
a comparison between two TypeSize objects instead. This algorithm will
work fine with scalable vectors.

Reviewed By: DavidTruby

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

3 years ago[SVE][InstCombine] Fix TypeSize warning in canReplaceGEPIdxWithZero
Joe Ellis [Mon, 26 Oct 2020 17:40:25 +0000 (17:40 +0000)]
[SVE][InstCombine] Fix TypeSize warning in canReplaceGEPIdxWithZero

The warning would fire when calling canReplaceGEPIdxWithZero on a GEP
whose source element type is a scalable vector. The size of scalable
vector types is not known, so this optimization cannot be performed.

This patch fixes the issue by:

- bailing out early in this routine if the GEP instruction's source
  element type is a scalable vector.

- making use of getFixedSize -- this removes the dependency on the
  deprecated interface.

Reviewed By: fpetrogalli

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

3 years ago[SVE][AArch64] Fix TypeSize warning in GEP cost analysis
Joe Ellis [Mon, 26 Oct 2020 17:40:17 +0000 (17:40 +0000)]
[SVE][AArch64] Fix TypeSize warning in GEP cost analysis

The warning would fire when calling getGEPCost for analyzing the cost of
a GEP instruction. This would result in the use of the now deprecated
implicit cast of TypeSize to uint64_t through the overloaded operator.

This patch fixes the issue by using getKnownMinSize instead of the
implicit cast. This is possible because the code is already
scalable-vector aware. The semantic behaviour of the code is unchanged
by this patch.

Reviewed By: sdesmalen, fpetrogalli

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

3 years ago[SVE][AArch64] Fix TypeSize warning in loop vectorization legality
Joe Ellis [Mon, 26 Oct 2020 17:40:01 +0000 (17:40 +0000)]
[SVE][AArch64] Fix TypeSize warning in loop vectorization legality

The warning would fire when calling isDereferenceableAndAlignedInLoop
with a scalable load. Calling isDereferenceableAndAlignedInLoop with a
scalable load would result in the use of the now deprecated implicit
cast of TypeSize to uint64_t through the overloaded operator.

This patch fixes this issue by:

- no longer considering vector loads as candidates in
  canVectorizeWithIfConvert. This doesn't make sense in the context of
  identifying scalar loads to vectorize.

- making use of getFixedSize inside isDereferenceableAndAlignedInLoop --
  this removes the dependency on the deprecated interface, and will
  trigger an assertion error if the function is ever called with a
  scalable type.

Reviewed By: sdesmalen

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