OSDN Git Service
Xiang1 Zhang [Tue, 19 May 2020 02:37:46 +0000 (10:37 +0800)]
Add cet.h for writing CET-enabled assembly code
Summary:
Add x86 feature with IBT and/or SHSTK bits to ELF program property if they are enabled. Otherwise, contents in this header file are unused.
This file is mainly design for assembly source code which want to enable CET
Reviewers: hjl.tools, annita.zhang, LuoYuanke, craig.topper, tstellar, pengfei, rsmith
Reviewed By: LuoYuanke
Subscribers: mgorny
Differential Revision: https://reviews.llvm.org/D79617
Eli Friedman [Tue, 19 May 2020 02:16:06 +0000 (19:16 -0700)]
[NFC] Replace MaybeAlign with Align in TargetTransformInfo.
Yonghong Song [Sat, 16 May 2020 05:57:25 +0000 (22:57 -0700)]
[BPF] Return fail if disassembled insn registers out of range
Daniel reported a llvm-objdump segfault like below:
$ llvm-objdump -D bpf_xdp.o
...
0000000000000000 <.strtab>:
0: 00 63 69 6c 69 75 6d 5f <unknown>
1: 6c 62 36 5f 61 66 66 69 w2 <<= w6
...
(llvm-objdump: lib/Target/BPF/BPFGenAsmWriter.inc:1087: static const char*
llvm::BPFInstPrinter::getRegisterName(unsigned int): Assertion
`RegNo && RegNo < 25 && "Invalid register number!"' failed.
Stack dump:
0. Program arguments: llvm-objdump -D bpf_xdp.o
...
abort
...
llvm::BPFInstPrinter::getRegisterName(unsigned int)
llvm::BPFInstPrinter::printMemOperand(llvm::MCInst const*,
int, llvm::raw_ostream&, char const*)
llvm::BPFInstPrinter::printInstruction(llvm::MCInst const*,
unsigned long, llvm::raw_ostream&)
llvm::BPFInstPrinter::printInst(llvm::MCInst const*,
unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&,
llvm::raw_ostream&)
...
Basically, since -D enables disassembly for all sections, .strtab is also disassembled,
but some strings are decoded as legal instructions but with illegal register numbers.
When llvm-objdump tries to print register name for these illegal register numbers,
assertion and segfault happens.
The patch fixed the issue by returning fail for a disassembled insn if
that insn contains a reg operand with illegal reg number.
The insn will be printed as "<unknown>" instead of causing an assertion.
Jonas Devlieghere [Tue, 19 May 2020 01:10:53 +0000 (18:10 -0700)]
[lldb/Driver] Fix handling on positional arguments
Before the transition to libOption it was possible to specify arguments
for the inferior without -- as long as they didn't start with a dash.
For example, the following invocations should all behave the same:
$ lldb inferior inferior-arg
$ lldb inferior -- inferior-arg
$ lldb -- inferior inferior-arg
This patch fixes that behavior, documents it and adds a test to cover
the different combinations.
Differential revision: https://reviews.llvm.org/D80165
Chen Zheng [Tue, 19 May 2020 01:44:47 +0000 (21:44 -0400)]
fix build failure due to commit rGddcb3cf213e8
Chen Zheng [Tue, 19 May 2020 01:20:52 +0000 (21:20 -0400)]
[TargetInstrInfo] add override function setSpecialOperandAttr - NFC
Chen Zheng [Tue, 19 May 2020 01:16:21 +0000 (21:16 -0400)]
[PowerPC][MachineCombiner] add testcase for reassociating FMA - NFC
Yonghong Song [Mon, 18 May 2020 18:56:29 +0000 (11:56 -0700)]
[BPF] Prevent disassembly segfault for NOP insn
For a simple program like below:
-bash-4.4$ cat t.c
int test() {
asm volatile("r0 = r0" ::);
return 0;
}
compiled with
clang -target bpf -O2 -c t.c
the following llvm-objdump command will segfault.
llvm-objdump -d t.o
0: bf 00 00 00 00 00 00 00 nop
llvm-objdump: ../include/llvm/ADT/SmallVector.h:180
...
Assertion `idx < size()' failed
...
abort
...
llvm::BPFInstPrinter::printOperand
llvm::BPFInstPrinter::printInstruction
...
The reason is both NOP and MOV_rr (r0 = r0) having the same encoding.
The disassembly getInstruction() decodes to be a NOP instruciton but
during printInstruction() the same encoding is interpreted as
a MOV_rr instruction. Such a mismatcch caused the segfault.
The fix is to make NOP instruction as CodeGen only so disassembler
will skip NOP insn for disassembling.
Note that instruction "r0 = r0" should not appear in non inline
asm codes since BPF Machine Instruction Peephole optimization will
remove it.
Differential Revision: https://reviews.llvm.org/D80156
Reid Kleckner [Mon, 18 May 2020 19:07:31 +0000 (12:07 -0700)]
Re-land [Debug][CodeView] Emit fully qualified names for globals
This reverts commit
525a591f0f48b9d54018bf5245f2abee09c9c1c8.
Fixed an issue with pointers to members based on typedefs. In this case,
LLVM would emit a second UDT. I fixed it by not passing the class type
to getTypeIndex when the base type is not a function type. lowerType
only uses the class type for direct function types. This suggests if we
have a PMF with a function typedef, there may be an issue, but that can
be solved separately.
Vedant Kumar [Mon, 18 May 2020 23:37:04 +0000 (16:37 -0700)]
[lldb/test] Disable NSDate format check under _WIN32
Disable the test which attempts to format an NSDate with a date_value of
0 on _WIN32.
When _WIN32 is defined, GetOSXEpoch returns a date that should be in
2001, but after this is passed through timegm (which, afaict isn't
portable?) the result is a date in 1970:
```
lldb-x64-windows-ninja\llvm-project\lldb\unittests\DataFormatter\MockTests.cpp(39): error: Expected: *formatDateValue(0)
Which is: "1970-01-01 00:00:00 Pacific Standard Time"
To be equal to: "2001-01-01 00:00:00 UTC"
```
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
Sam McCall [Mon, 18 May 2020 23:30:23 +0000 (01:30 +0200)]
[clangd] Tidy up SelectionTree dumps with newlines
Amara Emerson [Mon, 18 May 2020 23:23:53 +0000 (16:23 -0700)]
[AArch64][GlobalISel] Add legalizer & selector support for G_FREEZE.
These should legalize like undefs and select into copies.
The ll test is copied from the x86 test, minus the half fp case because
we don't currently support that.
Francesco Petrogalli [Mon, 11 May 2020 17:44:17 +0000 (17:44 +0000)]
[clang][SveEmitter] SVE builtins for `svusdot` and `svsudot` ACLE.
Summary:
Intrinsics, guarded by `__ARM_FEATURE_SVE_MATMUL_INT8`:
* svusdot[_s32]
* svusdot[_n_s32]
* svusdot_lane[_s32]
* svsudot[_s32]
* svsudot[_n_s32]
* svsudot_lane[_s32]
Reviewers: sdesmalen, efriedma, david-arm, rengolin
Subscribers: tschuett, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79877
Vedant Kumar [Mon, 18 May 2020 22:59:34 +0000 (15:59 -0700)]
[lldb/test] Relax NSDate mock test for non-Apple platforms
On Ubuntu, a formatted date prints as "GMT" instead of "UTC", which is
ok.
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
Fangrui Song [Thu, 14 May 2020 00:25:04 +0000 (17:25 -0700)]
Map -O to -O1 instead of -O2
rL82131 changed -O from -O1 to -O2, because -O1 was not different from
-O2 at that time.
GCC treats -O as -O1 and there is now work to make -O1 meaningful.
We can change -O back to -O1 again.
Reviewed By: echristo, dexonsmith, arphaman
Differential Revision: https://reviews.llvm.org/D79916
Ayal Zaks [Sun, 17 May 2020 14:51:03 +0000 (17:51 +0300)]
[LV] Fix FoldTail under user VF and UF
LV considers an internally computed MaxVF to decide if a constant trip-count is
a multiple of any subsequently chosen VF, and conclude that no scalar remainder
iterations (tail) will be left for Fold Tail to handle. If an external VF is
provided via -force-vector-width, it must be considered instead of the internal
MaxVF.
If an external UF is provided via -force-vector-interleave, it too must be
considered in addition to MaxVF or user VF.
Fixes PR45679.
Differential Revision: https://reviews.llvm.org/D80085
LLVM GN Syncbot [Mon, 18 May 2020 22:19:17 +0000 (22:19 +0000)]
[gn build] Port
9d69072fb80
Kirstóf Umann [Sun, 1 Mar 2020 16:49:44 +0000 (17:49 +0100)]
[analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker
One of the pain points in simplifying MallocCheckers interface by gradually
changing to CallEvent is that a variety of C++ allocation and deallocation
functionalities are modeled through preStmt<...> where CallEvent is unavailable,
and a single one of these callbacks can prevent a mass parameter change.
This patch introduces a new CallEvent, CXXDeallocatorCall, which happens after
preStmt<CXXDeleteExpr>, and can completely replace that callback as
demonstrated.
Differential Revision: https://reviews.llvm.org/D75430
Matt Arsenault [Mon, 18 May 2020 00:00:59 +0000 (20:00 -0400)]
GlobalISel: Fold G_MUL x, 0, and G_*DIV 0, x
Francesco Petrogalli [Fri, 8 May 2020 20:50:10 +0000 (20:50 +0000)]
[llvm][sve] Intrinsics for SVE sudot and usdot instructions.
Summary:
This patch adds IR intrinsics for the mnemonics USDOT and SUDOT of the
8.6 extension of Armv8-a.
Reviewers: sdesmalen, efriedma, david-arm
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79876
Francesco Petrogalli [Wed, 6 May 2020 20:52:30 +0000 (20:52 +0000)]
[SveEmitter] Builtins for SVE matrix multiply `mmla`.
Summary:
Guarded by __ARM_FEATURE_SVE_MATMUL_INT8:
* svmmla_u32
* svmmla_s32
* svusmmla_s32
Guarded by __ARM_FEATURE_SVE_MATMUL_FP32:
* svmmla_f32
Guarded by __ARM_FEATURE_SVE_MATMUL_FP64:
* svmmla_f64
Reviewers: sdesmalen, kmclaughlin, efriedma, rengolin
Subscribers: tschuett, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79639
Francesco Petrogalli [Wed, 6 May 2020 02:56:28 +0000 (02:56 +0000)]
[llvm][SVE] IR intrinscs for matrix multiplication instructions.
Summary:
Instructions:
* SMMLA
* UMMLA
* USMMLA
* FMMLA
Reviewers: sdesmalen, efriedma, kmclaughlin
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79638
Amara Emerson [Mon, 18 May 2020 17:31:11 +0000 (10:31 -0700)]
[GlobalISel] Add support for using vector values in memset inlining.
Sanjay Patel [Mon, 18 May 2020 19:42:23 +0000 (15:42 -0400)]
[x86] add tests for heroic horizontal ops; NFC
Sanjay Patel [Mon, 18 May 2020 17:56:15 +0000 (13:56 -0400)]
[x86] add tests for disguised horizontal ops; NFC
Stanislav Mekhanoshin [Mon, 18 May 2020 20:26:58 +0000 (13:26 -0700)]
[AMDGPU] Fixed selection error for 64 bit extract_subvector
Differential Revision: https://reviews.llvm.org/D80155
Matt Arsenault [Mon, 18 May 2020 20:05:09 +0000 (16:05 -0400)]
DAG: Use correct pointer size for llvm.ptrmask
This was ignoring the address space, and would assert on address
spaces with a different size from the default.
Sam McCall [Thu, 14 May 2020 17:23:01 +0000 (19:23 +0200)]
[clangd] Avoid wasteful data structures in RefSlab::Builder
Summary: This is worth another 10% or so on InedxBenchmark.DexBuild.
Reviewers: kbobyrev
Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79950
Craig Topper [Mon, 18 May 2020 19:41:36 +0000 (12:41 -0700)]
Fix several places that were calling verifyFunction or verifyModule without checking the return value.
verifyFunction/verifyModule don't assert or error internally. They
also don't print anything if you don't pass a raw_ostream to them.
So the caller needs to check the result and ideally pass a stream
to get the messages. Otherwise they're just really expensive no-ops.
I've filed PR45965 for another instance in SLPVectorizer
that causes a lit test failure.
Differential Revision: https://reviews.llvm.org/D80106
Vedant Kumar [Tue, 21 Apr 2020 17:00:13 +0000 (10:00 -0700)]
[lldb/DataFormatter] Check for overflow when finding NSDate epoch
Summary:
Fixes UBSan-reported issues where the date value inside of an
uninitialized NSDate overflows the 64-bit epoch.
rdar://
61774575
Reviewers: JDevlieghere, mib, teemperor
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80150
Nikita Popov [Mon, 18 May 2020 19:50:15 +0000 (21:50 +0200)]
[Sanitizers] Use getParamByValType() (NFC)
Instead of fetching the pointer element type.
Jinsong Ji [Mon, 18 May 2020 18:36:43 +0000 (18:36 +0000)]
[compiler-rt][CMake] Fix PowerPC runtime build
When build in runtime bulid mode with LLVM_ENABLE_RUNTIMES,
the base-config-ix.cmake will complain about two errors.
One is empty string in replace, the other one is unknown `TEST_BIG_ENDIAN ` command.
This patch fix it so that we can test runtime build.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D80040
Jean-Michel Gorius [Mon, 18 May 2020 19:30:43 +0000 (21:30 +0200)]
[x86] Propagate memory operands during ISel DAG postprocessing
Summary:
Propagate memory operands when folding test instructions.
This was split from D80062.
Reviewers: craig.topper, rnk, lebedev.ri
Reviewed By: craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80140
Matt Arsenault [Sat, 16 May 2020 17:48:55 +0000 (13:48 -0400)]
AMDGPU: Fix illegally constant folding from V_MOV_B32_sdwa
This was assumed to be a simple move, and interpreting the immediate
modifier operand as a materialized immediate. Apparently the SDWA pass
never produces these, but GlobalISel does emit these for some vector
shuffles.
Artem Belevich [Mon, 18 May 2020 19:17:39 +0000 (12:17 -0700)]
Revert "[CUDA][HIP] Workaround for resolving host device function against wrong-sided function"
Still breaks CUDA compilation.
This reverts commit
e03394c6a6ff5832aa43259d4b8345f40ca6a22c.
Lei Zhang [Sun, 17 May 2020 14:14:36 +0000 (10:14 -0400)]
[mlir][vulkan-runner] Add back accidentially removed header include
Differential Revision: https://reviews.llvm.org/D80149
Matt Arsenault [Mon, 18 May 2020 18:53:26 +0000 (14:53 -0400)]
AMDGPU/GlobalISel: Fix f64 G_FDIV lowering
This was using an integer multiply instead of FP.
Volkan Keles [Mon, 18 May 2020 19:11:46 +0000 (12:11 -0700)]
LoadStoreVectorizer: Match nested adds to prove vectorization is safe
If both OpA and OpB is an add with NSW/NUW and with the same LHS operand,
we can guarantee that the transformation is safe if we can prove that OpA
won't overflow when IdxDiff added to the RHS of OpA.
Review: https://reviews.llvm.org/D79817
Nikita Popov [Mon, 18 May 2020 17:09:03 +0000 (19:09 +0200)]
[Loads] Require Align in isSafeToLoadUnconditionally() (NFC)
Now that load/store have required alignment, accept Align here.
This also avoids uses of getPointerElementType(), which is
incompatible with opaque pointers.
George [Mon, 18 May 2020 18:40:32 +0000 (14:40 -0400)]
Fixed a typo in the comment for allocateBuffer()
Differential Revision: https://reviews.llvm.org/D80087
Jonas Devlieghere [Mon, 18 May 2020 18:34:09 +0000 (11:34 -0700)]
[dsymutil] Make sure the --help output and man page are consistent
As suggested by Adrian in D79398.
Arthur Eubanks [Mon, 18 May 2020 16:02:12 +0000 (09:02 -0700)]
Add verifier check that musttail and preallocated are not used together
Summary:
Currently they are not supported together. Supporting them will require
a LangRef change. See discussion in https://reviews.llvm.org/D77689.
Reviewers: rnk, efriedma
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80132
Jay Foad [Mon, 18 May 2020 15:06:42 +0000 (16:06 +0100)]
[IR] Revert r2694 in BasicBlock::removePredecessor
r2694 fixed a bug where removePredecessor could create IR with a use not
dominated by its def in a self loop. But this could only happen in an
unreachable loop, and since that time the rules have been relaxed so
that defs don't have to dominate uses in unreachable code, so the fix is
unnecessary. The regression test added in r2691 still stands.
Differential Revision: https://reviews.llvm.org/D80128
Jonas Paulsson [Mon, 18 May 2020 16:20:40 +0000 (18:20 +0200)]
[SystemZ] Don't create PERMUTE nodes with an undef operand.
It's better to reuse the first source value than to use an undef second
operand, because that will make more resulting VPERMs have identical operands
and therefore MachineCSE more successful.
Review: Ulrich Weigand
Mircea Trofin [Mon, 18 May 2020 17:26:45 +0000 (10:26 -0700)]
[llvm][NFC] Fixed non-compliant style in InlineAdvisor.h
Changed OnPass{Entry|Exit} -> onPass{Entry|Exit}
Also fixed a small typo in a comment.
Jonas Devlieghere [Mon, 18 May 2020 16:55:33 +0000 (09:55 -0700)]
[lldb/Reproducers] Add skipIfReproducer to more tests
Mark more tests as unsupported with reproducers.
Vedant Kumar [Fri, 15 May 2020 20:58:40 +0000 (13:58 -0700)]
[Local] Do not ignore zexts in salvageDebugInfo, PR45923
Summary:
When salvaging a dead zext instruction, append a convert operation to
the DIExpressions of the debug uses of the instruction, to prevent the
salvaged value from being sign-extended.
I confirmed that lldb prints out the correct unsigned result for "f" in
the example from PR45923 with this changed applied.
rdar://
63246143
Reviewers: aprantl, jmorse, chrisjackson, davide
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80034
Alexandre Rames [Mon, 18 May 2020 16:44:26 +0000 (18:44 +0200)]
[MLIR] Use `MLIR_INCLUDE_TESTS` to conditionally compile tests.
This is equivalent to what is done for other projects (e.g. clang).
Differential Revision: https://reviews.llvm.org/D80022
Tobias Gysi [Mon, 18 May 2020 16:30:39 +0000 (18:30 +0200)]
[mlir] Support optional attributes in assembly formats
Summary: This revision adds support for assembly formats with optional attributes. It elides optional attributes that are part of the syntax from the attribute dictionary.
Reviewers: ftynse, Kayjukh
Reviewed By: ftynse, Kayjukh
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80113
Pierre Oechsel [Mon, 18 May 2020 16:25:23 +0000 (18:25 +0200)]
[MLIR] [Linalg] Add option to use the partial view after promotion.
For now the promoted buffer is indexed using the `full view`. The full view might be
slightly bigger than the partial view (which is accounting for boundaries).
Unfortunately this does not compose easily with other transformations when multiple buffers
with shapes related to each other are involved.
Take `linalg.matmul A B C` (with A of size MxK, B of size KxN and C of size MxN) and suppose we are:
- Tiling over M by 100
- Promoting A only
This is producing a `linalg.matmul promoted_A B subview_C` where `promoted_A` is a promoted buffer
of `A` of size (100xK) and `subview_C` is a subview of size mxK where m could be smaller than 100 due
to boundaries thus leading to a possible incorrect behavior.
We propose to:
- Add a new parameter to the tiling promotion allowing to enable the use of the full tile buffer.
- By default all promoted buffers will be indexed by the partial view.
Note that this could be considered as a breaking change in comparison to the way the tiling promotion
was working.
Differential Revision: https://reviews.llvm.org/D79927
Matt Arsenault [Sun, 17 May 2020 23:06:10 +0000 (19:06 -0400)]
AMDGPU/GlobalISel: Fix splitting wide VALU, non-vector loads
Matt Arsenault [Sun, 17 May 2020 16:37:27 +0000 (12:37 -0400)]
AMDGPU: Remove outdated comment
Nicolas Vasilache [Mon, 18 May 2020 15:51:56 +0000 (11:51 -0400)]
[mlir][Vector] Add an optional "masked" boolean array attribute to vector transfer operations
Summary:
Vector transfer ops semantic is extended to allow specifying a per-dimension `masked`
attribute. When the attribute is false on a particular dimension, lowering to LLVM emits
unmasked load and store operations.
Differential Revision: https://reviews.llvm.org/D80098
Nicolas Vasilache [Mon, 18 May 2020 15:40:59 +0000 (11:40 -0400)]
[mlir][Vector] Make minor identity permutation map optional in transfer op printing and parsing
Summary:
This revision makes the use of vector transfer operatons more idiomatic by
allowing to omit and inferring the permutation_map.
Differential Revision: https://reviews.llvm.org/D80092
David Sherwood [Wed, 6 May 2020 10:23:04 +0000 (11:23 +0100)]
[SVE] Ignore scalable vectors in InterleavedLoadCombinePass
I have changed the pass so that we ignore shuffle vectors with
scalable vector types, and replaced VectorType with FixedVectorType
in the rest of the pass. I couldn't think of an easy way to test
this change, since for scalable vectors we shouldn't be using
shufflevectors for interleaving. This change fixes up some
type size assert warnings I found in the following test:
CodeGen/AArch64/sve-intrinsics-int-arith-imm.ll
Differential Revision: https://reviews.llvm.org/D79700
Wouter van Oortmerssen [Fri, 15 May 2020 23:09:20 +0000 (16:09 -0700)]
[WebAssembly] iterate stack in DebugFixup from the top.
Differential Revision: https://reviews.llvm.org/D80045
Balázs Kéri [Mon, 18 May 2020 15:14:39 +0000 (17:14 +0200)]
[Analyzer][StreamChecker] Fixed compile error - NFC.
Balázs Kéri [Mon, 18 May 2020 13:07:32 +0000 (15:07 +0200)]
[Analyzer][StreamChecker] Changed representation of stream error state - NFC.
Summary:
State of error flags for a stream is handled by having separate flags
that allow combination of multiple error states to be described with one
error state object.
After a failed function the error state is set in the stream state
and must not be determined later based on the last failed function
like before this change. The error state can not always be determined
from the last failed function and it was not the best design.
Reviewers: Szelethus
Reviewed By: Szelethus
Subscribers: 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/D80009
Dvorskiy, Mikhail [Tue, 10 Mar 2020 16:09:57 +0000 (19:09 +0300)]
[pstl] A fix for move placement-new (and destroy) allocated objects from raw memory.
https://reviews.llvm.org/D74123
The fix affects follow algorithms:
remove_if, unique, rotate, inplace_merge, partial_sort_copy, set_union, set_intersection, set_difference, set_symmetric_difference.
For "is_trivial" types there are no problems with "creating objects/clean-up"
For non-trivial types the algo results are also correct, but possible incorrect copying/moving "operator=" calls "by raw memory" within one of mentioned algo or incorrect destructor calls in the end of algo.
Nicolas Vasilache [Mon, 18 May 2020 13:41:59 +0000 (09:41 -0400)]
[mlir] Add BoolArrayAttr in Tablegen + Builder support
Differential Revision: https://reviews.llvm.org/D80090
Nicolas Vasilache [Mon, 18 May 2020 13:33:35 +0000 (09:33 -0400)]
[mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Summary:
When NamedAttrList::get is called against a StringRef and the
entry is not present, the Identifier::operator== crashes.
Interestingly there seems to be no use of the NamedAttrList::get(StringRef) in
the codebase so far. A subsequent commit will introduce such a use.
Differential Revision: https://reviews.llvm.org/D80089
AndreyChurbanov [Mon, 18 May 2020 12:32:13 +0000 (15:32 +0300)]
[openmp] Fixed hang if detached task was serialized.
The patch fixes https://bugs.llvm.org/show_bug.cgi?id=45904.
Differential Revision: https://reviews.llvm.org/D79944
serge-sans-paille [Tue, 12 May 2020 16:46:32 +0000 (18:46 +0200)]
Reorder Type fields to make various isa< > check more concise
Depending on the order of fields, some isa < > checks can be faster because of
tests that check a range of type, leading to assembly simplification.
To find a relevant ordering, I... brute-forced the permutation among the derived
types and pick the combination that resulted in the smallest libLLVM-11.so.
On my laptop (x86_64), this reduces the size of libLLVM-11.so from
127344064 bytes to
127335336,
that's 8728 bytes shaved without much effort.
Also removed obsolete comments in the process.
Differential Revision: https://reviews.llvm.org/D79996
Michael Schellenberger Costa [Mon, 18 May 2020 12:01:55 +0000 (14:01 +0200)]
[libcxx][type_traits] Add C++20 changes to common_type
Summary: This already implements the expected changes for LWG-3205
Reviewers: mclow.lists, EricWF, CaseyCarter, cjdb, #libc, ldionne
Reviewed By: #libc, ldionne
Subscribers: dexonsmith, broadwaylamb, christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D74350
David Zarzycki [Mon, 18 May 2020 11:39:12 +0000 (07:39 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from lock_guard tests
These two tests were clumsily using time measurements to determine
whether std::lock_guard was working correctly. In practice, this
approach merely verified that the underlying lock properly waits.
Now these two tests verify that lock is acquired, not dropped
prematurely, and finally, actually dropped at the end of the scope.
Hans Wennborg [Fri, 15 May 2020 15:20:27 +0000 (17:20 +0200)]
Turn -Wmax-tokens off by default
On the one hand, one might interpret the use of the max-token pragmas or
-fmax-tokens flag as an opt-in to the warning. However, in Chromium
we've found it useful to only opt in selected build configurations, even
though we have the pragmas in the code. For that reason, we think it
makes sense to turn it off by default.
Differential revision: https://reviews.llvm.org/D80014
Max Kazantsev [Mon, 18 May 2020 11:09:24 +0000 (18:09 +0700)]
[InstCombine][NFC] Simplify check in sinking
We just need to check that the only predecessor of user parent is
BB, we don't need to iterate through BB's successors for it.
Anastasia Stulova [Mon, 18 May 2020 10:02:01 +0000 (11:02 +0100)]
[OpenCL] Added addrspace_cast operator in C++ mode.
This operator is intended for casting between
pointers to objects in different address spaces
and follows similar logic as const_cast in C++.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60193
Dmitry Preobrazhensky [Mon, 18 May 2020 11:04:58 +0000 (14:04 +0300)]
[AMDGPU][MC] Corrected branch relocation handling to detect undefined labels
Fixed ELF object writer to die gracefully when an undefined label is encountered in a branch instruction.
See https://bugs.llvm.org/show_bug.cgi?id=41914.
Reviewers: arsenm, rampitec
Differential Revision: https://reviews.llvm.org/D79943
Kirill Bobyrev [Mon, 18 May 2020 10:20:11 +0000 (12:20 +0200)]
[clang-tidy] NFC: Cleanup Python scripts
Summary: Silence few PEP8 warnings.
Reviewers: hokein
Reviewed By: hokein
Subscribers: Eugene.Zelenko, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78985
Max Kazantsev [Mon, 18 May 2020 09:25:16 +0000 (16:25 +0700)]
[Test] Opportunity for sinking to unreachable in InstCombine
Hans Wennborg [Mon, 18 May 2020 09:20:42 +0000 (11:20 +0200)]
Revert
76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"
> Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).
>
> Differential Revision: https://reviews.llvm.org/D79447
This causes asserts in Chromium builds:
CodeViewDebug.cpp:2997: void llvm::CodeViewDebug::emitDebugInfoForUDTs(const std::vector<std::pair<std::string, const DIType *>> &):
Assertion `OriginalSize == UDTs.size()' failed.
I will follow up on the Phabricator issue.
Nathan James [Mon, 18 May 2020 09:11:22 +0000 (10:11 +0100)]
[NFC][clang-tidy] use hasOperands in place of hasEitherOperand
OCHyams [Mon, 18 May 2020 08:25:29 +0000 (09:25 +0100)]
[DebugInfo][DWARF] Emit a single location instead of a location list
for variables in nested scopes (including inlined functions) if there is a
single location which covers the entire scope and the scope is contained in a
single block.
Based on work by @jmorse.
Reviewed By: vsk, aprantl
Differential Revision: https://reviews.llvm.org/D79571
Martin Storsjö [Mon, 18 May 2020 08:04:42 +0000 (11:04 +0300)]
[compiler-rt] Don't error out on missing builtins when builting builtins themselves
This fixes bootstrapping the builtins when no previous version of
them exists after
2fe66bdb2e5fb556e15d4a07158e89ec007c587b.
Also fix a whitespace issue in that commit.
Clement Courbet [Mon, 27 Apr 2020 08:45:41 +0000 (10:45 +0200)]
[TargetLibraryInfo] memcpy and memset have optimized codegen.
Summary:
Add memcpy and memset to the list of function with optimized codegen.
hasOptimizedCodeGen() was returning false for them.
This was not an issue when working with c++ as clang typically emits an
intrinsic rather than a libfunc call, but when working with IR,
this would cause some issues with sanitizers which would not correctly
mark the function as nobuiltin in `maybeMarkSanitizerLibraryCallNoBuiltin()`.
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78991
Jim Lin [Mon, 18 May 2020 03:10:46 +0000 (11:10 +0800)]
[RISCV] Fix passing two floating-point values in complex separately by two GPRs on RV64
Summary:
This patch fixed the error of counting the remaining FPRs. Complex floating-point
values should be passed by two FPRs for the hard-float ABI. If no two FPRs are
available, it should be passed via a 64-bit GPR (fp+fp). `ArgFPRsLeft` is only
decreased one while the type is complex floating-point. It causes two floating-point
values in the complex are passed separately by two GPRs.
Reviewers: asb, luismarques, lenary
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, evandro, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79770
Alexander Shaposhnikov [Mon, 18 May 2020 03:46:17 +0000 (20:46 -0700)]
[llvm-objcopy][MachO] Fix code formatting
Apply clang-format to MachOObjcopy.cpp. NFC.
Test plan: make check-all
Chen Zheng [Mon, 18 May 2020 01:00:09 +0000 (21:00 -0400)]
[PowerPC] add more high latency opcodes for machinecombiner - NFC
Stephen Neuendorffer [Sun, 17 May 2020 22:17:04 +0000 (15:17 -0700)]
[MLIR][cmake] Fix unittest/Tablegen by special casing LLVMMLIRTableGen
unittest/Tablegen generates an executable that depends on MLIRIR and
LLVMMLIRTableGen. Avoid specifying linkage dependence on LLVM
libraries here because then everyone has to depend on those libraries.
Differential Revision: https://reviews.llvm.org/D80093
Mehdi Amini [Sun, 17 May 2020 23:16:21 +0000 (23:16 +0000)]
Fix warning "defined but not used" for debug function (NFC)
Mehdi Amini [Sun, 17 May 2020 19:25:35 +0000 (19:25 +0000)]
Replace dyn_cast with isa when the result isn't used (NFC)
Fix build warning: unused variable 'BB'
Mehdi Amini [Sun, 17 May 2020 19:24:33 +0000 (19:24 +0000)]
Remove spurious semicolon after function definition (NFC)
This fixes some GCC pedantic warnings.
Craig Topper [Sun, 17 May 2020 21:57:04 +0000 (14:57 -0700)]
ValueMapper does not preserve inline assembly dialect when remapping the type
Bug report: https://bugs.llvm.org/show_bug.cgi?id=45291
Patch by Tomasz Miąsko
Differential Revision: https://reviews.llvm.org/D80066
Stephen Neuendorffer [Sun, 17 May 2020 06:01:52 +0000 (23:01 -0700)]
[MLIR] Fix linkage for libMLIR.so
Generally:
1) don't use target_link_libraries() and add_mlir_library() on the same target, use LINK_LIBS PUBLIC instead.
2) don't use LINK_LIBS to specify LLVM libraries. Use LINK_COMPONENTS instead
3) no need to link against LLVMSupport. We pull it in by default.
Differential Revision: https://reviews.llvm.org/D80076
Stephen Neuendorffer [Sun, 17 May 2020 05:46:57 +0000 (22:46 -0700)]
[MLIR][cmake][NFC] Update linkage checker for mlir-opt
New CMakeLists.txt for MLIRStandardOpsTransforms was incorrect, but wasn't
caught by the check.
Differential Revision: https://reviews.llvm.org/D80075
Nikita Popov [Sun, 17 May 2020 20:14:42 +0000 (22:14 +0200)]
[Alignment] Remove unnecessary getValueOrABITypeAlignment calls (NFC)
Now that load/store alignment is required, we no longer need most
of them. Also switch the getLoadStoreAlignment() helper to return
Align instead of MaybeAlign.
Roman Lebedev [Sun, 17 May 2020 18:58:55 +0000 (21:58 +0300)]
[InstCombine] visitMaskedMerge(): when unfolding, sanitize undef constants (PR45955)
We can't leave undef vector element constants as-is,
it is a miscompile, so we need to sanitize them.
We have two vectors (C and ~C):
* We can't replace undef with 0 in both of them
* We can't replace undef with 0 in only one of them
* We could replace undef with -1 in both of them
* We could replace undef with -1 in only one(!) of them
* We could replace undef with -1 in one and 0 in another one of them.
Therefore, it seems best to go with the last option, since otherwise
we'd loose knowledge that C and ~C have no common bits set,
which seems more important than preserving partial undef knowledge.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45955
David Blaikie [Sun, 17 May 2020 19:17:31 +0000 (12:17 -0700)]
DebugInfo: Reduce long-distance dependence on what will/won't emit a debug_addr section
This is a no-op/NFC at the moment & generally makes the code /somewhat/
cleaner/less reliant on assumptions about what will produce a debug_addr
section.
It's still a bit "spooky action at a distance" - the add ranges code
pre-emptively inserts addresses into the address pool it knows will
eventually be used by the range emission code (or low/high pc).
The 'ideal' would be either to actually compute the addresses needed for
range (& loc) emission earlier - which would mean decanonicalizing the
range/loc representation earlier to account for whether it was going to
use addrx encodings or not (which would be unfortunate, but could be
refactored to be relatively unobtrusive).
Alternatively, emitting the range/loc sections earlier would cause them
to request the needed addresses sooner - but then you endup having to
split finalizeModuleInfo because some things need to be handled there
before the ranges/locs are emitted, I think...
Nikita Popov [Wed, 25 Mar 2020 19:51:01 +0000 (20:51 +0100)]
[LVI] Don't use dominator tree in isValidAssumeForContext()
LVI and its consumers currently have quite a bit of complexity
related to dominator tree management. However, it doesn't look
like it is actually needed...
The only use of the dominator tree is inside isValidAssumeForContext().
However, due to the way LVI queries work, it is not needed:
If we query a value for some block, we will first get the edge values
from all predecessor blocks, which also includes an intersection with
assumptions that apply to the terminator of the predecessor. As such,
we will already have processed all assumptions from predecessor blocks
(this is actually stronger than what isValidAssumeForContext() does
with a DT, because this is capable of combining non-dominating
assumptions). The only additional assumptions we need to take into
account are those in the block being queried. And we don't need a
dominator tree for that.
This patch only removes the use of DT, I will drop the machinery
around it in a followup.
Differential Revision: https://reviews.llvm.org/D76797
Fedor Sergeev [Sun, 17 May 2020 19:17:56 +0000 (02:17 +0700)]
Add missing include Host.h in llvm-mc-* fuzzers. NFC.
Fixes build failure in these fuzzers.
Nathan James [Sat, 16 May 2020 01:00:33 +0000 (02:00 +0100)]
[ASTMatchers] Added BinaryOperator hasOperands matcher
Summary: Adds a matcher called `hasOperands` for `BinaryOperator`'s when you need to match both sides but the order isn't important, usually on commutative operators.
Reviewers: klimek, aaron.ballman, gribozavr2, alexfh
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80054
JinGu Kang [Sun, 17 May 2020 18:49:37 +0000 (19:49 +0100)]
test commit
Simon Pilgrim [Sun, 17 May 2020 17:51:21 +0000 (18:51 +0100)]
Revert rGca18ce1a00cd8b7cb7ce0e130440f5ae1ffe86ee "GlobPattern.h - remove unnecessary BitVector.h/StringRef.h includes. NFC"
Causes lld build errors
Simon Pilgrim [Sun, 17 May 2020 17:29:27 +0000 (18:29 +0100)]
GlobPattern.h - remove unnecessary BitVector.h/StringRef.h includes. NFC
Use forward declarations (BitVector already had one) and an headers to source file that were implicitly using them.
Simon Pilgrim [Sun, 17 May 2020 17:03:15 +0000 (18:03 +0100)]
ImmutableGraph.h - remove unused raw_ostream.h include. NFC
Fangrui Song [Sun, 17 May 2020 16:31:09 +0000 (09:31 -0700)]
[XRay] Migrate xray_naive_log=true tests to xray_mode=xray-basic
Sanjay Patel [Sun, 17 May 2020 15:56:26 +0000 (11:56 -0400)]
[x86] favor vector constant load to avoid GPR to XMM transfer
This build vector lowering pattern came up in D79886.
I've tried to limit the improvement to cases where it looks
clearly better to load, but we could remove the 'TODO'
predicates already if we are willing to overlook some
corner cases.
Differential Revision: https://reviews.llvm.org/D80013
Sanjay Patel [Sun, 17 May 2020 15:40:27 +0000 (11:40 -0400)]
[InstCombine] add tests for FP cast of cast; NFC
A fold of casts is proposed as a backend transform in D79187,
but we can also do that in IR (and that may obsolete the need
for a backend transform).
Xing GUO [Sun, 17 May 2020 14:48:40 +0000 (22:48 +0800)]
[ObjectYAML][DWARF] Take into account other debug sections in DWARFYAML::Data::isEmpty().