Raul Tambre [Thu, 20 Aug 2020 17:17:47 +0000 (20:17 +0300)]
[CMake][compiler-rt][libunwind] Compile assembly files as ASM not C, unify workarounds
It isn't very wise to pass an assembly file to the compiler and tell it to compile as a C file and hope that the compiler recognizes it as assembly instead.
Simply don't mark the file as C and CMake will recognize the rest.
This was attempted earlier in https://reviews.llvm.org/D85706, but reverted due to architecture issues on Apple.
Subsequent digging revealed a similar change was done earlier for libunwind in https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09.
Afterwards workarounds were added for MinGW and Apple:
* https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09
* https://reviews.llvm.org/rGd4ded05ba851304b26a437896bc3962ef56f62cb
The workarounds in libunwind and compiler-rt are unified and comments added pointing to each other.
The workaround is updated to only be used for MinGW for CMake versions before 3.17, which fixed the issue (https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4287).
Additionally fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.
Example error:
[525/634] Building C object lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
FAILED: lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
/opt/tooling/drive/host/bin/clang --target=aarch64-linux-gnu -I/opt/tooling/drive/llvm/compiler-rt/lib/tsan/.. -isystem /opt/tooling/drive/toolchain/opt/drive/toolchain/include -x c -Wall -Wno-unused-parameter -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -Wframe-larger-than=530 -Wglobal-constructors --sysroot=. -MD -MT lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -MF lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o.d -o lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -c /opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
/opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S:29:1: error: expected identifier or '('
.section .text
^
1 error generated.
Differential Revision: https://reviews.llvm.org/D86308
Jay Foad [Wed, 26 Aug 2020 16:06:54 +0000 (17:06 +0100)]
[AMDGPU] Remove unused variable introduced in r251860
Drew Wock [Wed, 26 Aug 2020 19:17:17 +0000 (15:17 -0400)]
[FPEnv] Allow fneg + strict_fadd -> strict_fsub in DAGCombiner
This is the first of a set of DAGCombiner changes enabling strictfp
optimizations. I want to test to waters with this to make sure changes
like these are acceptable for the strictfp case- this particular change
should preserve exception ordering and result precision perfectly, and
many other possible changes appear to be able to as well.
Copied from regular fadd combines but modified to preserve ordering via
the chain, this change allows strict_fadd x, (fneg y) to become
struct_fsub x, y and strict_fadd (fneg x), y to become strict_fsub y, x.
Differential Revision: https://reviews.llvm.org/D85548
Martin Storsjö [Wed, 26 Aug 2020 12:47:04 +0000 (15:47 +0300)]
[LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE
Binutils generated sections seem to be padded to a multiple of 16 bytes,
but the aux section definition contains the original, unpadded section
length.
The size check used for IMAGE_COMDAT_SELECT_SAME_SIZE previously
only checked the size of the section itself. When checking the
currently processed object file against the previously chosen
comdat section, we easily have access to the aux section definition
of the currently processed section, but we have to iterate over the
symbols of the previously selected object file to find the section
definition of the previously picked section. (We don't want to
inflate SectionChunk to carry more data, for something that is only
needed in corner cases.) Only do this when the mingw flag is set.
This fixes statically linking clang-built C++ object files against
libstdc++ built with GCC, if the object files contain e.g. typeinfo.
Differential Revision: https://reviews.llvm.org/D86659
Martin Storsjö [Wed, 26 Aug 2020 13:02:52 +0000 (16:02 +0300)]
[LLD] [MinGW] Enable dynamicbase by default
This matches lld-link's own default.
Add a new command line option --no-dynamicbase for disabling it.
(Unfortunately, GNU ld doesn't yet have a matching --no-dynamicbase
option, as that's the default there.)
Differential Revision: https://reviews.llvm.org/D86654
Russell Gallop [Thu, 27 Aug 2020 11:46:49 +0000 (12:46 +0100)]
Florian Hahn [Thu, 27 Aug 2020 11:39:22 +0000 (12:39 +0100)]
[DSE,MemorySSA] Remove short-cut to check if all paths are covered.
The post-order number early continue does not work in some cases, e.g.
if a path from EarlierAccess to an exit includes a node that dominates
EarlierAccess in a cycle.
The short-cut only has very minor impact on compile-time, so it seems
straight-forward to remove it for now:
http://llvm-compile-time-tracker.com/compare.php?from=
062412e79fcfedf2cf004433e42036b0333e3f83&to=
d7386016a77ce1387bdbbf360f1de157faea9d31&stat=instructions
Fixes PR47285.
Anatoly Trosinenko [Thu, 27 Aug 2020 10:19:08 +0000 (13:19 +0300)]
[NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file
The existing implementations are almost identical except for width of the
integer type.
Factor them out to int_mulo_impl.inc for better maintainability.
This patch is almost identical to D86277.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D86289
Anatoly Trosinenko [Thu, 27 Aug 2020 10:19:00 +0000 (13:19 +0300)]
[NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file
The existing implementations are almost identical except for width of the
integer type.
Factor them out to int_mulv_impl.inc for better maintainability.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D86277
Andrew Ng [Wed, 26 Aug 2020 16:06:41 +0000 (17:06 +0100)]
[ELF][test] Add test coverage of TLS to gc-sections.s
Differential Revision: https://reviews.llvm.org/D86639
OCHyams [Thu, 27 Aug 2020 09:38:28 +0000 (10:38 +0100)]
Revert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour"
This reverts commit
b9d977b0ca60c54f11615ca9d144c9f08b29fd85.
This cutoff is no longer required. The commit
34ffa7fc501 (D86153) introduces a
performance improvement which was tested against the motivating case for this
patch.
Discussed in differential revision: https://reviews.llvm.org/D86153
OCHyams [Thu, 27 Aug 2020 08:40:53 +0000 (09:40 +0100)]
[DwarfDebug] Improve validThroughout performance (4/4)
Almost NFC (see end).
The backwards scan in validThroughout significantly contributed to compile time
for a pathological case, causing the 'X86 Assembly Printer' pass to account for
roughly 70% of the run time. This patch guards the loop against running
unnecessarily, bringing the pass contribution down to 4%.
Almost NFC: There is a hack in validThroughout which promotes single constant
value DBG_VALUEs in the prologue to be live throughout the function. We're more
likely to hit this code path with this patch applied. Similarly to the parent
patches there is a small coverage change reported in the order of 10s of bytes.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D86153
OCHyams [Thu, 27 Aug 2020 08:40:52 +0000 (09:40 +0100)]
[DwarfDebug] Improve multi-BB single location detection in validThroughout (3/4)
With the changes introduced in D86151 we can now check for single locations
which span multiple blocks for inlined scopes and blocks.
D86151 introduced the InstructionOrdering parameter, replacing a scan through
MBB instructions. The functionality to compare instruction positions across
blocks was add there, and this patch just removes the exit checks that were
previously (but no longer) required.
CTMark shows a geomean binary size reduction of 2.2% for RelWithDebInfo builds.
llvm-locstats (using D85636) shows a very small variable location coverage
change in 5 of 10 binaries, but just like in D86151 it is only in the order of
10s of bytes.
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D86152
OCHyams [Thu, 27 Aug 2020 08:40:50 +0000 (09:40 +0100)]
[DwarfDebug] Improve single location detection in validThroughout (2/4)
With this patch we're now accounting for two more cases which should be
considered 'valid throughout': First, where RangeEnd is ScopeEnd. Second, where
RangeEnd comes before ScopeEnd when including meta instructions, but are both
preceded by the same non-meta instruction.
CTMark shows a geomean binary size reduction of 1.5% for RelWithDebInfo builds.
`llvm-locstats` (using D85636) shows a very small variable location coverage
change in 2 of 10 binaries, but it is in the order of 10s of bytes which lines
up with my expectations.
I've added a test which checks both of these new cases. The first check in the
test isn't strictly necessary for this patch. But I'm not sure that it is
explicitly tested anywhere else, and is useful for the final patch in the
series.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D86151
OCHyams [Thu, 27 Aug 2020 08:40:48 +0000 (09:40 +0100)]
[NFC][DebugInfo] Create InstructionOrdering helper class (1/4)
Group the map and methods used to query instruction ordering for trimVarLocs
(D82129) into a class. This will make it easier to reuse the functionality
upcoming patches.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D86150
Cullen Rhodes [Tue, 11 Aug 2020 13:04:21 +0000 (13:04 +0000)]
[Sema][AArch64] Support arm_sve_vector_bits attribute
This patch implements the semantics for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.
The semantics were already implemented by D83551, although the
implementation approach has since changed to represent VLSTs as
VectorType in the AST and fixed-length vectors in the IR everywhere
except in function args/returns. This is described in the prototype
patch D85128 demonstrating the new approach.
The semantic changes added in D83551 are changed since the
AttributedType is replaced by VectorType in the AST. Minimal changes
were necessary in the previous patch as the canonical type for both VLA
and VLS was the same (i.e. sizeless), except in constructs such as
globals and structs where sizeless types are unsupported. This patch
reverts the changes that permitted VLS types that were represented as
sizeless types in such circumstances, and adds support for implicit
casting between VLA <-> VLS types as described in section 3.7.3.2 of the
ACLE.
Since the SVE builtin types for bool and uint8 are both represented as
BuiltinType::UChar in VLSTs, two new vector kinds are implemented to
distinguish predicate and data vectors.
[1] https://developer.arm.com/documentation/100987/latest
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D85736
Florian Hahn [Thu, 27 Aug 2020 10:01:20 +0000 (11:01 +0100)]
[DSE,MemorySSA] Add test for PR47285.
Vitaly Buka [Thu, 27 Aug 2020 10:24:21 +0000 (03:24 -0700)]
[NFC][ValueTracking] Cleanup a test
Mikhail Maltsev [Thu, 27 Aug 2020 10:06:45 +0000 (11:06 +0100)]
[AArch64] Optimize instruction selection for certain vector shuffles
This patch adds code to recognize vector shuffles which can be
represented as VDUP (splat) of a vector lane with of a different
(wider) type than the original vector lane type.
For example:
shufflevector <4 x i16> %v, <4 x i16> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
is essentially:
shufflevector <2 x i32> %v, <2 x i32> undef, <2 x i32> <i32 0, i32 0>
Such patterns are generated by the SelectionDAG machinery in some cases
(see DAGCombiner::visitBITCAST in DAGCombiner.cpp, the "Remove double
bitcasts from shuffles" part).
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D86225
Vitaly Buka [Thu, 27 Aug 2020 10:00:56 +0000 (03:00 -0700)]
[NFC][ValueTracking] Fix typo in test
Paul Walker [Sat, 22 Aug 2020 11:00:18 +0000 (12:00 +0100)]
[SVE] Fallback to default expansion when lowering SIGN_EXTEN_INREG from non-byte based source.
Differential Revision: https://reviews.llvm.org/D86394
Sander de Smalen [Thu, 27 Aug 2020 07:12:43 +0000 (08:12 +0100)]
[AArch64][SVE] Add missing debug info for ACLE types.
This patch adds type information for SVE ACLE vector types,
by describing them as vectors, with a lower bound of 0, and
an upper bound described by a DWARF expression using the
AArch64 Vector Granule register (VG), which contains the
runtime multiple of 64bit granules in an SVE vector.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86101
Sjoerd Meijer [Thu, 27 Aug 2020 09:50:51 +0000 (10:50 +0100)]
Follow up of rGca243b07276a: fixed a typo. NFC.
James Henderson [Tue, 25 Aug 2020 14:54:34 +0000 (15:54 +0100)]
[lld][ELF][test] Expand testing of symbols in mergeable sections
Whilst reviewing some internal testing, I noticed a couple of holes in
coverage of mergeable sections containing symbols. This patch addresses
these holes:
1) Show that mid-piece symbols have their values updated properly when
pieces are merged.
2) Show the behaviour of symbols in mergeable pieces when --gc-sections
is enabled.
Reviewed by: grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D86543
Alex Richardson [Tue, 25 Aug 2020 14:45:24 +0000 (15:45 +0100)]
[RISC-V] fmv.s/fmv.d should be as cheap as a move
Since the canonical floatig-point move is fsgnj rd, rs, rs, we should
handle this case in RISCVInstrInfo::isAsCheapAsAMove().
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D86518
Alex Richardson [Tue, 25 Aug 2020 14:45:06 +0000 (15:45 +0100)]
[RISC-V] Mark C_MV as a move instruction
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D86517
Alex Richardson [Tue, 25 Aug 2020 14:44:57 +0000 (15:44 +0100)]
[RISC-V] ADDI/ORI/XORI x, 0 should be as cheap as a move
The isTriviallyRematerializable hook is only called for instructions that are
tagged as isAsCheapAsAMove. Since ADDI 0 is used for "mv" it should definitely
be marked with "isAsCheapAsAMove". This change avoids one stack spill in most of
the atomic-rmw.ll tests functions. It also avoids stack spills in two of our
out-of-tree CHERI tests.
ORI/XORI with zero may or may not be the same as a move micro-architecturally,
but since we are already doing it for register == x0, we might as well
do the same if the immediate is zero.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D86480
David Spickett [Wed, 26 Aug 2020 15:25:05 +0000 (16:25 +0100)]
[lldb] Fix gcc 5.4.0 compile error
Specify type when constructing PromotionKeys,
this fixes error:
"chosen constructor is explicit in copy-initialization"
when compiling lldb with GCC 5.4.0.
This is due to std::tuple having an explicit
default constructor, see:
http://cplusplus.github.io/LWG/lwg-defects.html#2193
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D86690
Vitaly Buka [Thu, 27 Aug 2020 09:01:26 +0000 (02:01 -0700)]
[ValueTracking] Support select in findAllocaForValue
Georgii Rymar [Wed, 26 Aug 2020 14:32:45 +0000 (17:32 +0300)]
[unittests/Object] - Simplify the code in ELFObjectFileTest.cpp, NFCI.
This refactors/rewrites the code to remove duplication.
Differential revision: https://reviews.llvm.org/D86623
Florian Hahn [Thu, 27 Aug 2020 08:52:19 +0000 (09:52 +0100)]
[DSE,MemorySSA] Traverse use-def chain without MemSSA Walker.
For DSE with MemorySSA it is beneficial to manually traverse the
defining access, instead of using a MemorySSA walker, so we can
better control the number of steps together with other limits and
also weed out invalid/unprofitable paths early on.
This patch requires a follow-up patch to be most effective, which I will
share soon after putting this patch up.
This temporarily XFAIL's the limit tests, because we now explore more
MemoryDefs that may not alias/clobber the killing def. This will be
improved/fixed by the follow-up patch.
This patch also renames some `Dom*` variables to `Earlier*`, because the
dominance relation is not really used/important here and potentially
confusing.
This patch allows us to aggressively cut down compile time, geomean
-O3 -0.64%, ReleaseThinLTO -1.65%, at the expense of fewer stores
removed. Subsequent patches will increase the number of removed stores
again, while keeping compile-time in check.
http://llvm-compile-time-tracker.com/compare.php?from=
d8e3294118a8c5f3f97688a704d5a05b67646012&to=
0a929b6978a068af8ddb02d0d4714a2843dd8ba9&stat=instructions
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86486
Rainer Orth [Thu, 27 Aug 2020 08:59:51 +0000 (10:59 +0200)]
[polly][cmake] Don't build LLVMPolly.so without PIC
A build on `sparcv9-sun-solaris2.11` with `-DLLVM_ENABLE_PIC=Off` failed
linking `LLVMPolly.so`:
[2277/2297] Linking CXX shared module lib/LLVMPolly.so
FAILED: lib/LLVMPolly.so
[...]
ld: fatal: relocation error: R_SPARC_H44: file tools/polly/lib/CMakeFiles/obj.Polly.dir/Analysis/DependenceInfo.cpp.o: symbol .data._ZL16__gthread_active (section): invalid shared object relocation type: ABS44 code model unsupported
[...]
As on many other targets, one cannot link non-PIC objects into a shared
object on Solaris/sparcv9.
The following patch avoids this by not building the library without PIC.
It allowed the build to finish.
Differential Revision: https://reviews.llvm.org/D85627
Vitaly Buka [Thu, 27 Aug 2020 08:49:15 +0000 (01:49 -0700)]
[NFC] Add unittests for findAllocaForValue
Sjoerd Meijer [Thu, 27 Aug 2020 07:59:27 +0000 (08:59 +0100)]
Revert "[Verifier] Additional check for intrinsic get.active.lane.mask"
This reverts commit
8d5f64c4edbc190a5a8790157fa1d99cfac34016.
Thanks to Eli Friedma for pointing out that this check is not appropiate here,
this check will be moved to the Lint pass.
Piotr Sobczak [Tue, 25 Aug 2020 09:39:01 +0000 (11:39 +0200)]
[AMDGPU] Preserve vcc_lo when shrinking V_CNDMASK
There is no justification for changing vcc_lo to vcc
when shrinking V_CNDMASK, and such a change could
later confuse live variable analysis.
Make sure the original register is preserved.
Differential Revision: https://reviews.llvm.org/D86541
Frederik Gossen [Wed, 26 Aug 2020 10:00:43 +0000 (10:00 +0000)]
[MLIR][Shape] Fix typo
Differential Revision: https://reviews.llvm.org/D86606
Sjoerd Meijer [Wed, 26 Aug 2020 16:23:22 +0000 (17:23 +0100)]
[LangRef] get.active.lane.mask can produce poison value
We had already specified that second argument `n` of this intrinsic is `n > 0`,
but now add to this that the result is a poison value if this is not the case.
Differential Revision: https://reviews.llvm.org/D86637
Shinji Okumura [Thu, 27 Aug 2020 07:30:29 +0000 (16:30 +0900)]
[Attributor] Add flag for undef value to the state of AAPotentialValues
Currently, an undef value is reduced to 0 when it is added to a set of potential values.
This patch introduces a flag for under values. By this, for example, we can merge two states `{undef}`, `{1}` to `{1}` (because we can reduce the undef to 1).
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D85592
Sam Parker [Thu, 27 Aug 2020 06:14:33 +0000 (07:14 +0100)]
[ARM] Enable outliner at -Oz for M-class
Enable default outlining when the function has the minsize attribute
and we're targeting an m-class core.
Differential Revision: https://reviews.llvm.org/D82951
Martin Storsjö [Thu, 27 Aug 2020 06:25:43 +0000 (09:25 +0300)]
Revert "Reapply D70800: Fix AArch64 AAPCS frame record chain"
This reverts commit
9936455204fd6ab72715cc9d67385ddc93e072ed.
That commit caused failed assertions e.g. like this:
$ cat alloca.c
a;
b() {
float c;
d();
a = __builtin_alloca(d);
c = e();
f(a);
return c;
}
$ clang -target aarch64-linux-gnu -c alloca.c -O2
clang: ../lib/Target/AArch64/AArch64InstrInfo.cpp:3446: void
llvm::emitFrameOffset(llvm::MachineBasicBlock&,
llvm::MachineBasicBlock::iterator, const llvm::DebugLoc&, unsigned int,
unsigned int, llvm::StackOffset, const llvm::TargetInstrInfo*,
llvm::MachineInstr::MIFlag, bool, bool, bool*):
Assertion `(DestReg != AArch64::SP || Bytes % 16 == 0) &&
"SP increment/decrement not 16-byte aligned"' failed.
Kazuaki Ishizaki [Thu, 27 Aug 2020 06:37:23 +0000 (15:37 +0900)]
[mlir] NFC: fix trivial typo under test and tools
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86648
George Mitenkov [Thu, 27 Aug 2020 05:50:57 +0000 (08:50 +0300)]
[MLIR][GPUToSPIRV] Passing gpu module name to SPIR-V module
This patch allows to pass the gpu module name to SPIR-V
module during conversion. This has many benefits as we can lookup
converted to SPIR-V kernel in the symbol table.
In order to avoid symbol conflicts, `"__spv__"` is added to the
gpu module name to form the new one.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86384
luxufan [Fri, 31 Jul 2020 05:03:57 +0000 (13:03 +0800)]
[RISCV] add the MC layer support of riscv vector Zvamo extension
Implements the assemble and disassemble support of RISCV Vector
extension zvamo instructions, base on the 0.9 spec version.
Reviewed by HsiangKai
Differential Revision: https://reviews.llvm.org/D85069
Sam Parker [Thu, 27 Aug 2020 06:09:25 +0000 (07:09 +0100)]
[ARM] Make MachineVerifier more strict about terminators
Fix the ARM backend's analyzeBranch so it doesn't ignore predicated
return instructions, and make the MachineVerifier rule more strict.
Differential Revision: https://reviews.llvm.org/D40061
LLVM GN Syncbot [Thu, 27 Aug 2020 05:59:55 +0000 (05:59 +0000)]
[gn build] Port
cf918c809bb
LLVM GN Syncbot [Thu, 27 Aug 2020 05:59:55 +0000 (05:59 +0000)]
[gn build] Port
7394460d875
Jez Ng [Thu, 27 Aug 2020 05:58:47 +0000 (22:58 -0700)]
[lld-macho] Fix objc.s test
Summary: It was passing on my local machine due to previously-written
files cached in the test output folder.
George Mitenkov [Thu, 27 Aug 2020 05:25:52 +0000 (08:25 +0300)]
[MLIR][SPIRVToLLVM] Added a hook for descriptor set / binding encoding
This patch introduces a hook to encode descriptor set
and binding number into `spv.globalVariable`'s symbolic name. This
allows to preserve this information, and at the same time legalize
the global variable for the conversion to LLVM dialect.
This is required for `mlir-spirv-cpu-runner` to convert kernel
arguments into LLVM.
Also, a couple of some nits added:
- removed unused comment
- changed to a capital letter in the comment
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86515
Eduardo Caldas [Wed, 26 Aug 2020 16:18:55 +0000 (16:18 +0000)]
[SyntaxTree] Refactor `NodeRole`s
Previously a NodeRole would generally be prefixed with the `NodeKind`,
we remove this prefix, as it we redundant and made tests more noisy.
Differential Revision: https://reviews.llvm.org/D86636
Brad Smith [Thu, 27 Aug 2020 05:12:16 +0000 (01:12 -0400)]
Default to -fuse-init-array on OpenBSD.
QingShan Zhang [Thu, 27 Aug 2020 05:02:16 +0000 (05:02 +0000)]
[NFC][Test] Update the test with utils/update_llc_test_checks.py
Mehdi Amini [Thu, 27 Aug 2020 04:42:38 +0000 (04:42 +0000)]
Remove the `run` method from `OpPassManager` and `Pass` and migrate it to `OpToOpPassAdaptor`
This makes OpPassManager more of a "container" of passes and not responsible to drive the execution.
As such we also make it constructible publicly, which will allow to build arbitrary pipeline decoupled from the execution. We'll make use of this facility to expose "dynamic pipeline" in the future.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86391
George Mitenkov [Thu, 27 Aug 2020 04:47:13 +0000 (07:47 +0300)]
[MLIR][SPIRVToLLVM] Updated the documentation for type conversion
This patch updates the type conversion section of the documentation.
It includes the modelling of array strides and the mapping of the
naturally padded structs.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86674
Jianzhou Zhao [Wed, 26 Aug 2020 17:52:06 +0000 (17:52 +0000)]
Fix an overflow issue at BackpatchWord
This happens when generating a huge file by LTO, for example, with -gmlt.
When BitNo is > 2^35, ByteNo is overflowed, and an incorrect output offset is overwritten.
This generates ill-formed bitcodes.
Reviewed-by: tejohnson, vitalybuka
Differential Revision: https://reviews.llvm.org/D86645
George Mitenkov [Thu, 27 Aug 2020 04:10:14 +0000 (07:10 +0300)]
[MLIR][SPIRV] Added optional name to SPIR-V module
This patch adds an optional name to SPIR-V module.
This will help with lowering from GPU dialect (so that we
can pass the kernel module name) and will be more naturally
aligned with `GPUModuleOp`/`ModuleOp`.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86386
Amy Kwan [Thu, 27 Aug 2020 03:43:11 +0000 (22:43 -0500)]
[PowerPC] Implement Vector Multiply High/Divide Extended Builtins in LLVM/Clang
This patch implements the function prototypes vec_mulh and vec_dive in order to
utilize the vector multiply high (vmulh[s|u][w|d]) and vector divide extended
(vdive[s|u][w|d]) instructions introduced in Power10.
Differential Revision: https://reviews.llvm.org/D82609
Ni Hui [Thu, 27 Aug 2020 04:01:23 +0000 (04:01 +0000)]
Fix MLIR build with MLIR_INCLUDE_TESTS=OFF
error message
/usr/bin/ld: CMakeFiles/mlir-opt.dir/mlir-opt.cpp.o: in function `main':
mlir-opt.cpp:(.text.startup.main+0xb9): undefined reference to `mlir::registerTestDialect(mlir::DialectRegistry&)'
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D86592
Jez Ng [Wed, 26 Aug 2020 03:00:42 +0000 (20:00 -0700)]
[lld-macho] Implement -all_load
Differential Revision: https://reviews.llvm.org/D86640
Jez Ng [Tue, 25 Aug 2020 04:57:59 +0000 (21:57 -0700)]
[lld-macho] Implement weak bindings for GOT/TLV
Previously, we were only emitting regular bindings to weak
dynamic symbols; this diff adds support for the weak bindings too, which
can overwrite the regular bindings at runtime. We also treat weak
defined global symbols similarly -- since they can also be interposed at
runtime, they need to be treated as potentially dynamic symbols.
Note that weak bindings differ from regular bindings in that they do not
specify the dylib to do the lookup in (i.e. weak symbol lookup happens
in a flat namespace.)
Differential Revision: https://reviews.llvm.org/D86572
Jez Ng [Thu, 20 Aug 2020 21:45:51 +0000 (14:45 -0700)]
[lld-macho][NFC] Handle GOT bindings and regular bindings more uniformly
Previously, the BindingEntry struct could only store bindings to offsets
within InputSections. Since the GOTSection and TLVPointerSections are
OutputSections, I handled those in a separate code path. However, this
makes it awkward to support weak bindings properly without code
duplication. This diff allows BindingEntries to point directly to
OutputSections, simplifying the upcoming weak binding implementation.
Along the way, I also converted a bunch of functions taking references
to symbols to take pointers instead. Given how much casting we do for
Symbol (especially in the upcoming weak binding diffs), it's cleaner
this way.
Differential Revision: https://reviews.llvm.org/D86571
Jez Ng [Tue, 18 Aug 2020 21:37:04 +0000 (14:37 -0700)]
[lld-macho] Implement -ObjC
It's roughly like -force_load with some filtering.
Differential Revision: https://reviews.llvm.org/D86181
Jez Ng [Thu, 13 Aug 2020 20:48:47 +0000 (13:48 -0700)]
[lld-macho] Handle TAPI and regular re-exports uniformly
The re-exports list in a TAPI document can either refer to other inlined
TAPI documents, or to on-disk files (which may themselves be TBD or
regular files.) Similarly, the re-exports of a regular dylib can refer
to a TBD file.
Differential Revision: https://reviews.llvm.org/D85404
Jez Ng [Tue, 18 Aug 2020 22:46:21 +0000 (15:46 -0700)]
[lld-macho] Make it possible to re-export .tbd files
Two things needed fixing for that to work:
1. getName() no longer returns null for DylibFiles constructed from TAPIs
2. markSubLibrary() now accepts .tbd as a possible extension
Differential Revision: https://reviews.llvm.org/D86180
Jez Ng [Thu, 13 Aug 2020 20:03:00 +0000 (13:03 -0700)]
[lld-macho] Fall back to raw path if we don't find anything under syslibroot
This matches ld64's behavior
Differential Revision: https://reviews.llvm.org/D85992
LLVM GN Syncbot [Thu, 27 Aug 2020 01:24:30 +0000 (01:24 +0000)]
[gn build] Port
7a457593efe
Ryan Prichard [Tue, 18 Aug 2020 09:31:38 +0000 (02:31 -0700)]
[libunwind] Factor out getInfoFromFdeCie. NFCI.
Differential Revision: https://reviews.llvm.org/D86255
Ryan Prichard [Wed, 19 Aug 2020 08:54:17 +0000 (01:54 -0700)]
[libunwind] Minor fixes in libunwind
* When _LIBUNWIND_SUPPORT_COMPACT_UNWIND is defined in config.h,
define it to "1" like the other macros. These macros are still
checked using "#if defined(...)", however.
* Include libunwind.h in AddressSpace.hpp before using
_LIBUNWIND_ARM_EHABI.
* Rename ProcessFrameHeaderCache to TheFrameHeaderCache, because some
configurations (e.g. Android / hermetic static libraries) can have
one cache per shared object in the process. (When there are more
copies, it's more important not to waste memory in the cache.)
* Add 3 missing header files to LIBUNWIND_HEADERS.
Differential Revision: https://reviews.llvm.org/D86254
Matt Arsenault [Mon, 17 Aug 2020 02:17:12 +0000 (22:17 -0400)]
GlobalISel: IRTranslate minimum of pointer sizes on memcpy
I forgot to squash this with
0b7f6cc71a72a85f8a0cbee836a7a8e31876951a
Matt Arsenault [Mon, 3 Aug 2020 13:00:24 +0000 (09:00 -0400)]
GlobalISel: Add generic instructions for memory intrinsics
AArch64, X86 and Mips currently directly consumes these and custom
lowering to produce a libcall, but really these should follow the
normal legalization process through the libcall/lower action.
Lang Hames [Wed, 26 Aug 2020 23:56:33 +0000 (16:56 -0700)]
[ORC][JITLink] Switch to unique ownership for EHFrameRegistrars.
This will make stateful registrars (e.g. a future TargetProcessControl based
registrar) easier to deal with.
Joseph Huber [Wed, 26 Aug 2020 22:11:26 +0000 (18:11 -0400)]
[OpenMP] Always emit debug messages that indicate offloading failure
Summary:
This patch changes the libomptarget runtime to always emit debug messages that
occur before offloading failure. The goal is to provide users with information
about why their application failed in the target region rather than a single
failure message. This is only done in regions that precede offloading failure
so this should not impact runtime performance. if the debug environment
variable is set then the message is forwarded to the debug output as usual.
A new environment variable was added for future use but does nothing in this
current patch. LIBOMPTARGET_INFO will be used to report runtime information to
the user if requrested, such as grid size, SPMD usage, or data mapping. It will
take an integer indicating the level of information verbosity and a value of 0
will disable it.
Reviewers: jdoerfort
Subscribers: guansong sstefan1 yaxunl ye-luo
Tags: #OpenMP
Differential Revision: https://reviews.llvm.org/D86483
Craig Topper [Wed, 26 Aug 2020 22:58:38 +0000 (15:58 -0700)]
[X86] Update release notes for -mtune support.
Arthur Eubanks [Wed, 26 Aug 2020 23:10:02 +0000 (16:10 -0700)]
Fix OCaml bindings
Caused by https://reviews.llvm.org/D85159
Arthur Eubanks [Mon, 3 Aug 2020 20:46:11 +0000 (13:46 -0700)]
[ConstProp] Remove ConstantPropagation
As discussed in
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143801.html.
Currently no users outside of unit tests.
Replace all instances in tests of -constprop with -instsimplify.
Notable changes in tests:
* vscale.ll - @llvm.sadd.sat.nxv16i8 is evaluated by instsimplify, use a fake intrinsic instead
* InsertElement.ll - insertelement undef is removed by instsimplify in @insertelement_undef
llvm/test/Transforms/ConstProp moved to llvm/test/Transforms/InstSimplify/ConstProp
Reviewed By: lattner, nikic
Differential Revision: https://reviews.llvm.org/D85159
Greg Clayton [Fri, 21 Aug 2020 21:40:21 +0000 (14:40 -0700)]
Load correct module for linux and android when duplicates exist in minidump.
Breakpad creates minidump files that can a module loaded multiple times. We found that when a process mmap's the object file for a library, this can confuse breakpad into creating multiple modules in the module list. This patch fixes the GetFilteredModules() to check the linux maps for permissions and use the one that has execute permissions. Typically when people mmap a file into memory they don't map it as executable. This helps people to correctly load minidump files for post mortem analysis.
Differential Revision: https://reviews.llvm.org/D86375
Craig Topper [Wed, 26 Aug 2020 22:21:55 +0000 (15:21 -0700)]
[X86] Change pentium4 tuning settings and scheduler model back to their values before D83913.
Clang now defaults to -march=pentium4 -mtune=generic so we don't
need modern tune settings on pentium4.
Alina Sbirlea [Wed, 26 Aug 2020 22:03:22 +0000 (15:03 -0700)]
Use properlyDominates in RDFLiveness when sorting on dominance.
Summary:
When looking for all reaching definitions, we sort basic blocks on dominance. When sorting looking for properlyDominates() handles the case A == B.
Authored by: pranavb
Differential Revision: https://reviews.llvm.org/D86661
Adrian Prantl [Wed, 26 Aug 2020 22:10:31 +0000 (15:10 -0700)]
Bring llvm::Optional data formatter back in sync with the implementation.
Craig Topper [Wed, 26 Aug 2020 21:44:25 +0000 (14:44 -0700)]
[X86] Default to -mtune=generic unless -march is passed to the driver. Add TuneCPU to the AST serialization
This patch defaults to -mtune=generic unless -march is present. If -march is present we'll use the empty string unless its overridden by mtune. The back should use the target cpu if the tune-cpu isn't present.
It also adds AST serialization support to fix some tests that emit AST and parse it back. These tests diff the IR against the output from not going through AST. So if we don't serialize the tune CPU we fail the diff.
Differential Revision: https://reviews.llvm.org/D86488
Juneyoung Lee [Wed, 26 Aug 2020 20:12:40 +0000 (05:12 +0900)]
[IR] Remove noundef from masked store/load/gather/scatter's pointer operands
As discussed in D86576, noundef attribute is removed from masked store/load/gather/scatter's
pointer operands.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86656
Ahmed Bougacha [Wed, 26 Aug 2020 21:00:11 +0000 (14:00 -0700)]
[AArch64] Use CCAssignFnForReturn helper in more spots. NFC.
It was added for GISel, but SDAG could use it too!
Juneyoung Lee [Wed, 26 Aug 2020 13:06:36 +0000 (22:06 +0900)]
[LangRef] Memset/memcpy/memmove can take undef/poison pointer if the size is 0
According to the current LangRef, Memset/memcpy/memmove can take a
null/dangling pointer if the size is zero.
(Relevant thread: http://lists.llvm.org/pipermail/llvm-dev/2017-July/115665.html )
This patch expands it and allows the functions to take undef/poison pointers
too.
This required the updates in the align attribute since it isn't specified
what is the alignment of undef/poison pointers.
This patch states that their alignment is 1.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86643
Thomas Raoux [Wed, 26 Aug 2020 21:13:52 +0000 (14:13 -0700)]
[mlir][vector] Add vector.bitcast operation
Based on the RFC discussed here:
https://llvm.discourse.group/t/rfc-vector-standard-add-bitcast-operation/1628/
Adding a vector.bitcast operation that allows casting to a vector of different
element type. The most minor dimension bitwidth must stay unchanged.
Differential Revision: https://reviews.llvm.org/D86580
JonChesterfield [Wed, 26 Aug 2020 21:04:03 +0000 (22:04 +0100)]
[libomptarget][amdgpu] Improve thread safety, remove dead code
Sanjay Patel [Wed, 26 Aug 2020 20:36:55 +0000 (16:36 -0400)]
[VectorCombine] adjust test for better coverage; NFC
A >2x insert might crash if we do not generate the shuffle mask carefully.
D86160
Nikita Popov [Thu, 13 Aug 2020 19:58:25 +0000 (21:58 +0200)]
[InstSimplify] Fold min/max intrinsic based on icmp of operands
This is a reboot of D84655, now performing the inner icmp
simplification query without undef folds.
It should be possible to handle the current foldMinMaxSharedOp()
fold based on this, by moving the logic into icmp of min/max instead,
making it more general. We can't drop the folds for constant operands,
because those also allow undef, which we exclude here.
The tests use assumes for exhaustive coverage, and have a few
more examples of misc folds we get based on icmp simplification.
Differential Revision: https://reviews.llvm.org/D85929
Nikita Popov [Wed, 26 Aug 2020 19:59:05 +0000 (21:59 +0200)]
[InstSimplify] Add additional umax tests (NFC)
A sample of some folds we get if we perform icmp simplification
on min/max intrinsics.
Muhammad Asif Manzoor [Wed, 26 Aug 2020 19:36:26 +0000 (15:36 -0400)]
[AArch64][SVE] Add lowering for llvm fceil
Add the functionality to lower fceil for passthru variant
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D84548
Arthur Eubanks [Wed, 26 Aug 2020 19:47:59 +0000 (12:47 -0700)]
[test] Rewrite various tests to not use constprop
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D86653
Owen Anderson [Wed, 26 Aug 2020 19:36:13 +0000 (19:36 +0000)]
Reapply D70800: Fix AArch64 AAPCS frame record chain
Original Commit Message:
After the commit r368987 (rG643adb55769e) was landed, the frame record (FP and LR register)
may be placed in the middle of a stack frame if a function has both callee-saved
general-purpose registers and floating point registers. This will break the stack unwinders
that simply walk through the frame records (based on the guarantee from AAPCS64
"The Frame Pointer" section). This commit fixes the problem by adding the frame record offset.
Patch By: logan
Sanjay Patel [Wed, 26 Aug 2020 19:21:54 +0000 (15:21 -0400)]
[DAGCombiner] allow store merging non-i8 truncated ops
We have a gap in our store merging capabilities for shift+truncate
patterns as discussed in:
https://llvm.org/PR46662
I generalized the code/comments for this function in earlier commits,
so we only need ease the type restriction and adjust the address/endian
checking to make this work.
AArch64 lets us switch endian to make sure that patterns are matched
either way.
Differential Revision: https://reviews.llvm.org/D86420
aartbik [Wed, 26 Aug 2020 18:00:55 +0000 (11:00 -0700)]
[llvm] [Thumb2] Test unusual length for active lane mask
Thumb2 test for the fixed issue with unusual length.
https://bugs.llvm.org/show_bug.cgi?id=47299
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D86646
Aleksandr Platonov [Wed, 26 Aug 2020 19:10:35 +0000 (22:10 +0300)]
[Support][Windows] Fix incorrect GetFinalPathNameByHandleW() return value check in realPathFromHandle()
`GetFinalPathNameByHandleW(,,N,)` returns:
- `< N` on success (this value does not include the size of the terminating null character)
- `>= N` if buffer is too small (this value includes the size of the terminating null character)
So, when `N == Buffer.capacity() - 1`, we need to resize buffer if return value is > `Buffer.capacity() - 2`.
Also, we can set `N` to `Buffer.capacity()`.
Thus, without this patch `realPathFromHandle()` returns unfilled buffer when length of the final path of the file is equal to `Buffer.capacity()` or `Buffer.capacity() - 1`.
Reviewed By: andrewng, amccarth
Differential Revision: https://reviews.llvm.org/D86564
Jon Chesterfield [Wed, 26 Aug 2020 19:01:42 +0000 (20:01 +0100)]
[libomptarget][amdgpu] Update plugin CMake to work with latest rocr library
AndreyChurbanov [Wed, 26 Aug 2020 18:56:01 +0000 (21:56 +0300)]
[OpenMP] Fix import library installation with MinGW
Patch by mati865@gmail.com
Differential Revision: https://reviews.llvm.org/D86552
Kazuaki Ishizaki [Wed, 26 Aug 2020 18:50:14 +0000 (03:50 +0900)]
[mlir] NFC: fix trivial typos in documents
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86563
Eric Christopher [Wed, 26 Aug 2020 18:44:57 +0000 (11:44 -0700)]
Add cmake test support for LLJITWithThinLTOSummaries to make sure
it's being built and called (and substituted).
Arthur Eubanks [Mon, 10 Aug 2020 19:53:30 +0000 (12:53 -0700)]
[InstSimplify] Simplify to vector constants when possible
InstSimplify should do all transformations that ConstProp does, but
one thing that ConstProp does that InstSimplify wouldn't is inline
vector instructions that are constants, e.g. into a ret.
Previously vector instructions wouldn't be inlined in InstSimplify
because llvm::Simplify*Instruction() would return nullptr for specific
instructions, such as vector instructions that were actually constants,
if it couldn't simplify them.
This changes SimplifyInsertElementInst, SimplifyExtractElementInst, and
SimplifyShuffleVectorInst to return a vector constant when possible.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D85946
Arthur Eubanks [Wed, 26 Aug 2020 18:30:10 +0000 (11:30 -0700)]
[gn build] Manually port
ed07e1fe
Francesco Petrogalli [Wed, 26 Aug 2020 15:43:56 +0000 (15:43 +0000)]
[MC][SVE] Fix data operand for instruction alias of `st1d`.
The version of `st1d` that operates with vector plus immediate
addressing mode uses the alias `st1d { <Zn>.d }, <Pg>, [<Za>.d]` for
rendering `st1d { <Zn>.d }, <Pg>, [<Za>.d, #0]`. The disassembler was
generating `<Zn>.s` instead of `<Zn>.d>`.
Differential Revision: https://reviews.llvm.org/D86633