Florian Hahn [Sun, 7 Feb 2021 20:53:06 +0000 (20:53 +0000)]
[ConstraintElimination] Decompose zext for unsigned compares.
For unsigned compares, zext should be a no-op and we can add the
extended value to the constraint system.
Florian Hahn [Sun, 7 Feb 2021 17:53:47 +0000 (17:53 +0000)]
[LV] Replace some uses of VectorLoopValueMap with VPTransformState (NFC)
This patch updates some places where VectorLoopValueMap is accessed
directly to instead go through VPTransformState.
As we move towards managing created values exclusively in VPTransformState,
this ensures the use always can fetch the correct value.
This is in preparation for D92285, which switches to managing scalarized
values through VPValues.
In the future, the various fix* functions should be moved directly into
the VPlan codegen stage.
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D95757
Florian Hahn [Sun, 7 Feb 2021 11:54:35 +0000 (11:54 +0000)]
[ConstraintElimination] Add additional tests.
Adds additional test cases with zexts, conditions that require temporary
indices.
Kazu Hirata [Sun, 7 Feb 2021 17:49:36 +0000 (09:49 -0800)]
[Transforms/Utils] Use range-based for loops (NFC)
Kazu Hirata [Sun, 7 Feb 2021 17:49:34 +0000 (09:49 -0800)]
[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sun, 7 Feb 2021 17:49:33 +0000 (09:49 -0800)]
[SelectionDAG] Drop unnecessary const from a return type (NFC)
Identified with const-return-type.
poelmanc [Sun, 7 Feb 2021 16:34:05 +0000 (16:34 +0000)]
[clang-tidy] fix modernize-loop-convert to retain needed array-like operator[]
`modernize-loop-convert` handles //array-like// objects like vectors fairly well, but strips slightly too much information from the iteration expression by converting:
```
Vector<Vector<int>> X;
for (int J = 0; J < X[5].size(); ++J)
copyArg(X[5][J]);
```
to
```
Vector<Vector<int>> X;
for (int J : X) // should be for (int J : X[5])
copyArg(J);
```
The `[5]` is a call to `operator[]` and gets stripped by `LoopConvertCheck::getContainerString`. This patch fixes that and adds several test cases.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D95771
Stephen Kelly [Sun, 7 Feb 2021 00:28:20 +0000 (00:28 +0000)]
Add code complete support for mapAnyOf
Stephen Kelly [Sat, 6 Feb 2021 23:39:48 +0000 (23:39 +0000)]
Add clang-query support for mapAnyOf
Differential Revision: https://reviews.llvm.org/D94880
Stephen Kelly [Sat, 6 Feb 2021 18:59:16 +0000 (18:59 +0000)]
[ASTMatchers] Extract parsing of bind token from the bind id
This will be extended to be able to parse "with" for mapAnyOf in
addition to "bind".
Stephen Kelly [Sat, 6 Feb 2021 23:14:19 +0000 (23:14 +0000)]
[ASTMatchers] Change internal method API
This will make it possible to parse matchers built dynamically.
Stephen Kelly [Sun, 7 Feb 2021 00:09:41 +0000 (00:09 +0000)]
[ASTMatchers] Make it possible to build mapAnyOf through the registry
Stephen Kelly [Sat, 6 Feb 2021 23:48:14 +0000 (23:48 +0000)]
[ASTMatchers ]Make MatcherDescriptors indicate the node type they match
Sanjay Patel [Sun, 7 Feb 2021 14:41:46 +0000 (09:41 -0500)]
[Reassociate] allow or->add with shl operands
As discussed in:
https://llvm.org/PR49055
We invert instcombine's add->or transform here
because it makes it easier to identify factorization
transforms like the mul in the motivating test.
This extends the logic added with:
https://reviews.llvm.org/rG70472f3
https://reviews.llvm.org/rG93f3d7f
(I intentionally kept the formatting fix in this patch
to provide more context about the calling logic.)
Stephen Kelly [Sat, 6 Feb 2021 23:28:50 +0000 (23:28 +0000)]
Make it possible to store NodeKinds in ArgKind
Stephen Kelly [Sat, 6 Feb 2021 16:23:30 +0000 (16:23 +0000)]
[ASTMatchers] Add static constructor for ArgKinds of Matchers
It will soon be possible to store a node kind in an ArgKind, which will
also be contructed with an ASTNodeKind. The desired Kind must be
expicit.
Simon Pilgrim [Sun, 7 Feb 2021 13:27:57 +0000 (13:27 +0000)]
[DAG] SelectionDAG::isSplatValue - handle OR/XOR cases
Add OR/XOR to the basic binops that we support when checking for a splat vector value
Simon Pilgrim [Sun, 7 Feb 2021 11:41:43 +0000 (11:41 +0000)]
[X86][AVX] Fold extract_subvector(splat, c) -> extract_subvector(splat, 0)
We already do this for VBROADCASTs, extend this for any splat that SelectionDAG::isSplatValue recognises as well.
Florian Hahn [Sun, 7 Feb 2021 11:07:49 +0000 (11:07 +0000)]
[ConstraintElimination] Require GEPs to be inbounds for decomposition.
During decomposition, we assume the no-wrap properties of inbound GEPs.
Make sure the decomposed GEP is actually inbounds.
Craig Topper [Sun, 7 Feb 2021 06:31:38 +0000 (22:31 -0800)]
[TableGen] Make all the fields in PatternToMatch private. NFCI
Add the few missing accessor methods. Use accessor methdods
everywhere.
Florian Hahn [Thu, 28 Jan 2021 16:34:09 +0000 (16:34 +0000)]
[ConstraintElimination] Extend test coverage.
This patch adds a lot of additional tests, focusing on loops and GEP
arithmetic. Some of the tests expose existing problems, which will be
fixed soon.
Fangrui Song [Sat, 6 Feb 2021 19:56:15 +0000 (11:56 -0800)]
[Polly] Fix build after AssumptionCache change (D96168)
Dave Lee [Wed, 3 Feb 2021 00:24:03 +0000 (16:24 -0800)]
[lldb] Use assertIn/NotIn over assertTrue/False (NFC)
For improved failure messages, use `assertIn` over `assertTrue`.
Differential Revision: https://reviews.llvm.org/D96095
Fangrui Song [Sat, 6 Feb 2021 19:50:57 +0000 (11:50 -0800)]
[ELF][test] Improve aarch64 tests
Kazu Hirata [Sat, 6 Feb 2021 19:17:09 +0000 (11:17 -0800)]
[Analysis] Use range-based for loops (NFC)
Kazu Hirata [Sat, 6 Feb 2021 19:17:08 +0000 (11:17 -0800)]
[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sat, 6 Feb 2021 19:17:06 +0000 (11:17 -0800)]
[IR] Drop unnecessary const from return types (NFC)
Identified with const-return-type.
Craig Topper [Sat, 6 Feb 2021 18:28:38 +0000 (10:28 -0800)]
[X86] Don't pass a 1 to the second argument of ISD::FP_ROUND in LowerFCOPYSIGN.
I don't think we have any reason to believe the FP_ROUND here doesn't change the value.
Found while trying to see if we still need the fp128 block in CanCombineFCOPYSIGN_EXTEND_ROUND.
Removing that check caused this FP_ROUND to fire for fp128 which introduced a libcall expansion that asserted for this being a 1.
Reviewed By: RKSimon, pengfei
Differential Revision: https://reviews.llvm.org/D96098
Johannes Doerfert [Fri, 5 Feb 2021 16:53:33 +0000 (10:53 -0600)]
[AssumptionCache] Avoid dangling llvm.assume calls in the cache
PR49043 exposed a problem when it comes to RAUW llvm.assumes. While
D96106 would fix it for GVNSink, it seems a more general concern. To
avoid future problems this patch moves away from the vector of weak
reference model used in the assumption cache. Instead, we track the
llvm.assume calls with a callback handle which will remove itself from
the cache if the call is deleted.
Fixes PR49043.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D96168
Johannes Doerfert [Sat, 6 Feb 2021 17:42:02 +0000 (11:42 -0600)]
[AssumptionCache] Do not track llvm.assume calls (PR49043)
This fixes PR49043 by invalidating the handle on RAUW. This will work
fine assuming all existing RAUW users add the new assumption to the
cache. That means, if a new llvm.assume call replaces an old one, you
need to add the new one now as a RAUW is not enough anymore.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D96208
Nikita Popov [Sat, 6 Feb 2021 17:14:21 +0000 (18:14 +0100)]
[LSR] Add test for multi-edge latch (NFC)
This is additional test coverage for D72519.
Teresa Johnson [Thu, 4 Feb 2021 22:53:17 +0000 (14:53 -0800)]
[LTT] Don't attempt to lower type tests used only by assumes
Type tests used only by assumes were original for devirtualization, but
are meant to be kept through the first invocation of LTT so that they
can be used for additional optimization. In the regular LTO case where
the IR is analyzed we may find a resolution for the type test and end up
rewriting the associated vtable global, which can have implications on
section splitting. Simply ignore these type tests.
Fixes PR48245.
Differential Revision: https://reviews.llvm.org/D96083
Heejin Ahn [Fri, 1 Jan 2021 09:03:21 +0000 (01:03 -0800)]
[WebAssembly] Update InstPrinter and AsmParser for new EH instructions
This updates InstPrinter and AsmParser for `delegate` and `catch_all`
instructions. Both will reject programs with multiple `catch_all`s per a
single `try`. And InstPrinter uses `EHInstStack` to figure out whether
to print catch label comments: It does not print catch label comments
for second `catch` or `catch_all` in a `try`.
Reviewed By: aardappel
Differential Revision: https://reviews.llvm.org/D94051
LLVM GN Syncbot [Sat, 6 Feb 2021 16:40:55 +0000 (16:40 +0000)]
[gn build] Port
be0efa1f2368
Heejin Ahn [Fri, 1 Jan 2021 09:02:52 +0000 (01:02 -0800)]
[WebAssembly] Handle EH terminate pads for cleanup
Terminate pads, cleanup pads with `__clang_call_terminate` call, have
`catch` instruction in them because `__clang_call_terminate` takes an
exception pointer. But these terminate pads should be reached also in
case of foreign exception. So this pass attaches an additional
`catch_all` BB after every terminate pad BB, with a call to
`std::terminate`.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D94050
Simon Pilgrim [Sat, 6 Feb 2021 15:58:02 +0000 (15:58 +0000)]
[X86][AVX] canonicalizeLaneShuffleWithRepeatedOps - merge VPERMILPD ops with different low/high masks.
Now that PR48908 has been dealt with, we can handle v4f64 permute cases by extracting the low/high lane VPERMILPD masks and creating a new mask based on which lanes are referenced by the VPERM2F128 mask.
Simon Pilgrim [Sat, 6 Feb 2021 15:39:26 +0000 (15:39 +0000)]
[PowerPC] Fix multiclass template parameter types. NFC.
Fixes TableGen parser errors reported by D95874.
Simon Pilgrim [Sat, 6 Feb 2021 15:33:09 +0000 (15:33 +0000)]
[Sparc] Fix multiclass template parameter types. NFC.
Fixes TableGen parser errors reported by D95874.
Simon Pilgrim [Sat, 6 Feb 2021 15:27:49 +0000 (15:27 +0000)]
[Hexagon] Fix multiclass template parameter types. NFC.
Fixes TableGen parser errors reported by D95874.
Heejin Ahn [Thu, 31 Dec 2020 06:29:38 +0000 (22:29 -0800)]
[WebAssembly] Fix catch unwind mismatches
This fixes unwind destination mismatches caused by 'catch'es, which
occur when a foreign exception is not caught by the nearest `catch` and
the next outer `catch` is not the catch it should unwind to, or the next
unwind destination should be the caller instead. This kind of mismatches
didn't exist in the previous version of the spec, because in the
previous spec `catch` was effectively `catch_all`, catching all
exceptions.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D94049
Heejin Ahn [Mon, 28 Dec 2020 13:10:22 +0000 (05:10 -0800)]
[WebAssembly] Fix call unwind mismatches
This adds `delegate` instruction and use it to fix unwind destination
mismatches created by marker placement in CFGStackify.
There are two kinds of unwind destination mismatches:
- Mismatches caused by throwing instructions (here we call it "call
unwind mismatches", even though `throw` and `rethrow` can also cause
mismatches)
- Mismatches caused by `catch`es, in case a foreign exception is not
caught by the nearest `catch` and the next outer `catch` is not the
catch it should unwind to. This kind of mismatches didn't exist in the
previous version of the spec, because in the previous spec `catch` was
effectively `catch_all`, catching all exceptions.
This implements routines to fix the first kind of unwind mismatches,
which we call "call unwind mismatches". The second mismatch (catch
unwind mismatches) will be fixed in a later CL.
This also reenables all previously disabled tests in cfg-stackify-eh.ll
and updates FileCheck lines to match the new spec. Two tests were
deleted because they specifically tested the way we fixed unwind
mismatches before using `exnref`s and branches, which we don't do
anymore.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D94048
Sander de Smalen [Thu, 21 Jan 2021 09:14:31 +0000 (09:14 +0000)]
NFC: Migrate LoopIdiomRecognize to work on InstructionCost
This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
David Green [Sat, 6 Feb 2021 14:34:14 +0000 (14:34 +0000)]
[AArch64] Correct some tablegen operand types. NFC
Sander de Smalen [Fri, 5 Feb 2021 12:01:21 +0000 (12:01 +0000)]
NFC: Migrate LoopFlatten to work on InstructionCost.
This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D96029
Tung D. Le [Sat, 6 Feb 2021 07:59:32 +0000 (13:29 +0530)]
[MLIR] [affine-loop-fusion] Fix a bug about non-result ops in affine-loop-fusion
This patch fixes the following bug when calling --affine-loop-fusion
Input program:
```mlir
func @should_not_fuse_since_top_level_non_affine_non_result_users(
%in0 : memref<32xf32>, %in1 : memref<32xf32>) {
%c0 = constant 0 : index
%cst_0 = constant 0.000000e+00 : f32
affine.for %d = 0 to 32 {
%lhs = affine.load %in0[%d] : memref<32xf32>
%rhs = affine.load %in1[%d] : memref<32xf32>
%add = addf %lhs, %rhs : f32
affine.store %add, %in0[%d] : memref<32xf32>
}
store %cst_0, %in0[%c0] : memref<32xf32>
affine.for %d = 0 to 32 {
%lhs = affine.load %in0[%d] : memref<32xf32>
%rhs = affine.load %in1[%d] : memref<32xf32>
%add = addf %lhs, %rhs: f32
affine.store %add, %in0[%d] : memref<32xf32>
}
return
}
```
call --affine-loop-fusion, we got an incorrect output:
```mlir
func @should_not_fuse_since_top_level_non_affine_non_result_users(%arg0: memref<32xf32>, %arg1: memref<32xf32>) {
%c0 = constant 0 : index
%cst = constant 0.000000e+00 : f32
store %cst, %arg0[%c0] : memref<32xf32>
affine.for %arg2 = 0 to 32 {
%0 = affine.load %arg0[%arg2] : memref<32xf32>
%1 = affine.load %arg1[%arg2] : memref<32xf32>
%2 = addf %0, %1 : f32
affine.store %2, %arg0[%arg2] : memref<32xf32>
%3 = affine.load %arg0[%arg2] : memref<32xf32>
%4 = affine.load %arg1[%arg2] : memref<32xf32>
%5 = addf %3, %4 : f32
affine.store %5, %arg0[%arg2] : memref<32xf32>
}
return
}
```
This happened because when analyzing the source and destination nodes,
affine loop fusion ignored non-result ops sandwitched between them. In
other words, the MemRefDependencyGraph in the affine loop fusion ignored
these non-result ops.
This patch solves the issue by adding these non-result ops to the
MemRefDependencyGraph.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D95668
Fangrui Song [Sat, 6 Feb 2021 05:45:21 +0000 (21:45 -0800)]
.gcc_except_table: Set SHF_LINK_ORDER if binutils>=2.36, and drop unneeded unique ID for -fno-unique-section-names
GNU ld>=2.36 supports mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections in an
output section, so we can set SHF_LINK_ORDER if -fbinutils-version=2.36 or above.
If -fno-function-sections or older binutils, drop unique ID for -fno-unique-section-names.
The users can just specify -fbinutils-version=2.36 or above to allow GC with both GNU ld and LLD.
(LLD does not support garbage collection of non-group non-SHF_LINK_ORDER .gcc_except_table sections.)
Fangrui Song [Sat, 6 Feb 2021 05:35:27 +0000 (21:35 -0800)]
[ELF] --gc-sections: collect unused SHF_LINK_ORDER .gcc_except_table
A SHF_LINK_ORDER .gcc_except_table is similar to a .gcc_except_table in
a section group. The associated text section is responsible for retaining it.
LLD still does not support GC of non-group non-SHF_LINK_ORDER .gcc_except_table -
but that is not necessary because we can teach the compiler to set SHF_LINK_ORDER.
Kazu Hirata [Sat, 6 Feb 2021 05:02:07 +0000 (21:02 -0800)]
[Transforms/Instrumentation] Use range-based for loops (NFC)
Kazu Hirata [Sat, 6 Feb 2021 05:02:06 +0000 (21:02 -0800)]
[llvm] Fix header guards (NFC)
Identified with llvm-header-guard.
Kazu Hirata [Sat, 6 Feb 2021 05:02:04 +0000 (21:02 -0800)]
[AMDGPU] Drop unnecessary const from a return type (NFC)
Identified with const-return-type.
Fangrui Song [Sat, 6 Feb 2021 03:53:06 +0000 (19:53 -0800)]
[AsmPrinter] __patchable_function_entries: Set SHF_LINK_ORDER for binutils 2.36 and above
This matches GCC behavior when the configure-time binutils is new. GNU ld<2.36
did not support mixed SHF_LINK_ORDER and non-SHF_LINK_ORDER sections in an
output section, so we conservatively disable SHF_LINK_ORDER for <2.36.
Wenlei He [Wed, 3 Feb 2021 21:27:35 +0000 (13:27 -0800)]
[CSSPGO] Use merged base profile for hot threshold calculation
Context-sensitive profile effectively split a function profile into many copies each representing the CFG profile of a particular calling context. That makes the count distribution looks more flat as we now have more function profiles each with lower counts, which in turn leads to lower hot thresholds. Now we tells threshold computation to merge context profile first before calculating percentile based cutoffs to compensate for seemingly flat context profile. This can be controlled by swtich `sample-profile-contextless-threshold`.
Earlier measurement showed ~0.4% perf boost with this tuning on spec2k6 for CSSPGO (with pseudo-probe and new inliner).
Differential Revision: https://reviews.llvm.org/D95980
Mehdi Amini [Sat, 6 Feb 2021 01:32:40 +0000 (01:32 +0000)]
Rework ExecutionEngine::invoke() to make it more friendly to use from C++
This new invoke will pack a list of argument before calling the
`invokePacked` method. It accepts returned value as output argument
wrapped in `ExecutionEngine::Result<T>`, and delegate the packing of
arguments to a trait to allow for customization for some types.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D95961
Mehdi Amini [Sat, 6 Feb 2021 01:26:37 +0000 (01:26 +0000)]
Add a link to the LLVM Dev recording from the MLIR tutorial landing page
Adrian Prantl [Fri, 5 Feb 2021 22:18:13 +0000 (14:18 -0800)]
Have stripDebugInfo() also strip !llvm.loop annotations from all
instructions.
The !llvm.loop annotations consist of pointers into the debug info, so
when stripping the debug info (particularly important when it is
malformed!) !llvm.loop annotations need to be stripped as well, or
else the malformed debug info stays around. This patch applies the
stripping to all instructions, not just terminator instructions.
rdar://
73687049
Differential Revision: https://reviews.llvm.org/D96181
Joerg Sonnenberger [Sat, 6 Feb 2021 00:34:02 +0000 (01:34 +0100)]
SPARCv9: recognize SIR trap instruction
Greg McGary [Sat, 2 Jan 2021 18:31:55 +0000 (10:31 -0800)]
[lld-macho] Fix alignment & layout to match ld64 and satisfy kernel & codesign
The Mach kernel & codesign on arm64 macOS has strict requirements for alignment and sequence of segments and sections. Dyld probably is just as picky, though kernel & codesign reject malformed Mach-O files before dyld ever has a chance.
I developed this diff by incrementally changing alignments & sequences to match the output of ld64. I stopped when my hello-world test program started working: `codesign --verify` succeded, and `execve(2)` didn't immediately fail with `errno == EBADMACHO` = `"Malformed Mach-O file"`.
Differential Revision: https://reviews.llvm.org/D94935
Wouter van Oortmerssen [Fri, 5 Feb 2021 00:14:58 +0000 (16:14 -0800)]
[WebAssembly] ensure .functype applies to right label in assembler
We used to require .functype immediately follows the label it sets the type of, but not all Clang output follows this rule.
Now we simply allow it on any symbol, but only assume its a function start for a defined symbol, which is simpler and more general.
Fixes (part of) https://bugs.llvm.org/show_bug.cgi?id=49036
Differential Revision: https://reviews.llvm.org/D96165
Jonas Devlieghere [Fri, 5 Feb 2021 23:19:27 +0000 (15:19 -0800)]
[lldb] Re-enable TestExprsChar on arm64
This test passes on arm64 (Apple Silicon). I assume that "aarch64" still
ensures this gets skipped on Linux. I don't have access to such and
environment so I'll have to rely on the bot complaining.
Jonas Devlieghere [Fri, 5 Feb 2021 23:17:28 +0000 (15:17 -0800)]
[debugserver] Fix more warnings in DNBArchImplARM64
Siva Chandra [Fri, 5 Feb 2021 23:07:12 +0000 (15:07 -0800)]
[libc][aarch64] Enable a bunch of math functions.
Namely, these are the functions enabled: rint*, lrint*, llrint*, lround*,
llround*, nearbyint*. They were previously not enabled because they
required rounding mode and FP exception support. Now that rounding mode
and FP exception support is available for Aarch64, they can be enabled.
Lei Zhang [Fri, 5 Feb 2021 22:48:09 +0000 (17:48 -0500)]
[mlir][vector] Add pattern to shuffle bitcast ops
These patterns move vector.bitcast ops to be before
insert ops or after extract ops where suitable.
With them, bitcast will happen on smaller vectors
and there are more chances to share extract/insert
ops.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D96040
Fangrui Song [Fri, 5 Feb 2021 22:12:27 +0000 (14:12 -0800)]
[libc++abi] Disable _Unwind_ForcedUnwind + exception tests for ARM EHABI
libunwind ARM EHABI does not support _Unwind_ForcedUnwind yet.
In addition, ARM EHABI makes `_Unwind_Exception` a typedef so
`struct _Unwind_Exception*` cannot be used.
Sam Clegg [Fri, 5 Feb 2021 20:33:53 +0000 (12:33 -0800)]
[clang][emscripten] Add builtin define for __EMSCRIPTEN_PTHREADS__
Currently the emscripten frontend driver injects this when building
with thread support. Moving this into the clang driver itself makes
the emscripten python driver less magical.
Differential Revision: https://reviews.llvm.org/D96171
Wouter van Oortmerssen [Tue, 2 Feb 2021 01:28:00 +0000 (17:28 -0800)]
[WebAssembly] Prevent data inside text sections in assembly
This is not supported in Wasm, unless the data was encoded instructions, but that wouldn't work with the assembler's other functionality (enforcing nesting etc.).
Fixes: https://bugs.llvm.org/show_bug.cgi?id=48971
Differential Revision: https://reviews.llvm.org/D95838
Nico Weber [Fri, 5 Feb 2021 21:10:59 +0000 (16:10 -0500)]
[gn build] enable new pass manager more, follow-up to
39ceb5c9cfe
Aaron Ballman [Fri, 5 Feb 2021 21:09:59 +0000 (16:09 -0500)]
Allow SmallPtrSet to be used with a std::insert_iterator
Currently, the SmallPtrSet type allows inserting elements but it does
not support inserting elements with a positional hint. The lack of this
signature means that you cannot use SmallPtrSet with
std::insert_iterator or std::inserter(), which makes some code
constructs more awkward. This adds an overload of insert() that can be
used in these scenarios.
The positional hint is unused by SmallPtrSet and the call is equivalent
to calling insert() without a hint.
Petr Hosek [Thu, 4 Feb 2021 06:57:04 +0000 (22:57 -0800)]
Don't emit coverage mapping for excluded functions
When a function or a file is excluded using -fprofile-list= option,
don't emit coverage mapping as doing so confuses users since those
functions would always have zero count. This also reduces the binary
size considerably in cases where only a few functions or files are
being instrumented.
Differential Revision: https://reviews.llvm.org/D96000
Sterling Augustine [Fri, 5 Feb 2021 18:59:37 +0000 (10:59 -0800)]
Various minor fixes for python 3
Switch StdTuple printer from python 2-style "next" to python 3.
Nested iteration changed enough to make the original bitset iteration
code a bit trickier than it needs to be, so unnest.
The end node of a map iterator is sometimes hard to detect in isolation,
don't fail in that case.
Differential Revision: https://reviews.llvm.org/D96167
Martin Storsjö [Thu, 29 Oct 2020 10:10:26 +0000 (12:10 +0200)]
[libcxx] Implement temp_directory_path using GetTempPath on windows
This does roughly the same as the manual implementation, but checks
a slightly different set of environment variables and has a more
appropriate fallback if no environment variables are available
(/tmp isn't a very useful fallback on windows).
Differential Revision: https://reviews.llvm.org/D91175
Martin Storsjö [Fri, 30 Oct 2020 20:24:25 +0000 (22:24 +0200)]
[libcxx] Use the posix code for directory_entry::__do_refresh
This works just fine for windows, as all the functions it calls
are implemented and wrapped for windows.
Differential Revision: https://reviews.llvm.org/D91173
Eric Schweitz [Fri, 5 Feb 2021 18:35:32 +0000 (10:35 -0800)]
[flang][fir] Add FIR's vector type.
This patch adds support for `!fir.vector`, a rank one, constant length
data type.
https://github.com/flang-compiler/f18-llvm-project/pull/413
Differential Revision: https://reviews.llvm.org/D96162
Arthur O'Dwyer [Wed, 3 Feb 2021 22:54:13 +0000 (17:54 -0500)]
[libc++] Further improve the contiguous-iterator story, and fix some bugs.
- Quality-of-implementation: Avoid calling __unwrap_iter in constexpr contexts.
The user might conceivably write a contiguous iterator where normal iterator
arithmetic is constexpr-friendly but `std::to_address(it)` isn't.
- Bugfix: When you pass contiguous iterators to `std::copy`, you should get
back your contiguous iterator type, not a raw pointer. That means that
libc++ can't `__unwrap_iter` unless it also does `__rewrap_iter`.
Fortunately, this is implementable.
- Improve test coverage of the new `contiguous_iterator` test iterator.
This catches the bug described above.
- Tests: Stop testing that we can `std::copy` //into// an `input_iterator`.
Our test iterators may currently support that, but it seems nonsensical to me.
Differential Revision: https://reviews.llvm.org/D95983
Yaxun (Sam) Liu [Tue, 2 Feb 2021 23:06:33 +0000 (18:06 -0500)]
[CUDA][HIP] Fix device variable linkage
For -fgpu-rdc, shadow variables should not be internalized, otherwise
they cannot be accessed by other TUs. This is necessary because
the shadow variable of external device variables are always
emitted as undefined symbols, which need to resolve to a global
symbols.
Managed variables need to be emitted as undefined symbols
in device compilations.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D95901
Sanjay Patel [Fri, 5 Feb 2021 20:10:11 +0000 (15:10 -0500)]
Revert "[Codegen][ReplaceWithVecLib] add pass to replace vector intrinsics with calls to vector library"
This reverts commit
2303e93e666e13ebf6d24323729c28f520ecca37.
Investigating bot failures.
Craig Topper [Fri, 5 Feb 2021 19:55:11 +0000 (11:55 -0800)]
[RISCV] Correct types in tablegen multiclasses found by D95874.
Arthur Eubanks [Fri, 5 Feb 2021 19:14:12 +0000 (11:14 -0800)]
[NVPTX][NewPM] Temporarily disable NVPTX passes in new PM pipeline
These passes are causing numerical discrepancies after being added to
the pipeline. Disable while investigating.
Reviewed By: rupprecht
Differential Revision: https://reviews.llvm.org/D96166
zoecarver [Fri, 5 Feb 2021 19:24:38 +0000 (11:24 -0800)]
[lic++][docs] Explain noexcept policy for narrow contracts.
Adds documentation around libc++'s policy to add noexcept to things that cannot throw but aren't marked as noexcept.
Refs LWG 3518 and D95251.
Differential Revision: https://reviews.llvm.org/D95821
Sanjay Patel [Fri, 5 Feb 2021 19:05:29 +0000 (14:05 -0500)]
[PhaseOrdering] add test to show combined result of reassociate+instcombine+vectorizers; NFC
Sanjay Patel [Fri, 5 Feb 2021 18:42:03 +0000 (13:42 -0500)]
[Reassociate] add test for shl+or; NFC
Lukas Sommer [Thu, 4 Feb 2021 19:56:15 +0000 (14:56 -0500)]
[Codegen][ReplaceWithVecLib] add pass to replace vector intrinsics with calls to vector library
This patch adds a pass to replace calls to vector intrinsics
(i.e., LLVM intrinsics operating on vector operands) with
calls to a vector library.
Currently, calls to LLVM intrinsics are only replaced with
calls to vector libraries when scalar calls to intrinsics are
vectorized by the Loop- or SLP-Vectorizer.
With this pass, it is now possible to replace calls to LLVM
intrinsics already operating on vector operands, e.g., if
such code was generated by MLIR. For the replacement,
information from the TargetLibraryInfo, e.g., as specified
via -vector-library is used.
Differential Revision: https://reviews.llvm.org/D95373
Wouter van Oortmerssen [Fri, 8 Jan 2021 23:27:08 +0000 (15:27 -0800)]
[WebAssembly] locals can now be indirect in DWARF
This for example to indicate that byval args are represented by a pointer to a struct.
Followup to https://reviews.llvm.org/D94140
Differential Revision: https://reviews.llvm.org/D94347
Eric Schweitz [Fri, 5 Feb 2021 17:40:19 +0000 (09:40 -0800)]
[flang][NFC] Make KindTy consistent and consistently used.
Differential Revision: https://reviews.llvm.org/D96154
Eric Schweitz [Fri, 5 Feb 2021 16:53:32 +0000 (08:53 -0800)]
[flang][NFC] Update comments.
Differential Revision: https://reviews.llvm.org/D96152
Siva Chandra [Thu, 4 Feb 2021 06:49:32 +0000 (22:49 -0800)]
[libc] Add aarch64 flavors of floor, round, sqrt and trunc.
Only single and double precision flavors have been added.
Reviewed By: lntue, sdesmalen
Differential Revision: https://reviews.llvm.org/D95999
Thomas Preud'homme [Wed, 9 Dec 2020 22:18:32 +0000 (22:18 +0000)]
Stop traping on sNaN in __builtin_isnan
__builtin_isnan currently generates a floating-point compare operation
which triggers a trap when faced with a signaling NaN in StrictFP mode.
This commit uses integer operations instead to not generate any trap in
such a case.
Reviewed By: kpn
Differential Revision: https://reviews.llvm.org/D95948
Amy Huang [Fri, 5 Feb 2021 18:23:46 +0000 (10:23 -0800)]
[DebugInfo] Fix error from D95893, where I accidentally used an
unsigned int in a loop and it wraps around.
Follow up to https://reviews.llvm.org/D95893
Huihui Zhang [Fri, 5 Feb 2021 17:54:54 +0000 (09:54 -0800)]
[DAGCombiner][SVE] Fix invalid use of getVectorNumElements() in visitSRA.
Make sure scalable property is preserved by using getVectorElementCount().
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D95967
Amy Huang [Fri, 29 Jan 2021 20:08:35 +0000 (12:08 -0800)]
[CodeView][DebugInfo] Update the code for removing template arguments from the display name of a codeview function id.
Previously the code split the string at the first '<', which
incorrectly truncated names like `operator<`.
Differential Revision: https://reviews.llvm.org/D95893
Jianzhou Zhao [Wed, 3 Feb 2021 19:41:58 +0000 (19:41 +0000)]
[dfsan] Add thread registration
This is a part of https://reviews.llvm.org/D95835.
This change is to address two problems
1) When recording stacks in origin tracking, libunwind is not async signal safe. Inside signal callbacks, we need
to use fast unwind. Fast unwind needs threads
2) StackDepot used by origin tracking is not async signal safe, we set a flag per thread inside
a signal callback to prevent from using it.
The thread registration is similar to ASan and MSan.
Related MSan changes are
* https://github.com/llvm/llvm-project/commit/
98f5ea0dbae664a2e5f9381a64f2913fe1add208
* https://github.com/llvm/llvm-project/commit/
f653cda2695ac7390fe5663f2c0895213938334d
* https://github.com/llvm/llvm-project/commit/
5a7c3643437c262137bd3dac7f6a0f5b9e8501be
Some changes in the diff are used in the next diffs
1) The test case pthread.c is not very interesting for now. It will be
extended to test origin tracking later.
2) DFsanThread::InSignalHandler will be used by origin tracking later.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D95963
Fangrui Song [Fri, 5 Feb 2021 17:37:37 +0000 (09:37 -0800)]
[ELF] Improve --icf=safe diagnostic
The current diagnostic has confused users. The new wording is adapted from one suggested by Ian Lance Taylor.
Differential Revision: https://reviews.llvm.org/D95917
Wen-Heng (Jack) Chung [Thu, 4 Feb 2021 18:16:12 +0000 (12:16 -0600)]
[AMDGPU] Add Fiji target in fptosi/fptoui instruction-select MIR tests.
In response to review comments in D95964, add a target with f16 instructions.
Differential Revision: https://reviews.llvm.org/D96061
Arthur Eubanks [Fri, 5 Feb 2021 17:11:07 +0000 (09:11 -0800)]
[gn build] Turn on new pass manager by default
Matches cmake build
Arthur O'Dwyer [Thu, 4 Feb 2021 23:12:52 +0000 (18:12 -0500)]
Revert "Revert "[libc++] [P0879] constexpr std::nth_element, and rewrite its tests.""
This reverts commit
b6ffece32035a90d181101f356bd9c04ea1d3122.
The bug is now fixed (it was a stupid cut-and-paste kind of error),
and the regression test added. The new patch is also simpler than the old one!
Differential Revision: https://reviews.llvm.org/D96084
Simon Pilgrim [Fri, 5 Feb 2021 16:50:37 +0000 (16:50 +0000)]
[MSP430] Fix multiclass template parameter types. NFC.
Fixes TableGen parser errors reported by D95874.
Sam McCall [Thu, 4 Feb 2021 14:08:33 +0000 (15:08 +0100)]
[clangd] Trace queue state for each TUScheduler action.
The new trace event includes what's already in the queue when adding.
For tracers that follow contexts, the trace event will span the time that the action
spends in the queue.
For tracers that follow threads, the trace will be a tiny span on the enqueuing thread.
Differential Revision: https://reviews.llvm.org/D96027
Jonas Devlieghere [Fri, 5 Feb 2021 16:50:48 +0000 (08:50 -0800)]
[lldb] Emit type annotation in SWIG generated Python code.
The Python code generated by SWIG is compatible with both Python 2 and
Python 3. The -py3 option enables Python 2 incompatible features such as
function annotations and abstract base classes.
Differential revision: https://reviews.llvm.org/D96096
Denys Shabalin [Fri, 5 Feb 2021 16:25:44 +0000 (17:25 +0100)]
Drop LLVM_i1, LLVM_i8, LLVM_i32, LLVM_IntBase types
Those types are not needed any longer since LLVM dialect
has migrated to using MLIR's I1, I8, I32 types directly.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D96127
Michael Liao [Thu, 4 Feb 2021 16:05:35 +0000 (11:05 -0500)]
Recommit of
a2fdf9d4d734732a6fa9288f1ffdf12bf8618123.
- The failures are all cc1-based tests due to the missing `-aux-triple` options,
which is always prepared by the driver in CUDA/HIP compilation.
- Add extra check on the missing aux-targetinfo to prevent crashing.
[hip][cuda] Enable extended lambda support on Windows.
- On Windows, extended lambda has extra issues due to the numbering
schemes are different between the host compilation (Microsoft C++ ABI)
and the device compilation (Itanium C++ ABI. Additional device side
lambda number is required per lambda for the host compilation to
correctly mangle the device-side lambda name.
- A hybrid numbering context `MSHIPNumberingContext` is introduced to
number a lambda for both host- and device-compilations.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D69322
This reverts commit
4874ff02417916cc9ff994b34abcb5e563056546.
Sidharth Baveja [Fri, 5 Feb 2021 16:10:53 +0000 (16:10 +0000)]
LoopUnrollAndJam] Only allow loops with single exit(ing) blocks
Summary:
This resolves an issue posted on Bugzilla. https://bugs.llvm.org/show_bug.cgi?id=48764
In this issue, the loop had multiple exit blocks, which resulted in the
function getExitBlock to return a nullptr, which resulted in hitting the assert.
This patch ensures that loops which only have one exit block as allowed to be
unrolled and jammed.
Reviewed By: Whitney, Meinersbur, dmgreen
Differential Revision: https://reviews.llvm.org/D95806