Fangrui Song [Sat, 13 Feb 2021 09:01:06 +0000 (01:01 -0800)]
[test] Make ELF tests less reliant on the lexicographical order of non-local symbols
Kazu Hirata [Sat, 13 Feb 2021 07:44:33 +0000 (23:44 -0800)]
[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sat, 13 Feb 2021 07:44:31 +0000 (23:44 -0800)]
[AMDGPU] Drop unnecessary const from a return type (NFC)
Identified with readability-const-return-type.
Kazu Hirata [Sat, 13 Feb 2021 07:44:30 +0000 (23:44 -0800)]
[TableGen] Use ListSeparator (NFC)
Juneyoung Lee [Sat, 13 Feb 2021 07:25:27 +0000 (16:25 +0900)]
[InstSimplify] add tests that look into pointer operands of instructions
Wei Wang [Wed, 10 Feb 2021 05:14:43 +0000 (21:14 -0800)]
[LTO] Perform DSOLocal propagation in combined index
Perform DSOLocal propagation within summary list of every GV. This
avoids the repeated query of this information during function
importing.
Differential Revision: https://reviews.llvm.org/D96398
Juneyoung Lee [Sat, 13 Feb 2021 05:12:33 +0000 (14:12 +0900)]
[LangRef] Update memory access ops to raise UB if ptrs are not well defined
In the past, it was stated in D87994 that it is allowed to dereference a pointer that is partially undefined
if all of its possible representations fit into a dereferenceable range.
The motivation of the direction was to make a range analysis helpful for assuring dereferenceability.
Even if a range analysis concludes that its offset is within bounds, the offset could still be partially undefined; to utilize the range analysis, this relaxation was necessary.
https://groups.google.com/g/llvm-dev/c/2Qk4fOHUoAE/m/KcvYMEgOAgAJ has more context about this.
However, this is currently blocking another optimization, which is annotating the noundef attribute for library functions' arguments. D95122 is the patch.
Currently, there are quite a few library functions which cannot have noundef attached to its pointer argument because it can be transformed from load/store.
For example, MemCpyOpt can convert stores into memset:
```
store p, i32 0
store (p+1), i32 0 // Since currently it is allowed for store to have partially undefined pointer..
->
memset(p, 0, 8) // memset cannot guarantee that its ptr argument is noundef.
```
A bigger problem is that this makes unclear which library functions are allowed to have 'noundef' and which functions aren't (e.g., strlen).
This makes annotating noundef almost impossible for this kind of functions.
This patch proposes that all memory operations should have well-defined pointers.
For memset/memcpy, it is semantically equivalent to running a loop until the size is met (and branching on undef is UB), so the size is also updated to be well-defined.
Strictly speaking, this again violates the implication of dereferenceability from range analysis result.
However, I think this is okay for the following reasons:
1. It seems the existing analyses in the LLVM main repo does not have conflicting implementation with the new proposal.
`isDereferenceableAndAlignedPointer` works only when the GEP offset is constant, and `isDereferenceableAndAlignedInLoop` is also fine.
2. A possible miscompilation happens only when the source has a pointer with a *partially* undefined offset (it's okay with poison because there is no 'partially poison' value).
But, at least I'm not aware of a language using LLVM as backend that has a well-defined program while allowing partially undefined pointers.
There might be such a language that I'm not aware of, but improving the performance of the mainstream languages like C and Rust is more important IMHO.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D95238
Fangrui Song [Sat, 13 Feb 2021 05:00:42 +0000 (21:00 -0800)]
[test] Make ELF tests amenable to the order of non-local symbols
Serge Pavlov [Thu, 11 Feb 2021 13:06:28 +0000 (20:06 +0700)]
[FPEnv][ARM] Implement lowering of llvm.set.rounding
Differential Revision: https://reviews.llvm.org/D96501
clementval [Sat, 13 Feb 2021 03:27:48 +0000 (22:27 -0500)]
Revert "[flang][fir] Add fir-opt tool"
This reverts commit
df1eeaa7b404f7c5a96a812479f0ee2ce8354f6a.
Buildbot failure.
Valentin Clement [Sat, 13 Feb 2021 03:22:56 +0000 (22:22 -0500)]
[flang][fir][NFC] Move FieldType to TableGen type definition
This patch is a follow up of D96422 and move ComplexType to TableGen.
Reviewed By: schweitz, mehdi_amini
Differential Revision: https://reviews.llvm.org/D96610
Valentin Clement [Sat, 13 Feb 2021 03:20:15 +0000 (22:20 -0500)]
[flang][fir] Add fir-opt tool
This patch introduce the fir-opt tool. Similar to mlir-opt for FIR.
It will be used in following patches to test fir opt and round-trip.
Reviewed By: schweitz, mehdi_amini
Differential Revision: https://reviews.llvm.org/D96535
Jian Cai [Wed, 3 Feb 2021 02:47:03 +0000 (18:47 -0800)]
[llvm-objcopy] preserve file ownership when overwritten by root
As of binutils 2.36, GNU strip calls chown(2) for "sudo strip foo" and
"sudo strip foo -o foo", but no "sudo strip foo -o bar" or "sudo strip
foo -o ./foo". In other words, while "sudo strip foo -o bar" creates a
new file bar with root access, "sudo strip foo" will keep the owner and
group of foo unchanged. Currently llvm-objcopy and llvm-strip behave
differently, always changing the owner and gropu to root. The
discrepancy prevents Chrome OS from migrating to llvm-objcopy and
llvm-strip as they change file ownership and cause intended users/groups
to lose access when invoked by sudo with the following sequence
(recommended in man page of GNU strip).
1.<Link the executable as normal.>
1.<Copy "foo" to "foo.full">
1.<Run "strip --strip-debug foo">
1.<Run "objcopy --add-gnu-debuglink=foo.full foo">
This patch makes llvm-objcopy and llvm-strip follow GNU's behavior.
Link: crbug.com/1108880
AndreyChurbanov [Sat, 13 Feb 2021 01:49:52 +0000 (04:49 +0300)]
[OpenMP] NFC: fix test removing the target construct
AndreyChurbanov [Sat, 13 Feb 2021 01:13:54 +0000 (04:13 +0300)]
[OpenMP] fix test adding mapping of shared variables
Artur Gainullin [Thu, 11 Feb 2021 20:54:59 +0000 (12:54 -0800)]
[SYCL] Ignore file-scope asm during device-side SYCL compilation.
Reviewed By: bader, eandrews
Differential Revision: https://reviews.llvm.org/D96538
Adrian Prantl [Thu, 11 Feb 2021 23:38:49 +0000 (15:38 -0800)]
Store the LocationKind of an entry value buffer independently from the main LocationKind (NFC)
This patch hides the logic for setting the location kind of an entry
value inside the begin/finalize/cancel functions. This way we get rid
the strange workaround that is currently in setLocation().
In the future, this will allow us to set the location kind of the
entry value independently from the location kind of the main
expression.
Differential Revision: https://reviews.llvm.org/D96554
wlei [Wed, 10 Feb 2021 18:04:39 +0000 (10:04 -0800)]
[CSSPGO][llvm-profgen] Filter out the instructions without location info for symbolizer
It appears some instructions doesn't have the debug location info and the symbolizer will return an empty call stack for them which will cause some crash later in profile unwinding. Actually we do not record the sample info for them, so this change just filter out those instruction.
As those instruction would appears at the begin and end of the instruction list, without them we need to add the boundary check for IP `advance` and `backward`.
Also for pseudo probe based profile, we actually don't need the symbolized location info, so here just change to use an empty stack for it. This could save half of the binary loading time.
Differential Revision: https://reviews.llvm.org/D96434
Arthur Eubanks [Thu, 11 Feb 2021 22:37:29 +0000 (14:37 -0800)]
[NFC] Combine runNewPMPasses() and runNewPMCustomPasses()
I've already witnessed two separate changes missing runNewPMPasses()
because runNewPMCustomPasses() is so similar.
This cleans up some duplicated code.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D96553
Benjamin Kramer [Sat, 13 Feb 2021 00:33:22 +0000 (01:33 +0100)]
[lldb] Fix up SysV ABI implementations after
057efa9916cdc354ef4653bcd128a578cc43125e
Jonas Paulsson [Wed, 10 Feb 2021 00:30:05 +0000 (18:30 -0600)]
[SystemZ] Fix vecintrin.h to not emit alignment hints in vec_xl/vec_xst.
vec_xl() and vec_xst() should not emit alignment hints since they take a
scalar pointer and also add a byte offset if passed.
This patch uses memcpy to achieve the desired result.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D96471
Adrian Prantl [Thu, 11 Feb 2021 23:04:10 +0000 (15:04 -0800)]
Support dereferencing a DWARF scalar stack value
Swift async functions receive function arguments inside a
heap-allocated data structure, similar to how ObjC block captures or
C++ coroutine arguments are implement. In DWARF they are described
relative to an entry value that produces a pointer into that heap
object. At typical location looks like
DW_OP_entry_value [ DW_OP_reg14 ] DW_OP_deref DW_OP_plus_uconst 32 DW_OP_deref
This allows the unwinder (which has special ABI knowledge to restore
the contents of r14) to push the base address onto the stack thus
allowing the deref/offset operations to continue. The result of the
entry value is a scalar, because DW_OP_reg14 is a register location —
as it should be since we want to restore the pointer value contained
in r14 at the beginning of the function and not the historical memory
contents it was pointing to. The entry value should restore the
address, which is still valid, not the contents at function entry.
To make this work, we need to allow LLDB to dereference Scalar stack
results like load addresses, which is what this patch
does. Unfortunately it is difficult to test this in isolation, since
the DWARFExpression unit test doesn't have a process.
Differential Revision: https://reviews.llvm.org/D96549
Adrian Prantl [Thu, 11 Feb 2021 20:57:04 +0000 (12:57 -0800)]
Make the error condition in Value::ValueType explicit (NFC)
The comment for ValueType claims that all values <1 are errors, but
not all switch statements take this into account. This patch
introduces an explicit Error case and deletes all default: cases, so
we get warned about incomplete switch coverage.
https://reviews.llvm.org/D96537
Craig Topper [Sat, 13 Feb 2021 00:08:22 +0000 (16:08 -0800)]
[RISCV] Move riscv_vfmv_v_f_vl patterns to RISCVInstrInfoVVLPatterns.td for consistency with riscv_vmv_v_x_vl. NFC
Craig Topper [Fri, 12 Feb 2021 23:33:21 +0000 (15:33 -0800)]
[RISCV] Add support for fixed vector fabs
Craig Topper [Fri, 12 Feb 2021 23:10:18 +0000 (15:10 -0800)]
[RISCV] Add support for fixed vector sqrt.
James Y Knight [Fri, 12 Feb 2021 22:09:18 +0000 (17:09 -0500)]
LLVM-C: Allow LLVM{Get/Set}Alignment on an atomicrmw/cmpxchg instruction.
(Now that these can have alignment specified.)
Eric Schweitz [Fri, 12 Feb 2021 21:51:37 +0000 (13:51 -0800)]
[flang][fir][NFC] Minor format changes to FIROps.td.
Differential Revision: https://reviews.llvm.org/D96633
wlei [Wed, 10 Feb 2021 00:41:44 +0000 (16:41 -0800)]
[CSSPGO][llvm-profgen] Renovate perfscript check and command line input validation
This include some changes related with PerfReader's the input check and command line change:
1) It appears there might be thousands of leading MMAP-Event line in the perfscript for large workload. For this case, the 4k threshold is not eligible to determine it's a hybrid sample. This change renovated the `isHybridPerfScript` by going through the script without threshold limitation checking whether there is a non-empty call stack immediately followed by a LBR sample. It will stop once it find a valid one.
2) Added several input validations for the command line switches in PerfReader.
3) Changed the command line `show-disassembly` to `show-disassembly-only`, it will print to stdout and exit early which leave an empty output profile.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D96387
Eric Schweitz [Fri, 12 Feb 2021 21:09:10 +0000 (13:09 -0800)]
[flang][fir][NFC] Move code from FIRDialect.h into a new header.
Differential Revision: https://reviews.llvm.org/D96630
Jessica Paquette [Fri, 12 Feb 2021 01:00:00 +0000 (17:00 -0800)]
[AArch64][GlobalISel] Fold constants into G_GLOBAL_VALUE
This is pretty much just ports `performGlobalAddressCombine` from
AArch64ISelLowering. (AArch64 doesn't use the generic DAG combine for this.)
This adds a pre-legalize combine which looks for this pattern:
```
%g = G_GLOBAL_VALUE @x
%ptr1 = G_PTR_ADD %g, cst1
%ptr2 = G_PTR_ADD %g, cst2
...
%ptrN = G_PTR_ADD %g, cstN
```
And then, if possible, transforms it like so:
```
%g = G_GLOBAL_VALUE @x
%offset_g = G_PTR_ADD %g, -min(cst)
%ptr1 = G_PTR_ADD %offset_g, cst1
%ptr2 = G_PTR_ADD %offset_g, cst2
...
%ptrN = G_PTR_ADD %offset_g, cstN
```
Where min(cst) is the smallest out of the G_PTR_ADD constants.
This means we should save at least one G_PTR_ADD.
This also updates code in the legalizer + selector which assumes that
G_GLOBAL_VALUE will never have an offset and adds/updates relevant tests.
Differential Revision: https://reviews.llvm.org/D96624
Amy Huang [Fri, 12 Feb 2021 21:58:50 +0000 (13:58 -0800)]
Fix test in external_symbolizer_path.cpp, by adding a REQUIRES: static-lib.
Follow-up to https://reviews.llvm.org/D94563.
Craig Topper [Fri, 12 Feb 2021 22:01:28 +0000 (14:01 -0800)]
[RISCV] Use a ComplexPattern to merge the PatFrags for removing unneeded masks on shift amounts.
Rather than having patterns with and without an AND, use a
ComplexPattern to handle both cases.
Reduces the isel table by about 700 bytes.
Vladimir Vereschaka [Fri, 12 Feb 2021 21:58:41 +0000 (13:58 -0800)]
[libc++abi] Fix forced_unwind tests failures on ARM/EHABI targets.
Added __cxxabi_config.h includes to resolve _LIBCXXABI_ARM_EHABI and
proper building the forces_unwindX.cpp tests for the ARM/EHABI targets.
Differential Revision: https://reviews.llvm.org/D96378
Jay Foad [Fri, 12 Feb 2021 11:29:13 +0000 (11:29 +0000)]
[GlobalISel] Simpler verification of G_SEXT_INREG and G_ASSERT_ZEXT
There's no need to call verifyVectorElementMatch since we already know
that the source and destination types are identical.
Differential Revision: https://reviews.llvm.org/D96589
Amy Huang [Fri, 12 Feb 2021 20:48:06 +0000 (12:48 -0800)]
Fix test failure for external_symbolizer_path.cpp
Arthur Eubanks [Fri, 12 Feb 2021 20:43:27 +0000 (12:43 -0800)]
[gn build] Add missing llvm-profgen dependency
Or else a clean build fails with missing Attributes.inc.
Nikita Popov [Fri, 12 Feb 2021 15:00:24 +0000 (16:00 +0100)]
[AA] Add option for tracing AA queries (NFC)
Add an -aa-trace debug option that can be used to print AA queries,
including any recursive queries and their results.
Nikita Popov [Fri, 12 Feb 2021 14:41:22 +0000 (15:41 +0100)]
[AA] Move Depth member from AAResults to AAQI (NFC)
Rather than storing the query depth in AAResults, store it in AAQI.
This makes more sense, as it is a property of the query. This
sidesteps the issue of D94363, fixing slightly inaccurate AA
statistics. Additionally, I plan to use the Depth from BasicAA in
the future, where fetching it from AAResults would be unreliable.
This change is not quite as straightforward as it seems, because
we need to preserve the depth when creating a new AAQI for recursive
queries across phis. I'm adding a new method for this, as we may
need to preserve additional information here in the future.
Stanislav Mekhanoshin [Fri, 12 Feb 2021 20:30:52 +0000 (12:30 -0800)]
[AMDGPU] Fix Windows build
A trivial fix, 64 bit constant is 1ull, not 1ul on Windows.
Fixed build broken by
c0d7a8bc6241.
Praveen Narayanan [Fri, 12 Feb 2021 20:14:51 +0000 (20:14 +0000)]
Add a "kind" attribute to ContractionOp and OuterProductOp.
Currently, vector.contract joins the intermediate result and the accumulator
argument (of ranks K) using summation. We desire more joining operations ---
such as max --- to help vector.contract express reductions. This change extends
Vector_ContractionOp to take an optional attribute (called "kind", of enum type
CombiningKind) specifying the joining operation to be add/mul/min/max for int/fp
, and and/or/xor for int only. By default this attribute has value "add".
To implement this we also need to extend vector.outerproduct, since
vector.contract gets transformed to vector.outerproduct (and that to
vector.fma). The extension for vector.outerproduct is also an optional kind
attribute that uses the same enum type and possible values. The default is
"add". In case of max/min we transform vector.outerproduct to a combination of
compare and select.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D93280
Zbigniew Sarbinowski [Fri, 12 Feb 2021 19:14:41 +0000 (19:14 +0000)]
[SystemZ][ZOS] Fix __libcpp_thrad_isnull()
Previous pthread revision https://reviews.llvm.org/D91875 missed a small change for `__libcpp_thrad_isnull()` required for z/OS.
Reviewed By: zibi
Differential Revision: https://reviews.llvm.org/D96302
Florian Hahn [Fri, 12 Feb 2021 20:07:58 +0000 (20:07 +0000)]
[clang] Remove redundant condition (NFC).
Jessica Paquette [Fri, 12 Feb 2021 01:02:50 +0000 (17:02 -0800)]
[GlobalISel] Combine (x + 0) -> x, G_PTR_ADD edition
Add it to right_identity_zero.
Differential Revision: https://reviews.llvm.org/D96621
Vedant Kumar [Fri, 12 Feb 2021 20:04:57 +0000 (12:04 -0800)]
[docs/Coverage] Document -show-region-summary
As a drive-by, fix the section in the clang docs about the number of
statistics visible in a report.
Vedant Kumar [Fri, 12 Feb 2021 20:04:27 +0000 (12:04 -0800)]
[docs/Coverage] Answer FAQ about optimization
Martin Storsjö [Fri, 12 Feb 2021 09:38:25 +0000 (11:38 +0200)]
[OpenMP] Silence more warning flags
This silences warnings like these, in mingw builds with clang:
runtime/src/kmp_atomic.h:1021:13: warning: '__kmpc_atomic_cmplx8_rd' has C-linkage specified, but returns user-defined type 'kmp_cmplx64' (aka '__kmp_cmplx64_t') which is incompatible with C [-Wreturn-type-c-linkage]
runtime/src/z_Windows_NT_util.cpp:479:17: warning: cast from 'volatile void *' to 'type-parameter-0-0 *' drops volatile qualifier [-Wcast-qual]
flag = (C *)th->th.th_sleep_loc;
runtime/src/z_Windows_NT_util.cpp:1321:14: warning: cast to 'void *' from smaller integer type 'DWORD' (aka 'unsigned long') [-Wint-to-void-pointer-cast]
} else if ((void *)exit_val != (void *)th) {
Differential Revision: https://reviews.llvm.org/D96585
Martin Storsjö [Fri, 12 Feb 2021 09:37:17 +0000 (11:37 +0200)]
[OpenMP] Avoid warnings about unused static functions on windows
Add ifdefs around one function that only is used in unix build
configurations.
Add a void cast for a windows specific function that currently is
unused but may be intended to be used at some point.
Differential Revision: https://reviews.llvm.org/D96584
Martin Storsjö [Fri, 12 Feb 2021 09:36:49 +0000 (11:36 +0200)]
[OpenMP] Remove two entirely unused variables
Differential Revision: https://reviews.llvm.org/D96583
Martin Storsjö [Fri, 12 Feb 2021 09:34:51 +0000 (11:34 +0200)]
[OpenMP] Add void casts to silence unused variable warnings
These variables are used only in certain build configurations,
or marked with a todo comment indicating that they should be
used/checked/reported.
Differential Revision: https://reviews.llvm.org/D96582
Martin Storsjö [Fri, 12 Feb 2021 09:24:00 +0000 (11:24 +0200)]
[OpenMP] Only use #pragma comment(lib, ...) in MSVC build configurations
MinGW build configurations don't support this pragma (unless
compiling with clang, with -fms-extensions, and linking with
lld), and at least clang warns about it.
This library does end up linked by the cmake files anyway (as
long as the check works properly).
Differential Revision: https://reviews.llvm.org/D96581
Martin Storsjö [Fri, 12 Feb 2021 09:20:10 +0000 (11:20 +0200)]
[OpenMP] Fix the check for libpsapi for i386
check_library_exists fails for stdcall functions, because that
check doesn't include the necessary headers (and thus fails with
an undefined reference to _EnumProcessModules, when the import
library symbol actually is called _EnumProcessModules@16).
Merge the two previous checks check_include_files and
check_library_exists into one with check_c_source_compiles, and
merge the variables that indicate whether it succeeded.
Differential Revision: https://reviews.llvm.org/D96580
James Y Knight [Fri, 12 Feb 2021 19:53:18 +0000 (14:53 -0500)]
Fix layering after
ed4718eccb12.
That commit added a dependency from IR to Analysis, which isn't
allowed. Fix it by duplicating a string constant.
Amara Emerson [Sun, 24 Jan 2021 08:37:55 +0000 (00:37 -0800)]
[GlobalISel] Propagate extends through G_PHIs into the incoming value blocks.
This combine tries to do inter-block hoisting of extends of G_PHIs, into the
originating blocks of the phi's incoming value. The idea is to expose further
optimization opportunities that are normally obscured by the PHI.
Some basic heuristics, and a target hook for AArch64 is added, to allow tuning.
E.g. if the extend is used by a G_PTR_ADD, it doesn't perform this combine
since it may be folded into the addressing mode during selection.
There are very minor code size improvements on AArch64 -Os, but the real benefit
is that it unlocks optimizations like AArch64 conditional compares on some
benchmarks.
Differential Revision: https://reviews.llvm.org/D95703
Amy Huang [Fri, 12 Feb 2021 19:51:13 +0000 (11:51 -0800)]
Disable test in external_symbolizer_path.cpp temporarily to debug test failures.
Florian Hahn [Fri, 12 Feb 2021 17:45:18 +0000 (17:45 +0000)]
[clang] Add -ffinite-loops & -fno-finite-loops options.
This patch adds 2 new options to control when Clang adds `mustprogress`:
1. -ffinite-loops: assume all loops are finite; mustprogress is added
to all loops, regardless of the selected language standard.
2. -fno-finite-loops: assume no loop is finite; mustprogress is not
added to any loop or function. We could add mustprogress to
functions without loops, but we would have to detect that in Clang,
which is probably not worth it.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D96419
Andy Wingo [Fri, 12 Feb 2021 19:01:41 +0000 (20:01 +0100)]
[WebAssembly][lld] Preassign table number 0 to indirect function table for MVP inputs
MVP object files may import at most one table, and if they do, it must
be assigned table number zero in the output, as the references to that
table are not relocatable. Ensure that this is the case, even if some
inputs define other tables.
Differential Revision: https://reviews.llvm.org/D96001
Marco Vanotti [Fri, 12 Feb 2021 19:13:49 +0000 (11:13 -0800)]
Expand unit tests for fuzzer::Merger
This change adds additional unit tests for fuzzer::Merger::Parse and fuzzer::Merger::Merge in anticipation of additional changes to the merge control file format to support cross-process fuzzing.
It modifies the parameter handling of Merge slightly in order to make NewFeatures and NewCov consistent with NewFiles; namely, Merge *replaces* the contents of these output parameters rather than accumulating them (thereby fixing a buggy return value).
This is change 1 of (at least) 18 for cross-process fuzzing support.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D94506
Mehdi Amini [Fri, 12 Feb 2021 18:24:39 +0000 (18:24 +0000)]
[mlir][Linalg] Improve region support in Linalg ops
This revision takes advantage of the newly extended `ref` directive in assembly format
to allow better region handling for LinalgOps. Specifically, FillOp and CopyOp now build their regions explicitly which allows retiring older behavior that relied on specific op knowledge in both lowering to loops and vectorization.
This reverts commit
3f22547fd1 and reland
973e133b769 with a workaround for
a gcc bug that does not accept lambda default parameters:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59949
Differential Revision: https://reviews.llvm.org/D96598
Shafik Yaghmour [Fri, 12 Feb 2021 17:52:18 +0000 (09:52 -0800)]
[LLDB] Fix LLDB_LOG calls to use correct formatting
It looks like a previous change switched these from LLDB_LOGF but did not update the format strings.
Differential Revision: https://reviews.llvm.org/D96550
Fangrui Song [Fri, 12 Feb 2021 19:04:20 +0000 (11:04 -0800)]
DebugInfo/Symbolize: Exclude ARM mapping symbols for .symtab symbolization after D95916
Their names don't convey much information, so they should be excluded.
The behavior matches addr2line.
Differential Revision: https://reviews.llvm.org/D96617
Diego Caballero [Fri, 12 Feb 2021 17:44:39 +0000 (19:44 +0200)]
[mlir][Vector] Align gather/scatter/expand/compress API
Align the vector gather/scatter/expand/compress API with
the vector load/store/maskedload/maskedstore API.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D96396
Diego Caballero [Fri, 12 Feb 2021 17:41:46 +0000 (19:41 +0200)]
[mlir][Vector] Introduce 'vector.load' and 'vector.store' ops
This patch adds the 'vector.load' and 'vector.store' ops to the Vector
dialect [1]. These operations model *contiguous* vector loads and stores
from/to memory. Their semantics are similar to the 'affine.vector_load' and
'affine.vector_store' counterparts but without the affine constraints. The
most relevant feature is that these new vector operations may perform a vector
load/store on memrefs with a non-vector element type, unlike 'std.load' and
'std.store' ops. This opens the representation to model more generic vector
load/store scenarios: unaligned vector loads/stores, perform scalar and vector
memory access on the same memref, decouple memory allocation constraints from
memory accesses, etc [1]. These operations will also facilitate the progressive
lowering of both Affine vector loads/stores and Vector transfer reads/writes
for those that read/write contiguous slices from/to memory.
In particular, this patch adds the 'vector.load' and 'vector.store' ops to the
Vector dialect, implements their lowering to the LLVM dialect, and changes the
lowering of 'affine.vector_load' and 'affine.vector_store' ops to the new vector
ops. The lowering of Vector transfer reads/writes will be implemented in the
future, probably as an independent pass. The API of 'vector.maskedload' and
'vector.maskedstore' has also been changed slightly to align it with the
transfer read/write ops and the vector new ops. This will improve reusability
among all these operations. For example, the lowering of 'vector.load',
'vector.store', 'vector.maskedload' and 'vector.maskedstore' to the LLVM dialect
is implemented with a single template conversion pattern.
[1] https://llvm.discourse.group/t/memref-type-and-data-layout/
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D96185
Paul Robinson [Fri, 12 Feb 2021 15:57:27 +0000 (07:57 -0800)]
[RGT][GlobalIsel] Add missing setUp() calls to legalizer unittests
Some of these accidentally disabled tests failed as a result; updated
tests per @qcolombet instructions. A small number needed additional
updates because legalization has actually changed since they were
written.
Found by the Rotten Green Tests project.
Differential Revision: https://reviews.llvm.org/D95257
Xun Li [Fri, 12 Feb 2021 18:43:08 +0000 (10:43 -0800)]
[NFC][Coroutine] Fix an error message on coro.id verification
The error message should be about coro.id, not coro.begin
Differential Revision: https://reviews.llvm.org/D96447
LLVM GN Syncbot [Fri, 12 Feb 2021 18:40:40 +0000 (18:40 +0000)]
[gn build] Port
cb2d2ae56ae3
Zbigniew Sarbinowski [Fri, 12 Feb 2021 18:36:15 +0000 (18:36 +0000)]
[SystemZ][ZOS] Provide CLOCK_MONOTONIC alternative
We need CLOCK_MONOTONIC equivalent implementation for z/OS within libc++. The default implementation is asserting.
On z/OS the lack of 'clock_gettime()' and 'time_point()' force us to look for alternatives.
The current proposal is to use `gettimeofday()` for CLOCK_MONOTONIC which is also used in CLOCK_REALTIME. This will allow us to skip the assertion with compromised CLOCK_MONOTONIC implementation which will not guarantee to never go back in time because it will use `gettimeofday()` but only when it's set.
Is this a good compromise for platforms which does not support monotonic clock?
Hopefully this will spark the discussion and agreement how to proceed in this situation.
Reviewed By: #libc, ldionne, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D93542
David Green [Fri, 12 Feb 2021 18:34:58 +0000 (18:34 +0000)]
[ARM] Optimize fp store of extract to integer store if already available.
Given a floating point store from an extracted vector, with an integer
VGETLANE that already exists, storing the existing VGETLANEu directly
can be better for performance. As the value is known to already be in an
integer registers, this can help reduce fp register pressure, removed
the need for the fp extract and allows use of more integer post-inc
stores not available with vstr.
This can be a bit narrow in scope, but helps with certain biquad kernels
that store shuffled vector elements.
Differential Revision: https://reviews.llvm.org/D96159
Scott Linder [Fri, 12 Feb 2021 18:14:44 +0000 (18:14 +0000)]
[Symbolize] Teach symbolizer to work directly on object file.
This patch intended to provide additional interface to LLVMsymbolizer
such that they work directly on object files. There is an existing
method - symbolizecode which takes an object file, this patch provides
similar overloads for symbolizeInlinedCode, symbolizeData,
symbolizeFrame. This can be useful for clients who already have a
in-memory object files to symbolize for.
Patch By: pvellien (praveen velliengiri)
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D95232
Simon Pilgrim [Fri, 12 Feb 2021 18:22:39 +0000 (18:22 +0000)]
[DAG] Move basic USUBSAT pattern matches from X86 to DAGCombine
Begin transitioning the X86 vector code to recognise sub(umax(a,b) ,b) or sub(a,umin(a,b)) USUBSAT patterns to make it more generic and available to all targets.
This initial patch just moves the basic umin/umax patterns to DAG, removing some vector-only checks on the way - these are some of the patterns that the legalizer will try to expand back to so we can be reasonably relaxed about matching these pre-legalization.
We can handle the trunc(sub(..))) variants as well, which helps with patterns where we were promoting to a wider type to detect overflow/saturation.
The remaining x86 code requires some cleanup first - some of it isn't actually tested etc. I also need to resurrect D25987.
Differential Revision: https://reviews.llvm.org/D96413
Amy Huang [Fri, 12 Feb 2021 18:18:05 +0000 (10:18 -0800)]
Revert "[DebugInfo] Add an attribute to force type info to be emitted for"
Didn't mean to commit this.
This reverts commit
1b5c2915a2318705727ada586290de15e2cad202.
Amy Huang [Fri, 12 Feb 2021 18:05:11 +0000 (10:05 -0800)]
Try to fix external_symbolizer_path.cpp test to stop breaking on buildbots.
Not sure what the issue is, but it might be because the test copies
llvm-symbolizer to a different directory, and it can't find libc++.
Try to add some REQUIRES that we use in other tests where we copy
llvm tools out of their original directories.
Amy Huang [Fri, 5 Feb 2021 23:43:45 +0000 (15:43 -0800)]
[DebugInfo] Add an attribute to force type info to be emitted for
class types.
The goal is to provide a way to bypass constructor homing when emitting
class definitions and force class definitions in the debug info.
Not sure about the wording of the attribute, or whether it should be
specific to classes with constructors
Mehdi Amini [Fri, 12 Feb 2021 18:15:15 +0000 (18:15 +0000)]
Revert "[mlir][Linalg] Improve region support in Linalg ops."
This reverts commit
973e133b769773c89ce4b8bbfd6c77612d2ff9d4.
It triggers an issue in gcc5 that require investigation, the build is
broken with:
/tmp/ccdpj3B9.s: Assembler messages:
/tmp/ccdpj3B9.s:5821: Error: symbol `_ZNSt17_Function_handlerIFvjjEUljjE2_E9_M_invokeERKSt9_Any_dataOjS6_' is already defined
/tmp/ccdpj3B9.s:5860: Error: symbol `_ZNSt14_Function_base13_Base_managerIUljjE2_E10_M_managerERSt9_Any_dataRKS3_St18_Manager_operation' is already defined
Jianzhou Zhao [Fri, 12 Feb 2021 18:11:13 +0000 (18:11 +0000)]
[dfsan] Comment out ChainOrigin temporarily
It was added by D96160, will be used by D96564.
Some OS got errors if it is not used.
Comment it out for the time being.
Arnold Schwaighofer [Thu, 11 Feb 2021 16:25:31 +0000 (08:25 -0800)]
[coro] Add support for polymorphic return typed coro.suspend.async
This allows for suspend point specific resume function types.
Return values from a suspend point can therefore be modelled as
arguments to the resume function. Allowing for directly passed return
types.
Differential Revision: https://reviews.llvm.org/D96136
Stanislav Mekhanoshin [Thu, 11 Feb 2021 21:31:35 +0000 (13:31 -0800)]
[AMDGPU] Allow accvgpr_read/write decode with opsel
These two instructions are VOP3P and have op_sel_hi bits,
however do not use op_sel_hi. That is recommended to set
unused op_sel_hi bits to 1. However, we cannot decode
both representations with 1 and 0 if bits are set to
default value 1. If bits are set to be ignored with '?'
initializer then encoding defaults them to 0.
The patch is a hack to force ignored '?' bits to 1 on
encoding for these instructions.
There is still canonicalization happens on disasm print
if incoming values are non-default, so that disasm output
does not match binary input, but this is pre-existing
problem for all instructions with '?' bits.
Fixes: SWDEV-272540
Differential Revision: https://reviews.llvm.org/D96543
Lukas Sommer [Fri, 12 Feb 2021 17:22:28 +0000 (12:22 -0500)]
[CodeGen] New pass: Replace vector intrinsics with call 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.
This is a re-try of the original commit
2303e93e66 that was reverted
due to pass manager problems. Other minor changes have also been made.
Differential Revision: https://reviews.llvm.org/D95373
Akira Hatanaka [Wed, 10 Feb 2021 22:47:06 +0000 (14:47 -0800)]
[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of
explicitly emitting retainRV or claimRV calls in the IR
Background:
This fixes a longstanding problem where llvm breaks ARC's autorelease
optimization (see the link below) by separating calls from the marker
instructions or retainRV/claimRV calls. The backend changes are in
https://reviews.llvm.org/D92569.
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue
What this patch does to fix the problem:
- The front-end adds operand bundle "clang.arc.attachedcall" to calls,
which indicates the call is implicitly followed by a marker
instruction and an implicit retainRV/claimRV call that consumes the
call result. In addition, it emits a call to
@llvm.objc.clang.arc.noop.use, which consumes the call result, to
prevent the middle-end passes from changing the return type of the
called function. This is currently done only when the target is arm64
and the optimization level is higher than -O0.
- ARC optimizer temporarily emits retainRV/claimRV calls after the calls
with the operand bundle in the IR and removes the inserted calls after
processing the function.
- ARC contract pass emits retainRV/claimRV calls after the call with the
operand bundle. It doesn't remove the operand bundle on the call since
the backend needs it to emit the marker instruction. The retainRV and
claimRV calls are emitted late in the pipeline to prevent optimization
passes from transforming the IR in a way that makes it harder for the
ARC middle-end passes to figure out the def-use relationship between
the call and the retainRV/claimRV calls (which is the cause of
PR31925).
- The function inliner removes an autoreleaseRV call in the callee if
nothing in the callee prevents it from being paired up with the
retainRV/claimRV call in the caller. It then inserts a release call if
claimRV is attached to the call since autoreleaseRV+claimRV is
equivalent to a release. If it cannot find an autoreleaseRV call, it
tries to transfer the operand bundle to a function call in the callee.
This is important since the ARC optimizer can remove the autoreleaseRV
returning the callee result, which makes it impossible to pair it up
with the retainRV/claimRV call in the caller. If that fails, it simply
emits a retain call in the IR if retainRV is attached to the call and
does nothing if claimRV is attached to it.
- SCCP refrains from replacing the return value of a call with a
constant value if the call has the operand bundle. This ensures the
call always has at least one user (the call to
@llvm.objc.clang.arc.noop.use).
- This patch also fixes a bug in replaceUsesOfNonProtoConstant where
multiple operand bundles of the same kind were being added to a call.
Future work:
- Use the operand bundle on x86-64.
- Fix the auto upgrader to convert call+retainRV/claimRV pairs into
calls with the operand bundles.
rdar://
71443534
Differential Revision: https://reviews.llvm.org/D92808
Matthew G McGovern [Wed, 3 Feb 2021 19:29:44 +0000 (11:29 -0800)]
[sanitizers][Windows] Implement __sanitizer_purge_allocator for Win64
Windows' memory unmapping has to be explicit, there is no madvise.
Similarly, re-mapping memory has to be explicit as well. This patch
implements a basic method for remapping memory which was previously
returned to the OS on Windows.
Patch by Matthew G. McGovern and Jordyn Puryear
Hongtao Yu [Fri, 5 Feb 2021 21:17:51 +0000 (13:17 -0800)]
[ThinLTO][gold] Fix filenaming scheme for tasks.
The gold LTO plugin uses a set of hooks to implements emit-llvm and capture intermediate file generated during LTO. The hooks are called by each lto backend thread with a taskID as argument to differentiate between threads and tasks. Currently, all threads are overwriting the same file which results into only the intermediate output of the last backend thread to be preserved. This diff encodes the taskID into the filename.
Reviewed By: tejohnson, wenlei
Differential Revision: https://reviews.llvm.org/D96173
Alex Zinenko [Thu, 11 Feb 2021 14:01:43 +0000 (15:01 +0100)]
[mlir] Use dialect interfaces to translate OpenMP dialect to LLVM IR
Migrate the translation of the OpenMP dialect operations to LLVM IR to the new
dialect-based mechanism.
Depends On D96503
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D96504
Kadir Cetinkaya [Sat, 6 Feb 2021 18:11:00 +0000 (19:11 +0100)]
[clangd] Introduce Modules
Modules can be used to augment clangd's behaviours in various features.
Differential Revision: https://reviews.llvm.org/D96244
Craig Topper [Fri, 12 Feb 2021 17:20:54 +0000 (09:20 -0800)]
[RISCV] Add support for integer fixed vector setcc
I believe I've covered all orderings of splat operands here. Better
canonicalization in lowering might help reduce this. I did not handle
the immediate adjustments needed for set(u)gt/set(u)lt.
Testing here is limited to byte types because the scalable vector
type used for masks for the store is calculated assuming 8 byte
elements. But for the setcc its based on the element count of the
container type for the setcc input. So they don't agree. We'll need
to enhanced D96352 to handle this I think.
Differential Revision: https://reviews.llvm.org/D96443
Craig Topper [Fri, 12 Feb 2021 17:09:22 +0000 (09:09 -0800)]
[RISCV] Add support for matching .vx and .vi forms of binary instructions for fixed vectors.
Unlike scalable vectors, I'm only using a ComplexPattern for
the immediate itself. The vmv_v_x is matched explicitly. We igore
the VL argument when matching a binary operator, but we do check
it when matching splat directly.
I left out tests for vXi64 as they fail on rv32 right now.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D96365
Jianzhou Zhao [Fri, 12 Feb 2021 03:15:09 +0000 (03:15 +0000)]
[dfsan] Turn off THP at dfsan_flush
https://reviews.llvm.org/D89662 turned this off at dfsan_init.
dfsan_flush also needs to turn it off.
W/o this a program may get more and more memory usage after hours.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96569
Sam Clegg [Fri, 12 Feb 2021 16:59:21 +0000 (08:59 -0800)]
Revert "[lld][WebAssembly] Fix for weak undefined functions in -pie mode"
This reverts commit
ac2be2b6a366c05c01b8228fd804ba6ed52d320b.
This causes a whole much of emscripten tests to fail due to newly
undefined symbols appearing. Will investigate and look into re-landing
later.
Sam McCall [Fri, 12 Feb 2021 16:59:16 +0000 (17:59 +0100)]
[clangd] Work around presumed MSVC stdlib bug
http://45.33.8.238/win/33161/step_4.txt
LLVM GN Syncbot [Fri, 12 Feb 2021 16:56:34 +0000 (16:56 +0000)]
[gn build] Port
ba3ea9c60f0f
Nathan James [Fri, 12 Feb 2021 16:55:44 +0000 (16:55 +0000)]
[clangd] Fix clang tidy provider when multiple config files exist in directory tree
Currently Clang tidy provider searches from the root directory up to the target directory, this is the opposite of how clang-tidy searches for config files.
The result of this is .clang-tidy files are ignored in any subdirectory of a directory containing a .clang-tidy file.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D96204
Florian Hahn [Wed, 10 Feb 2021 12:22:19 +0000 (12:22 +0000)]
[clang] Update mustprogress tests.
This unifies the positive and negative tests in a single file and
manually adjusts the check lines to check for differences surgically.
Alex Zinenko [Thu, 11 Feb 2021 14:01:33 +0000 (15:01 +0100)]
[mlir] Introduce dialect interfaces for translation to LLVM IR
The existing approach to translation to the LLVM IR relies on a single
translation supporting the base LLVM dialect, extensible through inheritance to
support intrinsic-based dialects also derived from LLVM IR such as NVVM and
AVX512. This approach does not scale well as it requires additional
translations to be created for each new intrinsic-based dialect and does not
allow them to mix in the same module, contrary to the rest of the MLIR
infrastructure. Furthermore, OpenMP translation ingrained itself into the main
translation mechanism.
Start refactoring the translation to LLVM IR to operate using dialect
interfaces. Each dialect that contains ops translatable to LLVM IR can
implement the interface for translating them, and the top-level translation
driver can operate on interfaces without knowing about specific dialects.
Furthermore, the delayed dialect registration mechanism allows one to avoid a
dependency on LLVM IR in the dialect that is translated to it by implementing
the translation as a separate library and only registering it at the client
level.
This change introduces the new mechanism and factors out the translation of the
"main" LLVM dialect. The remaining dialects will follow suit.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D96503
Yitzhak Mandelbaum [Thu, 11 Feb 2021 20:51:08 +0000 (20:51 +0000)]
[clang-tidy] Fix `TransformerClangTidyCheck`'s handling of include insertions.
Currently, all include insertions are directed to the main file. However,
Transformer rules can specify alternative destinations for include
insertions. This patch fixes the code to associate the include with the correct
file.
This patch was tested manually. The clang tidy unit test framework does not
support testing changes to header files. Given that this is a bug fix for a live
bug, the patch relies on manual testing rather than blocking on upgrading the
unit test framework.
Differential Revision: https://reviews.llvm.org/D96542
Florian Hahn [Fri, 12 Feb 2021 16:20:51 +0000 (16:20 +0000)]
[AArch64] Increase outlined sequence in test added in
a3f6233fa4b4.
Florian Hahn [Fri, 12 Feb 2021 16:12:52 +0000 (16:12 +0000)]
[AArch64] Add test case where machine outliner breaks up a bundle.
This is a backend test for PR49082.
Petar Avramovic [Fri, 12 Feb 2021 16:11:12 +0000 (17:11 +0100)]
AMDGPU/GlobalISel: Calculate isKnownNeverNaN for fminnum and fmaxnum
Implements same logis as in SelectionDAG.
G_FMINNUM_IEEE and G_FMAXNUM_IEEE are never SNaN by definition and
never NaN when one operand is known non-NaN and other known non-SNaN.
G_FMINNUM and G_FMAXNUM are never NaN/SNaN when one of the operands
is known non-NaN/SNaN.
Differential Revision: https://reviews.llvm.org/D91716
Petar Avramovic [Fri, 12 Feb 2021 16:09:47 +0000 (17:09 +0100)]
AMDGPU/GlobalISel: Check values of constants in isKnownNeverNaN
Differential Revision: https://reviews.llvm.org/D91714
Petar Avramovic [Fri, 12 Feb 2021 16:08:15 +0000 (17:08 +0100)]
AMDGPU/GlobalISel: Precommit globalisel tests for isKnownNeverNaN
Nicolas Vasilache [Fri, 12 Feb 2021 15:46:55 +0000 (15:46 +0000)]
[mlir][Linalg] NFC - Add an OpFoldResult-based builder for InitTensorOp
Yaxun (Sam) Liu [Fri, 12 Feb 2021 15:21:27 +0000 (10:21 -0500)]
Relands "[HIP] Change default --gpu-max-threads-per-block value to 1024"
This reverts commit
e384e94fbe7c1d5c89fcdde33ffda04e9802c2ce.