OSDN Git Service
Sanjay Patel [Wed, 20 May 2020 16:44:35 +0000 (12:44 -0400)]
[InstCombine] add tests for reassociative fsub/fadd expressions; NFC
Hiroshi Yamauchi [Tue, 19 May 2020 19:12:26 +0000 (12:12 -0700)]
[ProfileSummary] Refactor getFromMD to prepare for another optional field. NFC.
Summary:
Rename 'i' to 'I'.
Factor out the optional field handling to getOptionalVal().
Split out of D79951.
Reviewers: davidxl
Subscribers: eraman, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80230
Jonas Devlieghere [Wed, 20 May 2020 16:21:45 +0000 (09:21 -0700)]
[lldb/Driver] Error out when encountering unknown arguments
There appears to be consensus in D80165 that this is the desired
behavior and I personally agree.
Differential revision: https://reviews.llvm.org/D80226
Simon Pilgrim [Wed, 20 May 2020 16:29:39 +0000 (17:29 +0100)]
FormatAdapters.h - remove unused SmallString.h include. NFC.
Simon Pilgrim [Wed, 20 May 2020 15:59:37 +0000 (16:59 +0100)]
GenericError.h - remove unused StringRef.h include. NFC.
Arthur Eubanks [Mon, 16 Mar 2020 19:32:36 +0000 (12:32 -0700)]
[X86] Codegen for preallocated
See https://reviews.llvm.org/D74651 for the preallocated IR constructs
and LangRef changes.
In X86TargetLowering::LowerCall(), if a call is preallocated, record
each argument's offset from the stack pointer and the total stack
adjustment. Associate the call Value with an integer index. Store the
info in X86MachineFunctionInfo with the integer index as the key.
This adds two new target independent ISDOpcodes and two new target
dependent Opcodes corresponding to @llvm.call.preallocated.{setup,arg}.
The setup ISelDAG node takes in a chain and outputs a chain and a
SrcValue of the preallocated call Value. It is lowered to a target
dependent node with the SrcValue replaced with the integer index key by
looking in X86MachineFunctionInfo. In
X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to an
%esp adjustment, the exact amount determined by looking in
X86MachineFunctionInfo with the integer index key.
The arg ISelDAG node takes in a chain, a SrcValue of the preallocated
call Value, and the arg index int constant. It produces a chain and the
pointer fo the arg. It is lowered to a target dependent node with the
SrcValue replaced with the integer index key by looking in
X86MachineFunctionInfo. In
X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to a
lea of the stack pointer plus an offset determined by looking in
X86MachineFunctionInfo with the integer index key.
Force any function containing a preallocated call to use the frame
pointer.
Does not yet handle a setup without a call, or a conditional call.
Does not yet handle musttail. That requires a LangRef change first.
Tried to look at all references to inalloca and see if they apply to
preallocated. I've made preallocated versions of tests testing inalloca
whenever possible and when they make sense (e.g. not alloca related,
inalloca edge cases).
Aside from the tests added here, I checked that this codegen produces
correct code for something like
```
struct A {
A();
A(A&&);
~A();
};
void bar() {
foo(foo(foo(foo(foo(A(), 4), 5), 6), 7), 8);
}
```
by replacing the inalloca version of the .ll file with the appropriate
preallocated code. Running the executable produces the same results as
using the current inalloca implementation.
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77689
Jonas Devlieghere [Wed, 20 May 2020 16:10:20 +0000 (09:10 -0700)]
[lldb/Reproducers] Support reproducers for PlatformRemoteGDBServer
Add reproducer support to PlatformRemoteGDBServer. The logic is
essentially the same as for ProcessGDBRemote. During capture we record
the GDB packets and during replay we connect to a replay server.
This fixes TestPlatformClient.py when run form a reproducer.
Differential Revision: https://reviews.llvm.org/D80224
MaheshRavishankar [Wed, 20 May 2020 15:57:32 +0000 (08:57 -0700)]
[mlir][Linalg] Add producer-consumer fusion when producer is a ConstantOp
and Consumer is a GenericOp.
Differential Revision: https://reviews.llvm.org/D79838
Jonas Devlieghere [Tue, 19 May 2020 21:01:23 +0000 (14:01 -0700)]
[lldb/Reproducers] Update macosx remote tests for passive replay
Skip tests or part thereof that are not supposed to work with replay.
Matt Arsenault [Mon, 18 May 2020 17:47:49 +0000 (13:47 -0400)]
AMDGPU/GlobalISel: Fix splitting 64-bit extensions
This was replicating the low bits into the high bits for G_ZEXT,
rather than using 0.
Nicolas Vasilache [Wed, 20 May 2020 13:52:55 +0000 (09:52 -0400)]
[mlir][Vector] Add option to fully unroll for VectorTransfer to SCF lowering
Summary:
Previously, the only support partial lowering from vector transfers to SCF was
going through loops. This requires a dedicated allocation and extra memory
roundtrips because LLVM aggregates cannot be indexed dynamically (for more
details see the [deep-dive](https://mlir.llvm.org/docs/Dialects/Vector/#deeperdive)).
This revision allows specifying full unrolling which removes this additional roundtrip.
This should be used carefully though because full unrolling will spill, negating the
benefits of removing the interim alloc in the first place.
Proper heuristics are left for a later time.
Differential Revision: https://reviews.llvm.org/D80100
Alexey Bataev [Wed, 20 May 2020 14:54:53 +0000 (10:54 -0400)]
[OPENMP][DOCS]Update status of implemented features, NFC.
Alex Zinenko [Wed, 20 May 2020 14:00:57 +0000 (16:00 +0200)]
[mlir] ensureRegionTerminator: take OpBuilder
The SingleBlockImplicitTerminator op trait provides a function
`ensureRegionTerminator` that injects an appropriate terminator into the block
if necessary, which is used during operation constructing and parsing.
Currently, this function directly modifies the IR using low-level APIs on
Operation and Block. If this function is called from a conversion pattern,
these manipulations are not reflected in the ConversionPatternRewriter and thus
cannot be undone or, worse, lead to tricky memory errors and malformed IR.
Change `ensureRegionTerminator` to take an instance of `OpBuilder` instead of
`Builder`, and use it to construct the block and the terminator when required.
Maintain overloads taking an instance of `Builder` and creating a simple
`OpBuilder` to use in parsers, which don't have an `OpBuilder` and cannot
interact with the dialect conversion mechanism. This change was one of the
reasons to make `<OpTy>::build` accept an `OpBuilder`.
Differential Revision: https://reviews.llvm.org/D80138
Alex Zinenko [Wed, 20 May 2020 14:00:47 +0000 (16:00 +0200)]
[mlir] SCFToStandard: support any ops in and around the control flow ops
Originally, the SCFToStandard conversion only declared Ops from the Standard
dialect as legal after conversion. This is undesirable as it would fail the
conversion if the SCF ops contained ops from any other dialect. Furthermore,
this would be problematic for progressive lowering of `scf.parallel` to
`scf.for` after `ensureRegionTerminator` is made aware of the pattern rewriting
infrastructure because it creates temporary `scf.yield` operations declared
illegal. Change the legalization target to declare any op other than `scf.for`,
`scf.if` and `scf.parallel` legal.
Differential Revision: https://reviews.llvm.org/D80137
Alex Zinenko [Wed, 20 May 2020 14:00:37 +0000 (16:00 +0200)]
[mlir] Erase or clear blocks through ConversionPatternRewriter when applicable
Multiple places in the code base were erasing Blocks or operations in them
using in-place modifications (`Block::erase` or `Block::clear`) unknown to
ConversionPatternRewriter. These operations could not be undone if the pattern
failed and could lead to inconsistent in-memory state of the IR with dangling
pointers. Use `ConversionPatternRewriter::eraseOp` and `::eraseBlock` instead.
Differential Revision: https://reviews.llvm.org/D80136
Alex Zinenko [Wed, 20 May 2020 14:00:27 +0000 (16:00 +0200)]
[mlir] DialectConversion: support erasing blocks
PatternRewriter has support for erasing a Block from its parent region, but
this feature has not been implemented for ConversionPatternRewriter that needs
to keep track of and be able to undo block actions. Introduce support for
undoing block erasure in the ConversionPatternRewriter by marking all the ops
it contains for erasure and by detaching the block from its parent region. The
detached block is stored in the action description and is not actually deleted
until the rewrites are applied.
Differential Revision: https://reviews.llvm.org/D80135
Alex Zinenko [Wed, 20 May 2020 13:59:54 +0000 (15:59 +0200)]
[mlir] DialectConversion: avoid double-free when rolling back op creation
Dialect conversion infrastructure may roll back op creation by erasing the
operations in the reverse order of their creation. While this guarantees uses
of values will be deleted before their definitions, this does not guarantee
that a parent operation will not be deleted before its child. (This may happen
in case of block inlining or if child operations, such as terminators, are
created in the parent's `build` function before the parent itself.) Handle the
parent/child relationship between ops by removing all child ops from the blocks
before erasing the parent. The child ops remain live, detached from a block,
and will be safely destroyed in their turn, which may come later than that of
the parent.
Differential Revision: https://reviews.llvm.org/D80134
Alex Zinenko [Wed, 20 May 2020 13:59:44 +0000 (15:59 +0200)]
[mlir] Toy tutorial: insert terminators at the end of the loop during rewrite
When creating temporary `scf.for` loops in `toy.print` lowering, the block
insertion point was erronously set up to the beginning of the block rather than
to its end, contradicting the comment just above the insertion point change.
The code was nevertheless operational because `scf.for` was setting up its
`scf.yield` terminator in an opaque to the pattern rewriting infrastructure
way. Now that it is about to change, the problem would have been exposed and
lead to conversion failures.
Differential Revision: https://reviews.llvm.org/D80133
Nicolas Vasilache [Wed, 20 May 2020 13:43:58 +0000 (09:43 -0400)]
[mlir][Linalg] NFC - Simplify GenericNestLoop builder
Summary: This revision trims unnecessary complexity.
Differential Revision: https://reviews.llvm.org/D80290
Nicolas Vasilache [Wed, 20 May 2020 13:10:21 +0000 (09:10 -0400)]
[mlir][Linalg] Refactor linalg tiling
Summary:
This revision refactors the Linalg tiling pass to be written as pattern applications and retires the use of the folder in Linalg tiling.
In the early days, tiling was written as a pass that would create (partially) folded and canonicalized operations on the fly for better composability.
As this evolves towards composition of patterns, the pass-specific folder is counter-productive and is retired.
The tiling options struct evolves to take a tile size creation function which allows materializing tile sizes on the fly (in particular constant tile sizes). This plays better with folding and DCE.
With the folder going away in Tiling, the check on whether subviews are the same in linalg fusion needs to be more robust. This revision also implements such a check.
In the current form, there are still some canonicalizations missing due to AffineMin/Max ops fed by scf::ForOp. These will be improved at a later time.
Differential Revision: https://reviews.llvm.org/D80267
Simon Pilgrim [Wed, 20 May 2020 13:38:25 +0000 (14:38 +0100)]
MachineMemOperand.h - replace Type.h with full GlobalValue.h include to fix -Wundefined-inline warnings.
Simon Pilgrim [Wed, 20 May 2020 13:31:01 +0000 (14:31 +0100)]
DIPrinter.h - reduce unnecessary includes to forward declarations. NFC.
Jay Foad [Wed, 20 May 2020 13:29:55 +0000 (14:29 +0100)]
[AMDGPU] Add the test from D49097.
Raphael Isemann [Wed, 20 May 2020 13:02:16 +0000 (15:02 +0200)]
[lldb][NFC] Minor NamespaceMap refactor
Melanie Blower [Fri, 15 May 2020 14:30:49 +0000 (07:30 -0700)]
[clang] FastMathFlags.allowContract should be initialized only from FPFeatures.allowFPContractAcrossStatement
Summary: Fix bug introduced in D72841 adding support for pragma float_control
Reviewers: rjmccall, Anastasia
Differential Revision: https://reviews.llvm.org/D79903
Alex Zinenko [Tue, 19 May 2020 14:43:54 +0000 (16:43 +0200)]
[mlir] NFC: rename tests related to SCF dialect from Loops to SCF
The dialect and conversions from/to it were renamed in previous commits.
Differential Revision: https://reviews.llvm.org/D80216
Simon Pilgrim [Wed, 20 May 2020 13:00:52 +0000 (14:00 +0100)]
GenericDomTreeConstruction.h - reorder includes. NFC.
Simon Pilgrim [Wed, 20 May 2020 12:52:22 +0000 (13:52 +0100)]
PseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC.
Exposes an implicit dependency on Type.h in MachineMemOperand.h
Simon Pilgrim [Wed, 20 May 2020 09:11:06 +0000 (10:11 +0100)]
PseudoSourceValue.h - remove unused operator declaration. NFC.
MSVC was warning that the definition for the MachineMemOperand stream handler doesn't exist.
Artem Dergachev [Wed, 20 May 2020 11:31:06 +0000 (14:31 +0300)]
[analyzer] Get scan-view executable from environment.
Fixes "Use of uninitialized value $ScanView in exec" error on systems
with scan-view executable not located in the expected place.
Patch by Oliver Tušla!
Differential Revision: https://reviews.llvm.org/D77880
Raphael Isemann [Wed, 20 May 2020 11:29:04 +0000 (13:29 +0200)]
Revert "[lldb-server] Reset stop reason of all threads when resuming"
This reverts commit
56de738d18e11c86169f0248b97b2854c37e35ce.
This broke the aarch64 bot. Reverting on behalf of jarin.
Tres Popp [Tue, 19 May 2020 04:21:00 +0000 (06:21 +0200)]
[mlir] Add custom assembly formats to shape.witness ops.
The assembly formats are essentially the generic forms without
quotations and type information.
Differential Revision: https://reviews.llvm.org/D80180
Pierre-vh [Wed, 8 Apr 2020 13:31:21 +0000 (14:31 +0100)]
[Target][ARM] Make Low Overhead Loops coexist with VPT blocks.
Previously, the LowOverheadLoops pass couldn't handle VPT blocks
with conditions, or with multiple VCTPs. This patch improves the
LowOverheadLoops pass so it can handle those cases.
It also adds support for VCMPs before the VCTP.
Differential Revision: https://reviews.llvm.org/D78206
Florian Hahn [Wed, 20 May 2020 11:21:06 +0000 (12:21 +0100)]
[Polly] Update ScalarEvolutionExpander.h include.
Sam Parker [Wed, 20 May 2020 08:18:42 +0000 (09:18 +0100)]
[NFCI][CostModel] Refactor getIntrinsicInstrCost
Combine the two API calls into one by introducing a structure to hold
the relevant data. This has the added benefit of moving the boiler
plate code for arguments and flags, into the constructors. This is
intended to be a non-functional change, but the complicated web of
logic involved here makes it very hard to guarantee.
Differential Revision: https://reviews.llvm.org/D79941
Dmitri Gribenko [Wed, 20 May 2020 09:59:47 +0000 (11:59 +0200)]
Revert "[lldb/DataFormatter] Check for overflow when finding NSDate epoch"
This reverts commit
b783f70a42575a5d9147bea1ac97e872370fe55b. This
change had multiple issues which required post-commit fixups, and not
all issues are fixed yet. In particular, the LLDB build bot for ARM is
still broken. There is also an ongoing conversation in the original
phabricator review about whether there is undefined behavior in the
code.
Dmitri Gribenko [Wed, 20 May 2020 09:59:27 +0000 (11:59 +0200)]
Revert "[lldb/test] Relax NSDate mock test for non-Apple platforms"
This reverts commit
fff3a8464d4d518c7086c928fba967908eb294d7. It is a
follow-up to
b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm
reverting -- see the explanation in that revert.
Dmitri Gribenko [Wed, 20 May 2020 09:58:59 +0000 (11:58 +0200)]
Revert "[lldb/test] Disable NSDate format check under _WIN32"
This reverts commit
e3aa4cd9dbcee6441f51102e3958c35321698c67. It is a
follow-up to
b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm
reverting -- see the explanation in that revert.
Dmitri Gribenko [Wed, 20 May 2020 09:56:16 +0000 (11:56 +0200)]
Revert "Silence warnings around int/float conversions."
This reverts commit
15ee8a3a58223b48afbe33cb60084f864ef20889. It is a
follow-up to
b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm
reverting -- see the explanation in that revert.
Dmitri Gribenko [Wed, 20 May 2020 09:55:36 +0000 (11:55 +0200)]
Revert "[lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h""
This reverts commit
82dbf4aca84ec889d0dc390674ff44e30441bcfd. It is a
follow-up to
b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm
reverting -- see the explanation in that revert.
Georgii Rymar [Mon, 18 May 2020 17:46:28 +0000 (20:46 +0300)]
[yaml2obj] - Implement the "Offset" property for the Fill Chunk.
Similar to a regular section chunk, a Fill should have this property.
This patch implements it.
Differential revision: https://reviews.llvm.org/D80190
Raphael Isemann [Wed, 20 May 2020 09:57:52 +0000 (11:57 +0200)]
[lldb][NFC] Modernize TestCPPStaticMethods
Now with LLVM code style and expect_expr for checking. Also some minor changes
to be more similar to the structure we use in other tests.
LLVM GN Syncbot [Wed, 20 May 2020 09:58:47 +0000 (09:58 +0000)]
[gn build] Port
bcbd26bfe61
Benjamin Kramer [Wed, 20 May 2020 09:55:37 +0000 (11:55 +0200)]
Florian Hahn [Wed, 20 May 2020 09:08:08 +0000 (10:08 +0100)]
[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC).
SCEVExpander modifies the underlying function so it is more suitable in
Transforms/Utils, rather than Analysis. This allows using other
transform utils in SCEVExpander.
This patch was originally committed as
b8a3c34eee06, but broke the
modules build, as LoopAccessAnalysis was using the Expander.
The code-gen part of LAA was moved to lib/Transforms recently, so this
patch can be landed again.
Reviewers: sanjoy.google, efriedma, reames
Reviewed By: sanjoy.google
Differential Revision: https://reviews.llvm.org/D71537
Kang Zhang [Wed, 20 May 2020 09:40:25 +0000 (09:40 +0000)]
[PowerPC] Enable machine verification for 3 passes
Summary:
For PowerPC, there are 3 passes has disabled the machine verification.
```
PPCTargetMachine.cpp: addPass(&LiveVariablesID, false);
PPCTargetMachine.cpp: addPass(createPPCEarlyReturnPass(), false);
PPCTargetMachine.cpp: addPass(createPPCBranchSelectionPass(), false);
```
This patch is to enable machine verification for above three passes.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D79840
Georgii Rymar [Tue, 19 May 2020 09:44:26 +0000 (12:44 +0300)]
[llvm-readobj][test] - Deduplicate YAMLs in gnuhash.test and hash-table.test. NFCI.
We can use `-D` to generalize inputs. This patch does it.
Differential revision: https://reviews.llvm.org/D80199
Emre Kultursay [Wed, 20 May 2020 09:11:12 +0000 (11:11 +0200)]
Use IPv4 for Android connections
Summary:
When adb client connects to adb server, or when lldb connects to
lldb server on Android device, IPv6 does not work (at least on
Windows it does not work).
For Android on Windows, each IPv6 failure (fallback-to-IPv4) wastes
2 seconds, and since this is called 5 times when attaching, LLDB
is wasting 10 seconds. This CL brings a big improvement to attach latency.
Reviewers: labath
Reviewed By: labath
Subscribers: aadsm, clayborg, mgrang, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D79757
Jaroslav Sevcik [Wed, 20 May 2020 08:59:57 +0000 (10:59 +0200)]
[lldb-server] Reset stop reason of all threads when resuming
Summary:
This patch makes the stop reason reset logic similar to MacOS' debugserver, where exceptions are reset for all threads when resuming process for stepping or continuing (see [[ https://github.com/llvm/llvm-project/blob/
96f3ea0d21b48ca088355db10d4d1a2e9bc9f884/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp#L433 | MachThreadList::ProcessWillResume ]] and [[ https://github.com/llvm/llvm-project/blob/
96f3ea0d21b48ca088355db10d4d1a2e9bc9f884/lldb/tools/debugserver/source/MacOSX/MachThread.cpp#L363 | MachThread::ThreadWillResume ]]).
Resetting stop reasons on resume fixes problems where LLDB spuriously reports SIGTRAP signal stop reason for deleted breakpoints (both internal and public) and where LLDB stops on an internal breakpoint while stepping over while a breakpoint is hit in another thread. See [[ https://bugs.llvm.org/show_bug.cgi?id=45642 | PR45642 ]] for details.
Reviewed By: jingham, labath
Differential Revision: https://reviews.llvm.org/D79308
Simon Pilgrim [Wed, 20 May 2020 08:51:52 +0000 (09:51 +0100)]
SLPVectorizer.h - remove unused CommandLine.h include. NFC
Simon Pilgrim [Tue, 19 May 2020 16:12:32 +0000 (17:12 +0100)]
CommandFlags.h - remove unnecessary includes. NFC.
Replace with forward declarations and move necessary includes down to source files.
Exposes an implicit dependency on TargetMachine.h in llvm-opt-fuzzer.cpp
Jay Foad [Mon, 18 May 2020 15:24:18 +0000 (16:24 +0100)]
[IR] Simplify BasicBlock::removePredecessor. NFCI.
This is the second attempt at landing this patch, after fixing the
KeepOneInputPHIs behaviour to also keep zero input PHIs.
Differential Revision: https://reviews.llvm.org/D80141
Ying Yi [Fri, 15 May 2020 13:11:18 +0000 (14:11 +0100)]
Github access test: remove unnecessary whitespaces.
Pavel Labath [Wed, 20 May 2020 08:08:09 +0000 (10:08 +0200)]
Revert "Add terminateCommands to lldb-vscode protocol"
This reverts commit
a3609b0ec68522cb417ffe36ce9eb2e25ca61578, because it
makes a number of lldb-vscode tests flaky.
Tres Popp [Tue, 19 May 2020 07:05:09 +0000 (09:05 +0200)]
[mlir] Custom printing/parsing for Shape::AssumingOp
Summary:
Additionally, this adds traits and builder methods to AssumingYieldOp
and names the input witness to the AssumingOp.
Differential Revision: https://reviews.llvm.org/D80187
Tres Popp [Tue, 19 May 2020 04:24:41 +0000 (06:24 +0200)]
[mlir] Mark witness related Shape dialect ops as NoSideEffect.
Differential Revision: https://reviews.llvm.org/D80179
Balázs Kéri [Wed, 20 May 2020 06:58:17 +0000 (08:58 +0200)]
[Analyzer][StreamChecker] Added support for 'fread' and 'fwrite'.
Summary:
Stream functions `fread` and `fwrite` are evaluated
and preconditions checked.
A new bug type is added for a (non fatal) warning if `fread`
is called in EOF state.
Reviewers: Szelethus, NoQ, dcoughlin, baloghadamsoftware, martong, xazax.hun
Reviewed By: Szelethus
Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80015
Jay Foad [Wed, 20 May 2020 07:01:43 +0000 (08:01 +0100)]
Revert "[IR] Simplify BasicBlock::removePredecessor. NFCI."
This reverts commit
59f49f7ee7f3397e000f7e11facb4a5605cd1cab.
It was causing buildbot failures.
mydeveloperday [Wed, 20 May 2020 06:48:45 +0000 (07:48 +0100)]
[clang-format] [PR42164] Add Option to Break before While
Summary:
Its currently not possible to recreate the GNU style using the `BreakBeforeBraces: Custom` style due to a lack of missing `BeforeWhile` in the `BraceWrappingFlags`
The following request was raised to add `BeforeWhile` in a `do..while` context like `BeforeElse` and `BeforeCatch` to give greater control over the positioning of the `while`
https://bugs.llvm.org/show_bug.cgi?id=42164
Reviewers: krasimir, mitchell-stellar, sammccall
Reviewed By: krasimir
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79325
mydeveloperday [Wed, 20 May 2020 06:44:36 +0000 (07:44 +0100)]
[clang-format] [PR33890] Add support for Microsoft C++/CLI non standard for each looping extension
Summary:
https://bugs.llvm.org/show_bug.cgi?id=33890
This revision allow the microsoft `for each(.... in ...` nonstandard C++ extension which can be used in C++/CLI to be handled as a ForEach macro.
This prevents the breaking between the for and each onto a new line
Reviewed By: JakeMerdichAMD
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D80228
mydeveloperday [Wed, 20 May 2020 06:42:07 +0000 (07:42 +0100)]
[clang-format][PR45816] Add AlignConsecutiveBitFields
Summary:
The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.llvm.org/show_bug.cgi?id=45816 and my efforts on tooling support for AMDVLK, respectively.
This option aligns adjacent bitfield separators across lines, in a manner similar to AlignConsecutiveAssignments and friends.
Example:
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```
would become
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```
This also handles c++2a style bitfield-initializers with AlignConsecutiveAssignments.
```
struct RawFloat {
uint32_t sign : 1 = 0;
uint32_t exponent : 8 = 127;
uint32_t mantissa : 23 = 0;
}; // defaults to 1.0f
```
Things this change does not do:
- Align multiple comma-chained bitfield variables. None of the other
AlignConsecutive* options seem to implement that either.
- Detect bitfields that have a width specified with something other
than a numeric literal (ie, `int a : SOME_MACRO;`). That'd be fairly
difficult to parse and is rare.
Patch By: JakeMerdichAMD
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D80176
Guillaume Chatelet [Fri, 15 May 2020 14:27:35 +0000 (14:27 +0000)]
[libc] Add memset and bzero implementations
Summary: This patch adds general purpose `memset` and `bzero` implementations.
Reviewers: sivachandra, abrachet
Subscribers: mgorny, tschuett, ecnelises, libc-commits, courbet
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D80010
mydeveloperday [Wed, 20 May 2020 06:22:01 +0000 (07:22 +0100)]
[clang-format] Fix line lengths w/ comments in align
Summary:
https://bugs.llvm.org/show_bug.cgi?id=43845
When a '//comment' trails a consecutive alignment, it adds a whitespace
replacement within the comment token. This wasn't handled correctly in
the alignment code, which treats it as a whole token and thus double
counts it.
This can wrongly trigger the "line too long, it'll wrap" alignment-break
condition with specific lengths, causing the alignment to break for
seemingly no reason.
Patch By: JakeMerdichAMD
Reviewed By: MyDeveloperDay
Subscribers: kostyakozko, cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D79465
Kang Zhang [Wed, 20 May 2020 05:32:09 +0000 (05:32 +0000)]
[NFC][PowerPC] Add 2 new cases to test livevars pass
Max Kazantsev [Wed, 20 May 2020 05:02:55 +0000 (12:02 +0700)]
[Test] Add missing auto-generated checks into tests
Fangrui Song [Wed, 20 May 2020 04:50:17 +0000 (21:50 -0700)]
[Support][unittest] Fix HostTest.NumPhysicalCores on __i386__ after D78324
Stanislav Mekhanoshin [Tue, 19 May 2020 22:50:49 +0000 (15:50 -0700)]
[AMDGPU] Process V_MOV_B32_indirect in SET_GPR_IDX optimization
Differential Revision: https://reviews.llvm.org/D80256
Haruki Imai [Wed, 20 May 2020 03:29:16 +0000 (03:29 +0000)]
[mlir][SystemZ] Fix incompatible datalayout in SystemZ
MLIR tests in "mlir/test/mlir-cpu-runner" fails in SystemZ (z14) because
of incompatible datalayout error. This patch fixes it by setting host
CPU name in createTargetMachine()
Differential Revision: https://reviews.llvm.org/D80130
Jinsong Ji [Wed, 20 May 2020 02:35:44 +0000 (02:35 +0000)]
[compiler-rt][scudo][LIT] Use target_suffix instead of target-arch
Per target runtime dir may change the suffix of shared libs.
We can not assume we are always building with per_target_runtime_dir on.
Reviewed By: cryptoad
Differential Revision: https://reviews.llvm.org/D80243
Eli Friedman [Mon, 18 May 2020 18:29:11 +0000 (11:29 -0700)]
[CGCall] Annotate references with "align" attribute.
If we're going to assume references are dereferenceable, we should also
assume they're aligned: otherwise, we can't actually dereference them.
See also D80072.
Differential Revision: https://reviews.llvm.org/D80166
Chintan Kaur [Wed, 20 May 2020 03:10:23 +0000 (03:10 +0000)]
Mark AffineMap::replaceDimsAndSymbols as const (NFC)
This is consistent to the other methods of the class, as well as
AffineExpr::replaceDimsAndSymbols.
Differential Revision: https://reviews.llvm.org/D80266
Matt Arsenault [Wed, 20 May 2020 02:38:54 +0000 (22:38 -0400)]
AMDGPU/GlobalISel: Fix bug in test register bank
The intent wasn't cases with illegal VGPR to SGPR copies.
Nicolas Vasilache [Tue, 19 May 2020 21:53:51 +0000 (17:53 -0400)]
[mlir] NFC - Appease gcc 5
This should fix the error ```
VectorToSCF.cpp:238:62: error: specialization of 'template<class
ConcreteOp> mlir::LogicalResult
{anonymous}::NDTransferOpHelper<ConcreteOp>::doReplace()' in different
namespace
```
Thomas Raoux [Wed, 20 May 2020 02:07:21 +0000 (19:07 -0700)]
[mlir][spirv] First step to support spirv cooperative matrix extension.
Add a new type to SPIRV dialect for cooperative matrix and add new op for
cooperative matrix load. This is missing most instructions to support
cooperative matrix extension but this is a stop-gap patch to avoid creating big
review.
Differential Revision: https://reviews.llvm.org/D80043
QingShan Zhang [Wed, 20 May 2020 02:11:16 +0000 (02:11 +0000)]
[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression
We have the getNegatibleCost/getNegatedExpression to evaluate the cost and negate the expression.
However, during negating the expression, the cost might change as we are changing the DAG,
and then, hit the assertion if we negated the wrong expression as the cost is not trustful anymore.
This patch is target to remove the getNegatibleCost to avoid the out of sync with getNegatedExpression,
and check the cost during negating the expression. It also reduce the duplicated code between
getNegatibleCost and getNegatedExpression. And fix the crash for the test in D76638
Reviewed By: RKSimon, spatel
Differential Revision: https://reviews.llvm.org/D77319
Thomas Raoux [Wed, 20 May 2020 01:56:48 +0000 (18:56 -0700)]
[mlir][vulkan-runner] Minor fix in timestamp flag for vulkan runner.
The first timestamp query should use VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT.
Differential Revision: https://reviews.llvm.org/D80183
Diego Caballero [Wed, 20 May 2020 00:16:04 +0000 (17:16 -0700)]
[mlir][Affine] Introduce affine memory interfaces
This patch introduces interfaces for read and write ops with affine
restrictions. I used `read`/`write` intead of `load`/`store` for the
interfaces so that they can also be implemented by dma ops.
For now, they are only implemented by affine.load, affine.store,
affine.vector_load and affine.vector_store.
For testing purposes, this patch also migrates affine loop fusion and
required analysis to use the new interfaces. No other changes are made
beyond that.
Co-authored-by: Alex Zinenko <zinenko@google.com>
Reviewed By: bondhugula, ftynse
Differential Revision: https://reviews.llvm.org/D79829
Kuangyuan Chen [Wed, 20 May 2020 00:24:28 +0000 (20:24 -0400)]
[mlir][ods] Fix ops with both attribute-sized operands and results
Enclose verifier code for AttrSizedOperandSegments and AttrSizedResultSegments
in a nested code block to avoid symbol collision.
Differential Revision: https://reviews.llvm.org/D80250
Kirstóf Umann [Fri, 10 Apr 2020 22:21:48 +0000 (00:21 +0200)]
[analyzer][StackAddressEscape] Tie warnings to the diagnostic checkers rather then core.StackAddrEscapeBase
Differential Revision: https://reviews.llvm.org/D78101
zoecarver [Wed, 20 May 2020 00:25:00 +0000 (17:25 -0700)]
[NFC] Remove non-rvlaue non-variadic allocator::construct overloads.
Summary: All supported compilers have rvalues and variadics so we can safely remove the overloads of allocator::construct which are only enabled on compilers without rvalues and variadics.
Reviewers: ldionne, #libc!
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D80068
zoecarver [Wed, 20 May 2020 00:21:35 +0000 (17:21 -0700)]
[NFC] Remove non-rvlaue non-variadic allocator::construct overloads.
Summary: All supported compilers have rvalues and variadics so we can safely remove the overloads of allocator::construct which are only enabled on compilers without rvalues and variadics.
Reviewers: ldionne, #libc!
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D80068
zoecarver [Wed, 20 May 2020 00:17:16 +0000 (17:17 -0700)]
Mark shared_ptr::__create_with_control_block as noexcept.
Summary: The default constructor for shared_ptr and shared_ptr::__enable_weak_this are both noexcept so, shared_ptr::__create_with_control_block can also be marked noexcept.
Reviewers: ldionne, #libc!
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D80070
zoecarver [Wed, 20 May 2020 00:15:28 +0000 (17:15 -0700)]
[NFC] Add _EnableIfLValueCallable and move reference out of __callable.
Summary: In std::functional moves the reference out of the `__callable` implementation and replaces `_EnableIfCallable` with `_EnableIfLValueCallable` (`_EnableIfLValueCallable` passes `__callable` an lvalue reference type).
Reviewers: ldionne, #libc!
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D80071
Kristóf Umann [Tue, 25 Feb 2020 17:02:18 +0000 (18:02 +0100)]
[analyzer][NFC][MallocChecker] Convert many parameters into CallEvent
Exactly what it says on the tin! This is clearly not the end of the road in this
direction, the parameters could be merged far more with the use of CallEvent or
a better value type in the CallDescriptionMap, but this was shockingly difficult
enough on its own. I expect that simplifying the file further will be far easier
moving forward.
The end goal is to research how we could create a more mature checker
interaction infrastructure for more complicated C++ modeling, and I'm pretty
sure that being able successfully split up our giants is the first step in this
direction.
Differential Revision: https://reviews.llvm.org/D75432
Kirstóf Umann [Tue, 19 May 2020 23:36:06 +0000 (01:36 +0200)]
[analyzer] Change the default output type to PD_TEXT_MINIMAL in the frontend, error if an output loc is missing for PathDiagConsumers that need it
The title and the included test file sums everything up -- the only thing I'm
mildly afraid of is whether anyone actually depends on the weird behavior of
HTMLDiagnostics pretending to be TextDiagnostics if an output directory is not
supplied. If it is, I guess we would need to resort to tiptoeing around the
compatibility flag.
Differential Revision: https://reviews.llvm.org/D76510
António Afonso [Tue, 19 May 2020 23:01:43 +0000 (16:01 -0700)]
Add terminateCommands to lldb-vscode protocol
Summary: Adding this in line with "stopCommands" and "exitCommands" so that we can run commands at the end of the debugging session.
Reviewers: clayborg, wallace, labath
Reviewed By: clayborg, labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D79726
Vedant Kumar [Tue, 19 May 2020 23:06:38 +0000 (16:06 -0700)]
[lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h"
This addresses some post-commit review feedback from
https://reviews.llvm.org/D80150 by renaming "Mock.h" to something less
misleading, and keeping logic related to the ObjC plugin separate from
the generic DataFormatters library.
Dan Liew [Thu, 7 May 2020 19:38:14 +0000 (12:38 -0700)]
[asan_symbolize] Fix bug handling C++ symbols when using Atos.
Summary:
The previous code tries to strip out parentheses and anything in between
them. I'm guessing the idea here was to try to drop any listed arguments
for the function being symbolized. Unfortunately this approach is broken
in several ways.
* Templated functions may contain parentheses. The existing approach
messes up these names.
* In C++ argument types are part of a function's signature for the
purposes of overloading so removing them could be confusing.
Fix this simply by not trying to adjust the function name that comes
from `atos`.
A test case is included.
Without the change the test case produced output like:
```
WRITE of size 4 at 0x6060000001a0 thread T0
#0 0x10b96614d in IntWrapper<void >::operator=> const&) asan-symbolize-templated-cxx.cpp:10
#1 0x10b960b0e in void writeToA<IntWrapper<void > >>) asan-symbolize-templated-cxx.cpp:30
#2 0x10b96bf27 in decltype>)>> >)) std::__1::__invoke<void >), IntWrapper<void > >>), IntWrapper<void >&&) type_traits:4425
#3 0x10b96bdc1 in void std::__1::__invoke_void_return_wrapper<void>::__call<void >), IntWrapper<void > >>), IntWrapper<void >&&) __functional_base:348
#4 0x10b96bd71 in std::__1::__function::__alloc_func<void >), std::__1::allocator<void >)>, void >)>::operator>&&) functional:1533
#5 0x10b9684e2 in std::__1::__function::__func<void >), std::__1::allocator<void >)>, void >)>::operator>&&) functional:1707
#6 0x10b96cd7b in std::__1::__function::__value_func<void >)>::operator>&&) const functional:1860
#7 0x10b96cc17 in std::__1::function<void >)>::operator>) const functional:2419
#8 0x10b960ca6 in Foo<void >), IntWrapper<void > >::doCall>) asan-symbolize-templated-cxx.cpp:44
#9 0x10b96088b in main asan-symbolize-templated-cxx.cpp:54
#10 0x7fff6ffdfcc8 in start (in libdyld.dylib) + 0
```
Note how the symbol names for the frames are messed up (e.g. #8, #1).
With the patch the output looks like:
```
WRITE of size 4 at 0x6060000001a0 thread T0
#0 0x10005214d in IntWrapper<void (int)>::operator=(IntWrapper<void (int)> const&) asan-symbolize-templated-cxx.cpp:10
#1 0x10004cb0e in void writeToA<IntWrapper<void (int)> >(IntWrapper<void (int)>) asan-symbolize-templated-cxx.cpp:30
#2 0x100057f27 in decltype(std::__1::forward<void (*&)(IntWrapper<void (int)>)>(fp)(std::__1::forward<IntWrapper<void (int)> >(fp0))) std::__1::__invoke<void (*&)(IntWrapper<void (int)>), IntWrapper<void (int)> >(void (*&)(IntWrapper<void (int)>), IntWrapper<void (int)>&&) type_traits:4425
#3 0x100057dc1 in void std::__1::__invoke_void_return_wrapper<void>::__call<void (*&)(IntWrapper<void (int)>), IntWrapper<void (int)> >(void (*&)(IntWrapper<void (int)>), IntWrapper<void (int)>&&) __functional_base:348
#4 0x100057d71 in std::__1::__function::__alloc_func<void (*)(IntWrapper<void (int)>), std::__1::allocator<void (*)(IntWrapper<void (int)>)>, void (IntWrapper<void (int)>)>::operator()(IntWrapper<void (int)>&&) functional:1533
#5 0x1000544e2 in std::__1::__function::__func<void (*)(IntWrapper<void (int)>), std::__1::allocator<void (*)(IntWrapper<void (int)>)>, void (IntWrapper<void (int)>)>::operator()(IntWrapper<void (int)>&&) functional:1707
#6 0x100058d7b in std::__1::__function::__value_func<void (IntWrapper<void (int)>)>::operator()(IntWrapper<void (int)>&&) const functional:1860
#7 0x100058c17 in std::__1::function<void (IntWrapper<void (int)>)>::operator()(IntWrapper<void (int)>) const functional:2419
#8 0x10004cca6 in Foo<void (IntWrapper<void (int)>), IntWrapper<void (int)> >::doCall(IntWrapper<void (int)>) asan-symbolize-templated-cxx.cpp:44
#9 0x10004c88b in main asan-symbolize-templated-cxx.cpp:54
#10 0x7fff6ffdfcc8 in start (in libdyld.dylib) + 0
```
rdar://problem/
58887175
Reviewers: kubamracek, yln
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D79597
Kirstóf Umann [Sun, 1 Mar 2020 20:26:49 +0000 (21:26 +0100)]
[analyzer][NFC] Merge checkNewAllocator's paramaters into CXXAllocatorCall
Party based on this thread:
http://lists.llvm.org/pipermail/cfe-dev/2020-February/064754.html.
This patch merges two of CXXAllocatorCall's parameters, so that we are able to
supply a CallEvent object to check::NewAllocatorCall (see the description of
D75430 to see why this would be great).
One of the things mentioned by @NoQ was the following:
I think at this point we might actually do a good job sorting out this
check::NewAllocator issue because we have a "separate" "Environment" to hold
the other SVal, which is "objects under construction"! - so we should probably
simply teach CXXAllocatorCall to extract the value from the
objects-under-construction trait of the program state and we're good.
I had MallocChecker in my crosshair for now, so I admittedly threw together
something as a proof of concept. Now that I know that this effort is worth
pursuing though, I'll happily look for a solution better then demonstrated in
this patch.
Differential Revision: https://reviews.llvm.org/D75431
Matt Arsenault [Tue, 19 May 2020 18:32:31 +0000 (14:32 -0400)]
AMDGPU: Annotate functions that have stack objects
Relying on any MachineFunction state in the MachineFunctionInfo
constructor is hazardous, because the construction time is unclear and
determined by the first use. The function may be only partially
constructed, which is part of why we have many of these hacky string
attributes to track what we need for ABI lowering.
For SelectionDAG, all stack objects are created up-front before
calling convention lowering so stack objects are visible at
construction time. For GlobalISel, none of the IR function has been
visited yet and the allocas haven't been added to the MachineFrameInfo
yet. This should fix failing to set flat_scratch_init in GlobalISel
when needed.
This pass really needs to be turned into some kind of analysis, but I
haven't found a nice way use one here.
Kirstóf Umann [Tue, 14 Apr 2020 16:02:31 +0000 (18:02 +0200)]
analyzer][CallAndMessage][NFC] Change old callbacks to rely on CallEvent
The following series of patches has something similar in mind with D77474, with
the same goal to finally end incorrect checker names for good. Despite
CallAndMessage not suffering from this particular issue, it is a dependency for
many other checkers, which is problematic, because we don't really want
dependencies to also emit diagnostics (reasoning for this is also more detailed
in D77474).
CallAndMessage also has another problem, namely that it is responsible for a lot
of reports. You'll soon learn that this isn't really easy to solve for
compatibility reasons, but that is the topic of followup patches.
Differential Revision: https://reviews.llvm.org/D77845
Cameron McInally [Tue, 19 May 2020 22:28:35 +0000 (17:28 -0500)]
[SVE] MOVPRFX zero merging test renaming
Differential Revision: https://reviews.llvm.org/D80244
Matt Arsenault [Tue, 19 May 2020 13:27:25 +0000 (09:27 -0400)]
GlobalISel: Copy correct flags to select
This was looking for a compare condition, and copying the compare
flags. I don't think this was ever correct outside of certain min/max
patterns which aren't checked, but this probably predates select
instructions having fast math flags.
Kirstóf Umann [Tue, 14 Apr 2020 16:02:31 +0000 (18:02 +0200)]
[analyzer][ObjCGenerics] Don't emit diagnostics under the name core.DynamicTypePropagation
Differential Revision: https://reviews.llvm.org/D78124
Matt Arsenault [Wed, 13 May 2020 17:24:32 +0000 (13:24 -0400)]
AMDGPU: Fix DAG divergence for implicit function arguments
This should be directly implied from the register class, and there's
no need to special case live ins here. This was getting the wrong
answer for the queue ptr argument in callable functions, since it's
not an explicit IR argument and is always uniform.
Fixes not using scalar loads for the aperture in addrspacecast
lowering, and any other places that use implicit SGPR arguments.
Matt Arsenault [Tue, 19 May 2020 17:44:14 +0000 (13:44 -0400)]
AMDGPU: Use member initializers in MFI
Brian Cain [Fri, 15 May 2020 15:56:42 +0000 (10:56 -0500)]
[Hexagon] pX.new cannot be used with p3:0 as producer
Writes to p3:0 do not produce new values, we should bar any .new
consumer trying to use it as a producer.
Kirstóf Umann [Tue, 14 Apr 2020 15:44:44 +0000 (17:44 +0200)]
[analyzer][NSOrCFError] Don't emit diagnostics under the name osx.NSOrCFErrorDerefChecker
Differential Revision: https://reviews.llvm.org/D78123
Matt Arsenault [Tue, 19 May 2020 16:28:56 +0000 (12:28 -0400)]
GlobalISel: Remove unused include
Matt Arsenault [Tue, 19 May 2020 17:01:19 +0000 (13:01 -0400)]
CodeGen: Use Register