River Riddle [Sun, 5 Apr 2020 08:03:24 +0000 (01:03 -0700)]
[mlir][ODS] Add support for variadic regions.
Summary: This revision adds support for marking the last region as variadic in the ODS region list with the VariadicRegion directive.
Differential Revision: https://reviews.llvm.org/D77455
Kazuaki Ishizaki [Sun, 5 Apr 2020 06:28:11 +0000 (15:28 +0900)]
[clang-tools-extra] NFC: Fix trivial typo in documents and comments
Differential Revision: https://reviews.llvm.org/D77458
vgxbj [Sun, 5 Apr 2020 04:31:22 +0000 (12:31 +0800)]
[llvm-objdump] Simplify conditional statements (isa<...>(Obj) => Obj->isSomeFile())
Summary: Simplify some conditional statements.
Reviewers: jhenderson, MaskRay, rupprecht
Reviewed By: MaskRay, rupprecht
Subscribers: rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75899
vgxbj [Sun, 5 Apr 2020 04:15:06 +0000 (12:15 +0800)]
[llvm-nm] Add test for `--debug-syms --dynamic`
Summary: This test ensures that `llvm-nm` will omit NULL symbol.
Reviewers: jhenderson, MaskRay, grimar
Reviewed By: jhenderson, grimar
Subscribers: rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76213
vgxbj [Sun, 5 Apr 2020 03:47:27 +0000 (11:47 +0800)]
[llvm-objdump][test] Recommit unimplemented-features.test
Recommit test case that removed by rG685bf42e9e0cc79cff6d26cf44749db98f148270
vgxbj [Sun, 5 Apr 2020 03:03:34 +0000 (11:03 +0800)]
[llvm-objdump][test] Remove unimplemented-features.test
Seems that this test breaks build bots.
http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/41418
Commit it later.
vgxbj [Sun, 5 Apr 2020 01:58:53 +0000 (09:58 +0800)]
[llvm-objdump] Teach `llvm-objdump` dump dynamic symbols.
Summary:
This patch is to teach `llvm-objdump` dump dynamic symbols (`-T` and `--dynamic-syms`). Currently, this patch is not fully compatible with `gnu-objdump`, but I would like to continue working on this in next few patches. It has two issues.
1. Some symbols shouldn't be marked as global(g). (`-t/--syms` has same issue as well) (Fixed by D75659)
2. `gnu-objdump` can dump version information and *dynamically* insert before symbol name field.
`objdump -T a.out` gives:
```
DYNAMIC SYMBOL TABLE:
0000000000000000 w D *UND*
0000000000000000 _ITM_deregisterTMCloneTable
0000000000000000 DF *UND*
0000000000000000 GLIBC_2.2.5 printf
0000000000000000 DF *UND*
0000000000000000 GLIBC_2.2.5 __libc_start_main
0000000000000000 w D *UND*
0000000000000000 __gmon_start__
0000000000000000 w D *UND*
0000000000000000 _ITM_registerTMCloneTable
0000000000000000 w DF *UND*
0000000000000000 GLIBC_2.2.5 __cxa_finalize
```
`llvm-objdump -T a.out` gives:
```
DYNAMIC SYMBOL TABLE:
0000000000000000 w D *UND*
0000000000000000 _ITM_deregisterTMCloneTable
0000000000000000 g DF *UND*
0000000000000000 printf
0000000000000000 g DF *UND*
0000000000000000 __libc_start_main
0000000000000000 w D *UND*
0000000000000000 __gmon_start__
0000000000000000 w D *UND*
0000000000000000 _ITM_registerTMCloneTable
0000000000000000 w DF *UND*
0000000000000000 __cxa_finalize
```
Reviewers: jhenderson, grimar, MaskRay, espindola
Reviewed By: jhenderson, grimar
Subscribers: emaste, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75756
Kazuaki Ishizaki [Sun, 5 Apr 2020 02:30:01 +0000 (11:30 +0900)]
[mlir] NFC: Fix trivial typo
Differential Revision: https://reviews.llvm.org/D77473
Kazuaki Ishizaki [Sun, 5 Apr 2020 02:25:24 +0000 (11:25 +0900)]
[clang-tools-extra] NFC: Fix trivial typo in documents and comments
Differential Revision: https://reviews.llvm.org/D77458
Matt Arsenault [Tue, 11 Sep 2018 04:32:54 +0000 (11:32 +0700)]
AMDGPU: Fix annotate kernel features through casted calls
I thought I was testing this before, but the workitem id x
case isn't great since it's mandatory in the parent kernel.
Shinji Okumura [Sun, 5 Apr 2020 00:15:26 +0000 (19:15 -0500)]
[Attributor] AAReachability : use isPotentiallyReachable in isKnownReachable
`isKnownReachable` had only interface (always returns true).
Changed it to call `isPotentiallyReachable`.
This change enables deductions of other Abstract Attributes depending on
AAReachability to use reachability information obtained from CFG, and it
can make them stronger.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D76210
Shinji Okumura [Sat, 4 Apr 2020 16:38:09 +0000 (11:38 -0500)]
[Attributor] Make use of analysis in the MustBeExecutedExplorer
This commit was made to settle [[ https://github.com/llvm/llvm-project/issues/175 | this issue on GitHub ]].
I added analysis getters for LoopInfo, DominatorTree, and
PostDominatorTree. And I added a test to show an improvement of the
deduction of `dereferenceable` attribute.
Reviewed By: jdoerfert, uenoku
Differential Revision: https://reviews.llvm.org/D76378
Matt Arsenault [Wed, 15 Aug 2018 19:45:04 +0000 (22:45 +0300)]
AMDGPU: Add feature for fast f32 denormals
Stefanos Baziotis [Sat, 4 Apr 2020 23:46:26 +0000 (02:46 +0300)]
[Attributor] AAUndefinedBehavior: Use AAValueSimplify in memory accessing instructions.
Query AAValueSimplify on pointers in memory accessing instructions to take
advantage of the constant propagation (or any other value simplification) of such values.
Kamil Rytarowski [Sat, 4 Apr 2020 22:54:55 +0000 (00:54 +0200)]
[compiler-rt] Fix build on NetBSD 9.99.52+
Add a fallback definition of the netsmb device driver that
was removed.
Simon Pilgrim [Sat, 4 Apr 2020 21:46:36 +0000 (22:46 +0100)]
[CostModel][X86] Add some insert subvector cost tests for vXf32/vXi32/vXi16/vXi8 types
Simon Pilgrim [Sat, 4 Apr 2020 19:13:54 +0000 (20:13 +0100)]
[X86] Cleanup vectorcall test checks
PR32397 still needs to be fixed for the update script to process this
Louis Dionne [Sat, 4 Apr 2020 20:53:35 +0000 (16:53 -0400)]
[libc++] Enable the new libc++ testing format by default
Both test formats are equivalent, so this *should* not be a problem.
However, I'm taking advantage of the week-end to test this and see if
there are any failures. If so, it should be fine to revert this until
the failures have been addressed.
For the time being, it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit.
Brian Gesiak [Sat, 4 Apr 2020 17:01:32 +0000 (13:01 -0400)]
libcxx 'LLVM_USE_SANITIZER=Address;Undefined'
Summary:
Allow users to simultaneously enable address and undefined behavior
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'
allows.
Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`
would succeed and the build would build most of the LLVM project with
`-fsanitize=address,undefined`, but a warning would be printed by
libcxx's CMake, and the build would use neither sanitizer. This
patch results in no warning being printed, and both sanitizers are used
in building libcxx.
Reviewers: jroelofs, EricWF, ldionne, #libc!
Subscribers: mgorny, dexonsmith, llvm-commits, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D77466
Jonathan Roelofs [Sat, 4 Apr 2020 19:47:22 +0000 (13:47 -0600)]
Revert "[DAG] Fix PR45049: LegalizeTypes crash"
This reverts commit
17673ae0b2cbf8d48973b673d413fb8591d8aae7.
Jonathan Roelofs [Sat, 28 Mar 2020 18:55:51 +0000 (12:55 -0600)]
[DAG] Fix PR45049: LegalizeTypes crash
Sometimes LegalizeTypes knows about common subexpressions before SelectionDAG
does, leading to accidental SDValue removal before its reference count was
truly zero.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=45049
https://reviews.llvm.org/D76994
Fangrui Song [Fri, 27 Mar 2020 04:20:13 +0000 (21:20 -0700)]
[ELF][PPC64] Enable R_PPC64_REL14 trunks
The thunk implementation is available but an assertion disallows it.
Linux kernel has such a use case: in arch/powerpc/kernel/exceptions-64s.S:handle_page_fault,
beq+ ret_from_except_lite may get out of range.
Link: https://github.com/ClangBuiltLinux/linux/issues/951
Differential Revision: https://reviews.llvm.org/D76904
Fangrui Song [Sat, 4 Apr 2020 17:24:48 +0000 (10:24 -0700)]
[ELF][test] Test that thunks are processed before finalizeSynthetic(in.symTab)
finalizeSynthetic(in.symTab) calls sortSymTabSymbols() to order local
symbols before non-local symbols.
The newly added tests ensure that thunk symbols are added before
finalizeSynthetic(in.symTab), otherwise .symtab would be out of order.
Sanjay Patel [Sat, 4 Apr 2020 17:43:27 +0000 (13:43 -0400)]
[ValueTracking] add tests for smin/smax; NFC
Sanjay Patel [Sat, 4 Apr 2020 15:36:12 +0000 (11:36 -0400)]
[InstCombine] add more tests for min/max folding; NFC
Florian Hahn [Sat, 4 Apr 2020 14:19:20 +0000 (15:19 +0100)]
[LV] Simplify tryToWiden as recipes are not re-used (NFC).
After
49d00824bbbb, VPWidenRecipe only stores a single instruction.
tryToWiden can simply return the widen recipe, like other helpers in
VPRecipeBuilder.
Jean-Michel Gorius [Sat, 4 Apr 2020 17:15:44 +0000 (17:15 +0000)]
[mlir] Add an out-of-tree dialect example
This adds a minimal out-of-tree dialect template which can be used to start work on a standalone dialect implementation without having to integrate it in the main LLVM tree.
It mostly sets up the directory structure and provides CMakeLists.txt files to build a dialect library, an opt-like tool to operate on that dialect as well as tests. It could be expanded in the future to add examples of more user-defined operations, types, attributes, generated enums, transforms, etc. and linked to a tutorial.
Differential Revision: https://reviews.llvm.org/D77133
Heejin Ahn [Sat, 4 Apr 2020 16:45:47 +0000 (09:45 -0700)]
[WebAssembly] Fix a sanitizer error in WasmEHPrepare
Summary:
D77423 started using a dominator tree in WasmEHPrepare, but we deleted
BBs in `prepareThrows` before we used the domtree in `prepareEHPads`,
and those CFG changes were not reflected in the domtree. This uses
`DomTreeUpdater` to make sure we update the domtree every time we delete
BBs from the CFG. This fixes ubsan/msan/expensive_check errors caught in
LLVM buildbots.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77465
Nico Weber [Sat, 4 Apr 2020 16:52:37 +0000 (12:52 -0400)]
fix typo in comment to cycle bots
Nikita Popov [Wed, 1 Apr 2020 20:56:53 +0000 (22:56 +0200)]
[InstCombine] Don't limit uses in eraseInstFromFunction()
eraseInstFromFunction() adds the operands of the erased instructions,
as those might now be dead as well. However, this is limited to
instructions with less than 8 operands.
This check doesn't make a lot of sense to me. As the instruction
gets removed afterwards, I don't see a potential for anything
overly pathological happening here (as we can only add those
operands to the worklist once). The impact on CTMark is in
the noise. We also have the same code in instruction sinking
and don't limit the operand count there.
Differential Revision: https://reviews.llvm.org/D77325
Luofan Chen [Sat, 4 Apr 2020 16:32:36 +0000 (11:32 -0500)]
[Attributor] Deduce attributes for non-exact functions
This patch is based on D63312 and D63319. For now we create shallow wrappers for all functions that are IPO amendable.
See also [this github issue](https://github.com/llvm/llvm-project/issues/172).
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D76404
Johannes Doerfert [Sun, 29 Mar 2020 20:55:52 +0000 (15:55 -0500)]
[OpenMP][NFC] Remove unnecessary argument
Nico Weber [Sat, 4 Apr 2020 16:34:20 +0000 (12:34 -0400)]
Disable relative paths in lit.site.cfg in presence of symlinks
See https://reviews.llvm.org/D77184#1961208
Tamás Zolnai [Sat, 4 Apr 2020 15:17:52 +0000 (17:17 +0200)]
[clang-tidy]: fix false positive of cert-oop54-cpp check.
Summary:
It seems we need a different matcher for binary operator
in a template context.
Fixes this issue:
https://bugs.llvm.org/show_bug.cgi?id=44499
Reviewers: aaron.ballman, alexfh, hokein, njames93
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D76990
Heejin Ahn [Tue, 31 Mar 2020 23:08:01 +0000 (16:08 -0700)]
[WebAssembly] Fix wasm.lsda() optimization in WasmEHPrepare
Summary:
When we insert a call to the personality function wrapper
(`_Unwind_CallPersonality`) for a catch pad, we store some necessary
info in `__wasm_lpad_context` struct and pass it. One of the info is the
LSDA address for the function. For this, we insert a call to
`wasm.lsda()`, which will be lowered down to the address of LSDA, and
store it in a field in `__wasm_lpad_context`.
There are exceptions to this personality call insertion: catchpads for
`catch (...)` and cleanuppads (for destructors) don't need personality
function calls, because we don't need to figure out whether the current
exception should be caught or not. (They always should.)
There was a little optimization to `wasm.lsda()` call insertion. Because
the LSDA address is the same throughout a function, we don't need to
insert a store of `wasm.lsda()` return value in every catchpad. For
example:
```
try {
foo();
} catch (int) {
// wasm.lsda() call and a store are inserted here, like, in
// pseudocode,
// %lsda = wasm.lsda();
// store %lsda to a field in __wasm_lpad_context
try {
foo();
} catch (int) {
// We don't need to insert the wasm.lsda() and store again, because
// to arrive here, we have already stored the LSDA address to
// __wasm_lpad_context in the outer catch.
}
}
```
So the previous algorithm checked if the current catch has a parent EH
pad, we didn't insert a call to `wasm.lsda()` and its store.
But this was incorrect, because what if the outer catch is `catch (...)`
or a cleanuppad?
```
try {
foo();
} catch (...) {
// wasm.lsda() call and a store are NOT inserted here
try {
foo();
} catch (int) {
// We need wasm.lsda() here!
}
}
```
In this case we need to insert `wasm.lsda()` in the inner catchpad,
because the outer catchpad does not have one.
To minimize the number of inserted `wasm.lsda()` calls and stores, we
need a way to figure out whether we have encountered `wasm.lsda()` call
in any of EH pads that dominates the current EH pad. To figure that
out, we now visit EH pads in BFS order in the dominator tree so that we
visit parent BBs first before visiting its child BBs in the domtree.
We keep a set named `ExecutedLSDA`, which basically means "Do we have
`wasm.lsda()` either in the current EH pad or any of its parent EH
pads in the dominator tree?". This is to prevent scanning the domtree up
to the root in the worst case every time we examine an EH pad: each EH
pad only needs to examine its immediate parent EH pad.
- If any of its parent EH pads in the domtree has `wasm.lsda()`, this
means we don't need `wasm.lsda()` in the current EH pad. We also insert
the current EH pad in `ExecutedLSDA` set.
- If none of its parent EH pad has `wasm.lsda()`
- If the current EH pad is a `catch (...)` or a cleanuppad, done.
- If the current EH pad is neither a `catch (...)` nor a cleanuppad,
add `wasm.lsda()` and the store in the current EH pad, and add the
current EH pad to `ExecutedLSDA` set.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77423
Simon Pilgrim [Sat, 4 Apr 2020 12:08:01 +0000 (13:08 +0100)]
[CostModel][X86] Add shuffle cost tests for sub-128bit vectors
Simon Pilgrim [Sat, 4 Apr 2020 11:44:56 +0000 (12:44 +0100)]
[CostModel][X86] Add insert/extract cost tests for sub-128bit vXi8/vXi16 vectors
Simon Pilgrim [Sat, 4 Apr 2020 10:42:06 +0000 (11:42 +0100)]
[X86][SSE] lowerV8I16Shuffle - lower compaction shuffles using PACKUSDW(PBLENDW,PBLENDW) on SSE41+
Similar to the lowerV16I8Shuffle implementation, for binary compaction v8i16 shuffles we can avoid the PUNPCKLDQ(PSHUFB,PSHUFB) pattern on SSE41+ targets by using PACKUSDW and PBLENDW. Before SSE41 we would need to use PACKSSDW but that requires sign extension that seems to destroy any gains, even on targets without PSHUFB.
This is a bigger gain on AMD than Intel targets but should never be a regression, and avoiding the shuffle mask load(s) is always useful.
Noticed in codegen while dealing with PR31443.
Nikita Popov [Thu, 2 Apr 2020 19:35:24 +0000 (21:35 +0200)]
[IRBuilder] Move some code into the cpp file; NFC
Since D73835 we no longer need to define the whole IRBuilder
implementation in the header. This patch moves some of the larger
methods out of line, into the C++ file.
Differential Revision: https://reviews.llvm.org/D77332
Nikita Popov [Sat, 4 Apr 2020 10:40:09 +0000 (12:40 +0200)]
[VNCoercion] Use IRBuilderBase; NFC
And remove include from header.
vgxbj [Sat, 4 Apr 2020 10:17:58 +0000 (18:17 +0800)]
[Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0
Summary:
Note: This revision is very similar to D62296.
In D75756, we need `getDynamicSymbolIterators()` to skip first NULL symbol in `.dynsym`. And I believe it might be worth pointing this out in a separate patch to gather you experts' opinions.
I have checked that current code base will not be affected by this change.
```
dynamic_symbol_begin()
|- dynamic_symbol_end(): Ok
`- getDynamicSymbolIterators()
|- addDynamicElfSymbols(): llvm/tools/llvm-objdump/llvm-objdump.cpp, Line 934
| Ok, NULL symbol will be omitted by Line 945-947
| StringRef Name = unwrapOrError(Symbol.getName(), Obj->getName());
| if (Name.empty()) continue;
|- dumpSymbolNameFromObject(): llvm/tools/llvm-nm/llvm-nm.cpp, Line 1192
| There's no test for dumping dynamic debugging symbol. This patch helps improve llvm-nm behavior. (we should add test for this later)
`- computeSymbolSizes(): llvm/lib/Object/SymbolSize.cpp, Line 52
|- OProfileJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp, Line 92
| Ok, NULL symbol will be omitted by Line 94-95
| if (!Sym.getType() || *Sym.getType() != SF_Function) continue;
|- IntelJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp, Line 98
| Ok, NULL symbol will be omitted by Line 124-126 (same as previous one)
|- PerfJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp, Line 244
| Ok, NULL symbol will be omitted by Line 254-256, (same as previous one)
|- SymbolizableObjectFile::create(): llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp, Line 73
| Ok, NULL symbol will be omitted by Line 75
| res->addSymbol()
| In addSymbol(), Line 167-168
| if (!Sec || (Obj && Obj->section_end() == *Sec)) return std::error_code();
|- dumpCXXData(): llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp, Line 189
| Ok, NULL symbol will be omitted by Line 199-202
| object::section_iterator SecI = *SecIOrErr;
| // Skip external symbols.
| if (SecI == Obj->section_end())
| continue;
`- printLineInfoForInput(): llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp, Line 418
Ok, NULL symbol will be omitted by Line 430-477
if (Type == object::SymbolRef::ST_Function) {
...
}
```
Reviewers: grimar, jhenderson, MaskRay
Reviewed By: jhenderson, MaskRay
Subscribers: rupprecht, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76081
Nikita Popov [Sat, 4 Apr 2020 10:34:16 +0000 (12:34 +0200)]
[Reassociate] Use IRBuilderBase; NFC
And remove now unnecessary IRBuilder.h include in header.
Nikita Popov [Sat, 4 Apr 2020 10:02:21 +0000 (12:02 +0200)]
[IVDescriptors] Remove IRBuilder.h include; NFC
IVDescriptors.h itself does not reference IRBuilder at all.
Move the include into transformation passes that do.
Nikita Popov [Sat, 4 Apr 2020 09:51:06 +0000 (11:51 +0200)]
[IVDescriptors] Remove unnecessary DemandedBits.h include; NFC
Forward declare DemandedBits in IVDescriptors, and move include
into the cpp file. Also drop the include from LoopUtils, which
does not need it at all.
Eric Fiselier [Sat, 4 Apr 2020 07:18:01 +0000 (03:18 -0400)]
[libc++] Attempt to workaround module invalidation bug
Sam McCall [Sat, 4 Apr 2020 06:06:24 +0000 (08:06 +0200)]
[clangd] Tweak parseDocumentation loop to use raw lines. NFC
This clears the way for the raw lines themselves to be parsed easily.
(Okay, one functional change: fix punctuation linebreaks with trailing WS)
Sam McCall [Fri, 3 Apr 2020 15:09:38 +0000 (17:09 +0200)]
[clang] Annotate trivial getters and setters on hover.
Summary: (Only if their definitions are visible and they have no other docs)
Reviewers: kadircet
Subscribers: jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77408
Frederik Gossen [Sat, 4 Apr 2020 04:33:58 +0000 (04:33 +0000)]
[MLIR] Fix shape inference in toy tutorial
The implementation of shape inference in the toy tutorial did not conform to the correct algorithmic description.
The result was only correct because all operations appear to be processed in sequence.
Differential Revision: https://reviews.llvm.org/D77382
Matt Arsenault [Sat, 4 Apr 2020 03:17:28 +0000 (23:17 -0400)]
AMDGPU: Fix a few more tests with old denormal subtarget features
Mehdi Amini [Sat, 4 Apr 2020 03:21:12 +0000 (03:21 +0000)]
Add mention of advantages of `arc` in the Phabricator doc.
Differential Revision: https://reviews.llvm.org/D76952
Richard Smith [Sat, 4 Apr 2020 03:17:43 +0000 (20:17 -0700)]
Don't treat a CXXScopeSpec with a nested name specifier but no location
as invalid.
We create those when forming trivial type source information with no
associated location, which, unfortunately, we do create in some cases
(when a TreeTransform with no base location is used to transform a
QualType).
This would previously lead to rejects-valid bugs when we misinterpreted
these constructs as having no nested-name-specifier.
Frederik Gossen [Sat, 4 Apr 2020 03:17:15 +0000 (03:17 +0000)]
Fix typos in toy tutorial
Fix two typos throughout the chapters.
Differential Revision: https://reviews.llvm.org/D77397
Kazuaki Ishizaki [Sat, 4 Apr 2020 03:06:29 +0000 (12:06 +0900)]
[OpenMP] NFC: Fix trivial typo
Differential Revision: https://reviews.llvm.org/D77430
Jim Ingham [Sat, 4 Apr 2020 02:58:56 +0000 (19:58 -0700)]
The thread plan list test is failing at least on Ubuntu Linux.
Mark it expected fail for now.
The test output shows that the "internal" thread listing isn't showing the
step out plan that we use to step back out of a function we're stepping into.
The internal plan listing code has nothing platform specific in it, so that
isn't the problem.
I am pretty sure the difference is that on MacOS we step into the function and then need to
step back out again so we push the internal plan the test is checking for. But on Linux we
are able to step past the function without stepping into it.
So nothing is actually going wrong here, I just need to find a better test case where I
can ensure we are going to have to push a private plan. It's probably better to test this
using a custom thread plan, then I can control the state of the plan stack better.
That's for Monday...
Walter Erquinigo [Sat, 4 Apr 2020 02:49:07 +0000 (19:49 -0700)]
Fix LLDB debug builds
Summary:
A recent change in ThreadPlans introduced this little compilation error.
Seems to be related to the work around https://reviews.llvm.org/D76814.
Reviewers: clayborg, labath, jingham
Reviewed By: jingham
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D77450
River Riddle [Sat, 4 Apr 2020 02:20:33 +0000 (19:20 -0700)]
[mlir][DeclarativeParser] Emit an error if a `:` follows an attribute with a non-constant type.
Summary: The attribute grammar includes an optional trailing colon type, so for attributes without a constant buildable type this will generally lead to unexpected and undesired behavior. Given that, it's better to just error out on these cases.
Differential Revision: https://reviews.llvm.org/D77293
Walter Erquinigo [Sat, 4 Apr 2020 00:29:32 +0000 (17:29 -0700)]
[source maps] Fix remove, insert-after and replace
Summary:
In this diff of mine D77186 I introduce a bug in the replace operation, where I was failing fast by mistake.
Besides, a similar problem existed in the insert-after operation, where it was failing fast.
Finally, the remove operation was wrong, as it was not using the indices provided by the users.
I fixed those issues and added some tests account for cases with multiple elements in these requests.
Reviewers: labath, clayborg
Reviewed By: labath
Subscribers: mgrang, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D77324
River Riddle [Sat, 4 Apr 2020 02:02:39 +0000 (19:02 -0700)]
[mlir] Change the default of `mlir-print-op-on-diagnostic` to true
Summary: It is a very common user trap to think that the location printed along with the diagnostic is the same as the current operation that caused the error. This revision changes the behavior to always print the current operation, except for when diagnostics are being verified. This is achieved by moving the command line flags in IR/ to be options on the MLIRContext.
Differential Revision: https://reviews.llvm.org/D77095
Nemanja Ivanovic [Sat, 4 Apr 2020 01:41:22 +0000 (20:41 -0500)]
[NFC][PowerPC] Pre-commit a test case for D77448
Pre-committing the new test case so the review shows only the diffs.
Richard Smith [Sat, 4 Apr 2020 01:22:17 +0000 (18:22 -0700)]
PR45402: Make the restrictions on constant evaluation of memcmp and
memchr consistent and comprehensible, and document them.
We previously allowed evaluation of memcmp on arrays of integers of any
size, so long as the call evaluated to 0, and allowed evaluation of
memchr on any array of integral type of size 1 (including enums). The
purpose of constant-evaluating these builtins is only to support
constexpr std::char_traits, so we now consistently allow them on arrays
of (possibly signed or unsigned) char only.
Jim Ingham [Sat, 4 Apr 2020 01:02:51 +0000 (18:02 -0700)]
This test is failing on the Ubuntu bot but the bot log doesn't
capture the test stdout, so put the info I need to see in the error
message instead.
Eli Friedman [Fri, 3 Apr 2020 22:11:40 +0000 (15:11 -0700)]
[clang][opaque pointers] Fix up a bunch of "getType()->getElementType()"
In contexts where we know an LLVM type is a pointer, there's generally
some simpler way to get the pointee type.
Eli Friedman [Fri, 3 Apr 2020 21:57:12 +0000 (14:57 -0700)]
[polly][opaque pointers] Remove use of deprecated APIs.
(See also D76269.)
Eli Friedman [Fri, 3 Apr 2020 21:54:36 +0000 (14:54 -0700)]
[clang codegen][opaque pointers] Remove use of deprecated constructor
(See also D76269.)
Eli Friedman [Fri, 3 Apr 2020 21:52:18 +0000 (14:52 -0700)]
[llvm-stress][opaque pointers] Remove use of deprecated constructor
(See also D76269.)
Eric Christopher [Sat, 4 Apr 2020 00:58:59 +0000 (17:58 -0700)]
Fix unused variable, format, and format string warnings.
NFC.
Walter Erquinigo [Thu, 2 Apr 2020 19:03:32 +0000 (12:03 -0700)]
[intel-mpx] Delete an unnecessary license header
Summary:
@labath mentioned to me that test files shouldn't have a license header.
I saw this one some days ago, so I'm doing some cleaning.
Reviewers: labath, clayborg
Subscribers: lldb-commits, labath
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D77328
Jim Ingham [Sat, 4 Apr 2020 00:13:07 +0000 (17:13 -0700)]
Disable two new tests on Windows. They are failing but the logs are not helpful.
Also turn on the command trace unconditionally for TestThreadPlanCommands.py as the
tests for the Ubuntu bot don't seem to run with -t making it hard to see why this is
failing remotely.
LLVM GN Syncbot [Sat, 4 Apr 2020 00:07:07 +0000 (00:07 +0000)]
[gn build] Port
1d42c0db9a2
Craig Topper [Fri, 3 Apr 2020 23:54:38 +0000 (16:54 -0700)]
Revert "[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets"
This reverts commit
c74dd640fd740c6928f66a39c7c15a014af3f66f.
Reverting to address coding standard issues raised in post-commit
review.
Craig Topper [Fri, 3 Apr 2020 23:54:04 +0000 (16:54 -0700)]
Revert "[X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)"
This reverts commit
62c42e29ba43c9d79cd5bd2084b641fbff6a96d5
Reverting to address coding standard issues raised in post-commit
review.
Reid Kleckner [Fri, 3 Apr 2020 20:42:23 +0000 (13:42 -0700)]
[MS] Fix assert handling enum forward decls in hasVisibleDefinition
An enum may be considered to be a complete type if it was forward
declared. It may be declared with a fixed underlying type, or, in MSVC
compatiblity mode, with no type at all.
Previously, the code was written with special handling for fixed enums.
I generalized the code to check if the underlying integer type is known,
which should be the case when targetting the MSVC C++ ABI.
Fixes PR45409
Joerg Sonnenberger [Fri, 3 Apr 2020 22:48:02 +0000 (00:48 +0200)]
Avoid using std::max_align_t in pre-C++11 mode
Always depend on the compiler to have a correct implementation of
max_align_t in stddef.h and don't provide a fallback. For pre-C++11,
require __STDCPP_NEW_ALIGNMENT__ in <new> as provided by clang in all
standard modes. Adjust test cases to avoid testing or using max_align_t
in pre-C++11 mode and also to better deal with alignof(max_align_t)>16.
Document requirements of the alignment tests around natural alignment of
power-of-two-sized types.
Differential revision: https://reviews.llvm.org/D73245
Volodymyr Sapsai [Fri, 3 Apr 2020 23:25:37 +0000 (16:25 -0700)]
[ObjC generics] Fix not inheriting type bounds in categories/extensions.
When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like
> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'
We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that wasn't updated and
remains `id`.
Fix by updating not only `ObjCTypeParamDecl` UnderlyingType but also
TypeForDecl as we use the underlying type to create a canonical type for
`ObjCTypeParamType` (see `ASTContext::getObjCTypeParamType`).
This is a different approach to fixing the issue. The previous one was
02c2ab3d8872416589bd1a6ca3dfb96ba373a3b9 which was reverted in
4c539e8da1b3de38a53ef3f7497f5c45a3243b61. The problem with the previous
approach was that `ObjCTypeParamType::desugar` was returning underlying
type for `ObjCTypeParamDecl` without applying any protocols stored in
`ObjCTypeParamType`. It caused inconsistencies in comparing types before
and after desugaring.
rdar://problem/
54329242
Reviewed By: erik.pilkington
Differential Revision: https://reviews.llvm.org/D72872
Francis Visoiu Mistrih [Fri, 3 Apr 2020 19:29:54 +0000 (12:29 -0700)]
[Driver] Handle all optimization-record options for Darwin LTO
clang with -flto does not handle -foptimization-record-path=<path>
This dulicates the code from ToolChains/Clang.cpp with modifications to
support everything in the same fashion.
Paula Toth [Fri, 3 Apr 2020 22:14:33 +0000 (15:14 -0700)]
[libc] Fix memcpy to adhere to qualified calls.
Summary: Switched to using the new memcpy implementation.
Reviewers: sivachandra, abrachet, gchatelet
Reviewed By: abrachet, gchatelet
Subscribers: mgorny, MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D77277
Jan Kratochvil [Fri, 3 Apr 2020 22:12:59 +0000 (00:12 +0200)]
[lldb] Findtypes -gmodules fix for too many matches
Apparently the intention was to copy the condition above:
if (types.GetSize() >= max_matches)
break;
So that if the iteration stopped because of too many matches we do not
add even more matches in this 'Clang modules' block downward.
It was implemented by:
SymbolFileDWARF: Unconditionally scan through clang modules. NFCish
fe9eaadd68307347d97698fd0a1646827eafd290
Differential Revision: https://reviews.llvm.org/D77336
Paula Toth [Fri, 3 Apr 2020 21:47:15 +0000 (14:47 -0700)]
[libc] Add strlen implementation.
Summary: This should fix the call to a non internal libc function.
Reviewers: sivachandra, abrachet
Reviewed By: sivachandra
Subscribers: xbolva00, mgorny, MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D77279
Jim Ingham [Wed, 18 Mar 2020 19:05:08 +0000 (12:05 -0700)]
Allow the ThreadPlanStackMap to hold the thread plans for threads
that were not reported by the OS plugin. To facilitate this, move
adding/updating the ThreadPlans for a Thread to the ThreadPlanStackMap.
Also move dumping thread plans there as well.
Added some tests for "thread plan list" and "thread plan discard" since
I didn't seem to have written any originally.
Differential Revision: https://reviews.llvm.org/D76814
Jim Ingham [Tue, 10 Mar 2020 23:18:11 +0000 (16:18 -0700)]
Move thread plan stacks into the Process, indexed by TID.
Differential Revision: https://reviews.llvm.org/D75880
Jim Ingham [Tue, 10 Mar 2020 21:04:42 +0000 (14:04 -0700)]
Make ThreadPlanTracers use TID & Process rather than Thread *.
Differential Revision: https://reviews.llvm.org/D75720
Jim Ingham [Tue, 10 Mar 2020 21:03:53 +0000 (14:03 -0700)]
Make ThreadPlans use TID and Process, rather than Thread *.
Differential Revision: https://reviews.llvm.org/D75711
Louis Dionne [Fri, 3 Apr 2020 21:50:39 +0000 (17:50 -0400)]
[libc++] Lit: Add default values for most arguments of test executors
Alex Zinenko [Fri, 3 Apr 2020 17:55:48 +0000 (19:55 +0200)]
[mlir] LoopToStandard conversion: support "if/else" with results
Summary:
A recent extension allowed the `loop.if` operation to return results yielded by
its regions. However, such operations could not be lowered to a CFG of standard
operations because it would have required to modify the argument list of a
block, which is not allowed in a conversion pattern. Now that the conversion
infrastructure supports block creation, use it to create a block with an
argument list that dominates the operations following the `loop.if` and forward
the results as arguments of this block.
Depends On D77416
Differential Revision: https://reviews.llvm.org/D77418
Sanjay Patel [Fri, 3 Apr 2020 21:09:38 +0000 (17:09 -0400)]
[InstCombine] add tests for freelyNegateValue with 'not'; NFC
Nico Weber [Fri, 3 Apr 2020 21:15:09 +0000 (17:15 -0400)]
Fix standalone clang builds after
fb80b6b2d58.
When clang is built against a prebuilt LLVM, LLVM_SOURCE_DIR is
empty, which due to a cmake quirk caused list lengths to get out
of sync. Add a workaround.
Nick Desaulniers [Fri, 3 Apr 2020 21:07:16 +0000 (14:07 -0700)]
[test] preformat test with update_llc_test_checks.py NFC
Summary:
Prior to landing D76961, preprocess via:
$ llvm/utils/update_llc_test_checks.py \
llvm/test/CodeGen/X86/callbr-asm-outputs.ll
Reviewers: void, MaskRay
Reviewed By: void, MaskRay
Subscribers: MaskRay, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77356
Scott Constable [Fri, 3 Apr 2020 20:41:34 +0000 (13:41 -0700)]
[X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)
After finding all such gadgets in a given function, the pass minimally inserts
LFENCE instructions in such a manner that the following property is satisfied:
for all SOURCE+SINK pairs, all paths in the CFG from SOURCE to SINK contain at
least one LFENCE instruction. The algorithm that implements this minimal
insertion is influenced by an academic paper that minimally inserts memory
fences for high-performance concurrent programs:
http://www.cs.ucr.edu/~lesani/companion/oopsla15/OOPSLA15.pdf
The algorithm implemented in this pass is as follows:
1. Build a condensed CFG (i.e., a GadgetGraph) consisting only of the following components:
-SOURCE instructions (also includes function arguments)
-SINK instructions
-Basic block entry points
-Basic block terminators
-LFENCE instructions
2. Analyze the GadgetGraph to determine which SOURCE+SINK pairs (i.e., gadgets) are already mitigated by existing LFENCEs. If all gadgets have been mitigated, go to step 6.
3. Use a heuristic or plugin to approximate minimal LFENCE insertion.
4. Insert one LFENCE along each CFG edge that was cut in step 3.
5. Go to step 2.
6. If any LFENCEs were inserted, return true from runOnFunction() to tell LLVM that the function was modified.
By default, the heuristic used in Step 3 is a greedy heuristic that avoids
inserting LFENCEs into loops unless absolutely necessary. There is also a
CLI option to load a plugin that can provide even better optimization,
inserting fewer fences, while still mitigating all of the LVI gadgets.
The plugin can be found here: https://github.com/intel/lvi-llvm-optimization-plugin,
and a description of the pass's behavior with the plugin can be found here:
https://software.intel.com/security-software-guidance/insights/optimized-mitigation-approach-load-value-injection.
Differential Revision: https://reviews.llvm.org/D75937
Reid Kleckner [Fri, 3 Apr 2020 19:35:30 +0000 (12:35 -0700)]
[OpenMP][NFC] Remove the need to include `OpenMPClause.h`
See rational here: https://reviews.llvm.org/D76173#1922916
Time to compile Attr.h in isolation goes from 2.6s to 1.8s.
Original patch by Johannes, plus some additions from Reid to fix some
clang tooling targets.
Effect on transitive includes is marginal, though:
$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
| grep '^[-+] ' | sort | uniq -c | sort -nr
104 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/AST/OpenMPClause.h
87 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPContext.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SmallSet.h
19 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/ADT/SetVector.h
14 - /usr/include/c++/9/set
...
Differential Revision: https://reviews.llvm.org/D76184
Nicolas Vasilache [Fri, 3 Apr 2020 04:08:22 +0000 (00:08 -0400)]
[mlir][Linalg] Employ finer-grained control of C interface emission
Summary:
Linalg makes it possible to interface codegen with externally precompiled HPC libraries. The mechanism to allow such interop uses a normalized ABI and the emission of C interface wrappers.
The mechanism controlling these C interface emission is too aggressive and makes it very easy to obtained undefined symbols for external function (e.g. the ones coming from libm).
This revision uses the newly introduced llvm.emit_c_interface function attribute which allows controlling this behavior at a function granularity. As a consequence LinalgToLLVM does not need to activate the C wrapper emission when adding the StdToLLVM patterns.
Differential Revision: https://reviews.llvm.org/D77364
LLVM GN Syncbot [Fri, 3 Apr 2020 20:07:19 +0000 (20:07 +0000)]
[gn build] Port
c74dd640fd7
Julian Lettner [Thu, 24 Oct 2019 06:36:29 +0000 (23:36 -0700)]
[lit] Cleanly exit on user keyboard interrupt
Graceful lit shutdown on user keyboard interrupt [Ctrl+C] was a
longstanding goal of mine. After a few refactorings this revision
finally enables it. We use the following strategy to deal with
KeyboardInterrupt:
https://noswap.com/blog/python-multiprocessing-keyboardinterrupt
Printing of a helpful summary for interrupted runs (just as the one for
completed runs) will be tackled in future revisions.
Reviewed By: serge-sans-paille, rnk
Differential Revision: https://reviews.llvm.org/D77365
Scott Constable [Fri, 3 Apr 2020 19:12:51 +0000 (12:12 -0700)]
[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets
Adds a new data structure, ImmutableGraph, and uses RDF to find LVI gadgets and add them to a MachineGadgetGraph.
More specifically, a new X86 machine pass finds Load Value Injection (LVI) gadgets consisting of a load from memory (i.e., SOURCE), and any operation that may transmit the value loaded from memory over a covert channel, or use the value loaded from memory to determine a branch/call target (i.e., SINK).
Also adds a new target feature to X86: +lvi-load-hardening
The feature can be added via the clang CLI using -mlvi-hardening.
Differential Revision: https://reviews.llvm.org/D75936
Jan Kratochvil [Fri, 3 Apr 2020 19:58:11 +0000 (21:58 +0200)]
[nfc] [lldb] Unindent code - obvious part
It is an obvious part of D77326.
It removes some needless deep indentation and some redundant statements.
It prepares the code for a more clean next patch - DWARF index callbacks
in D77327.
LLVM GN Syncbot [Fri, 3 Apr 2020 19:47:51 +0000 (19:47 +0000)]
[gn build] Port
f95a67d8b8a
Kevin P. Neal [Fri, 3 Apr 2020 19:41:37 +0000 (15:41 -0400)]
Revert "[PowerPC] Replace subtract-from-zero float in version with fneg in PowerPC special fma compiler builtins"
The new test case causes bot failures.
This reverts commit
ba87430cadb2d5d0ee8e4b75101d7abcf6b321bf.
Andrew Ng [Fri, 3 Apr 2020 19:41:14 +0000 (15:41 -0400)]
Don't use relpaths in lit cfg if build/source dir are on different drives.
See discussion on https://reviews.llvm.org/D77184.
Paul Robinson [Fri, 3 Apr 2020 19:36:37 +0000 (12:36 -0700)]
Test had incorrect check for nonzero count
Lang Hames [Fri, 3 Apr 2020 19:25:32 +0000 (12:25 -0700)]
[ORC] Improve documention of memory ownership in the new Orc C bindings.
Kevin P. Neal [Fri, 3 Apr 2020 19:21:33 +0000 (15:21 -0400)]
Fix typo in test.
Differential Revision: https://reviews.llvm.org/D76949