Georgii Rymar [Tue, 18 Aug 2020 12:24:26 +0000 (15:24 +0300)]
[yaml2obj] - Make the 'Machine' key optional.
Currently we have to set 'Machine' to something in our
YAML descriptions. Usually we use 'EM_X86_64' for 64-bit targets
and 'EM_386' for 32-bit targets. At the same time, in fact, in most
cases our tests do not need a machine type and we can use
'EM_NONE'.
This is cleaner, because avoids the need of using a particular machine.
In this patch I've made the 'Machine' key optional (the default value,
when it is not specified is `EM_NONE`) and removed it (where possible)
from yaml2obj, obj2yaml and llvm-readobj tests.
There are few tests left where I decided not to remove it, because
I didn't want to touch CHECK lines or doing anything more complex
than a removing a "Machine: *" line and formatting lines around.
Differential revision: https://reviews.llvm.org/D86202
Bevin Hansson [Thu, 20 Aug 2020 08:24:03 +0000 (10:24 +0200)]
Refactor most of the fixed-point tests.
The tests were not written with update_cc_test_checks
in mind, which make them difficult to update. Fix this.
Also, some of the consteval tests were outright broken,
since the CHECK lines were wrong.
Other than this, the semantics of the tests are preserved.
Bevin Hansson [Wed, 5 Aug 2020 14:40:05 +0000 (16:40 +0200)]
[IR] Add FixedPointBuilder.
This patch adds a convenience class for using FixedPointSemantics
to build fixed-point operations in IR.
RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D85314
Bevin Hansson [Thu, 16 Jul 2020 11:56:07 +0000 (13:56 +0200)]
[ADT] Move FixedPoint.h from Clang to LLVM.
This patch moves FixedPointSemantics and APFixedPoint
from Clang to LLVM ADT.
This will make it easier to use the fixed-point
classes in LLVM for constructing an IR builder for
fixed-point and for reusing the APFixedPoint class
for constant evaluation purposes.
RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-August/144025.html
Reviewed By: leonardchan, rjmccall
Differential Revision: https://reviews.llvm.org/D85312
Bevin Hansson [Tue, 4 Aug 2020 10:55:38 +0000 (12:55 +0200)]
[AST] Get field size in chars rather than bits in RecordLayoutBuilder.
In D79719, LayoutField was refactored to fetch the size of field
types in bits and then convert to chars, rather than fetching
them in chars directly. This is not ideal, since it makes the
calculations char size dependent, and breaks for sizes that
are not a multiple of the char size.
This patch changes it to use getTypeInfoInChars instead of
getTypeInfo.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D85191
Arjun P [Thu, 20 Aug 2020 08:07:44 +0000 (13:37 +0530)]
[MLIR] Redundancy detection for FlatAffineConstraints using Simplex
This patch adds the capability to perform constraint redundancy checks for `FlatAffineConstraints` using `Simplex`, via a new member function `FlatAffineConstraints::removeRedundantConstraints`. The pre-existing redundancy detection algorithm runs a full rational emptiness check for each inequality separately for checking redundancy. Leveraging the existing `Simplex` infrastructure, in this patch we have an algorithm for redundancy checks that can check each constraint by performing pivots on the tableau, which provides an alternative to running Fourier-Motzkin elimination for each constraint separately.
Differential Revision: https://reviews.llvm.org/D84935
dfukalov [Wed, 19 Aug 2020 21:14:14 +0000 (00:14 +0300)]
[AMDGPU][LoopUnroll] Increase BB size to analyze for complete unroll.
The `UnrollMaxBlockToAnalyze` parameter is used at the stage when we have no
information about a loop body BB cost. In some cases, e.g. for simple loop
```
for(int i=0; i<32; ++i){
D = Arr2[i*8 + C1];
Arr1[i*64 + C2] += C3 * D;
Arr1[i*64 + C2 + 2048] += C4 * D;
}
```
current default parameter value is not enough to run deeper cost analyze so the
loop is not completely unrolled.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D86248
Petr Hosek [Thu, 20 Aug 2020 07:03:45 +0000 (00:03 -0700)]
[compiler-rt] Compile assembly files as ASM not C
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.
Instead enable the ASM language and mark the files as being ASM.
[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.
Fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.
Patch By: tambre
Differential Revision: https://reviews.llvm.org/D85706
Yvan Roux [Thu, 20 Aug 2020 07:25:33 +0000 (09:25 +0200)]
[ARM][MachineOutliner] Add default mode.
Use the stack to save and restore the link register when there is no
available register to do it.
Differential Revision: https://reviews.llvm.org/D76069
David Stenberg [Thu, 20 Aug 2020 06:28:24 +0000 (08:28 +0200)]
[LoopUnswitch] Fix incorrect Modified status
When hoisting simple values out from a loop, and an optsize attribute, a
convergent call, or an invoke instruction hindered the pass from
unswitching the loop, the pass would return an incorrect Modified
status.
This was caught using the check introduced by D80916.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86085
Johannes Doerfert [Tue, 18 Aug 2020 20:54:05 +0000 (15:54 -0500)]
[Attributor][FIX] Update the call graph properly when internalizing functions
The internal version is now part of the SCC, make sure to perform this
update.
Johannes Doerfert [Tue, 18 Aug 2020 15:03:25 +0000 (10:03 -0500)]
[Attributor] Simplify comparison against constant null pointer
Comparison against null is a common pattern that usually is followed by
error handling code and the likes. We now use AANonNull to simplify
these comparisons optimistically in order to make more code dead early
on.
Reviewed By: uenoku
Differential Revision: https://reviews.llvm.org/D86145
Johannes Doerfert [Tue, 18 Aug 2020 15:01:37 +0000 (10:01 -0500)]
[Attributor][FIX] Do not use cyclic arguments for `nonnull`
`AADereferenceable::getAssumedDereferenceableBytes()` is actually
deducing `dereferenceable_or_null`. We should not use that information
to deduce `nonnull`, since it doesn't imply `nonnull`.
Johannes Doerfert [Sun, 2 Aug 2020 06:54:05 +0000 (01:54 -0500)]
[Attributor][AAIsDead][NFC] Skip uninteresting instructions early
Johannes Doerfert [Sun, 2 Aug 2020 07:03:11 +0000 (02:03 -0500)]
[Attributor][NFC] Improve the depgraph test to make differences clear
Johannes Doerfert [Sun, 2 Aug 2020 05:36:52 +0000 (00:36 -0500)]
[Attributor][NFC] Extract functionality into own member
Fangrui Song [Thu, 20 Aug 2020 05:48:28 +0000 (22:48 -0700)]
[ELF][test] Fix some llvm-objdump RUN lines which don't actually test anything
Qiu Chaofan [Thu, 20 Aug 2020 05:29:43 +0000 (13:29 +0800)]
[PowerPC] Support constrained scalar fptosi/fptoui
This patch adds support for constrained scalar fp to int operations on
PowerPC. Besides, this fixes the FP exception bit of quad-precision
convert & truncate instructions.
Reviewed By: steven.zhang, uweigand
Differential Revision: https://reviews.llvm.org/D81537
Johannes Doerfert [Thu, 20 Aug 2020 05:25:13 +0000 (00:25 -0500)]
Revert "[IR] Intrinsics default attributes and opt-out flag"
This commit introduced a non-trivial compile time regression that needs
to be addressed: https://reviews.llvm.org/D70365#2227627
Given that it is unclear how long that will take, I'll revert it for
now.
This reverts commit
eedf18fc1f5fc71bb896204abf41fc5a2dbf25f7.
Johannes Doerfert [Thu, 20 Aug 2020 05:00:35 +0000 (00:00 -0500)]
Revert "[OpenMPOpt] ICV tracking for calls"
This commits breaks certain OpenMP codes (on power) because it expanded
the Attributor scope without telling the Attributor about the SCC
extend. See: https://reviews.llvm.org/D85544#2227611
This reverts commit
b0b32e649011d9a60165b9b53eb2764b7da9c8ca.
Shilei Tian [Thu, 20 Aug 2020 03:12:02 +0000 (23:12 -0400)]
[OpenMP] Introduce target memory manager
Target memory manager is introduced in this patch which aims to manage target
memory such that they will not be freed immediately when they are not used
because the overhead of memory allocation and free is very large. For CUDA
device, cuMemFree even blocks the context switch on device which affects
concurrent kernel execution.
The memory manager can be taken as a memory pool. It divides the pool into
multiple buckets according to the size such that memory allocation/free
distributed to different buckets will not affect each other.
In this version, we use the exact-equality policy to find a free buffer. This
is an open question: will best-fit work better here? IMO, best-fit is not good
for target memory management because computation on GPU usually requires GBs of
data. Best-fit might lead to a serious waste. For example, there is a free
buffer of size 1960MB, and now we need a buffer of size 1200MB. If best-fit,
the free buffer will be returned, leading to a 760MB waste.
The allocation will happen when there is no free memory left, and the memory
free on device will take place in the following two cases:
1. The program ends. Obviously. However, there is a little problem that plugin
library is destroyed before the memory manager is destroyed, leading to a fact
that the call to target plugin will not succeed.
2. Device is out of memory when we request a new memory. The manager will walk
through all free buffers from the bucket with largest base size, pick up one
buffer, free it, and try to allocate immediately. If it succeeds, it will
return right away rather than freeing all buffers in free list.
Update:
A threshold (8KB by default) is set such that users could control what size of memory
will be managed by the manager. It can also be configured by an environment variable
`LIBOMPTARGET_MEMORY_MANAGER_THRESHOLD`.
Reviewed By: jdoerfert, ye-luo, JonChesterfield
Differential Revision: https://reviews.llvm.org/D81054
Zi Xuan Wu (Zeson) [Thu, 20 Aug 2020 02:58:37 +0000 (10:58 +0800)]
[NFC] It's a test commit, which updates CREDITS.TXT
Tony [Thu, 20 Aug 2020 01:09:12 +0000 (01:09 +0000)]
[AMDGPU] Correct DWARF register defintions
- Rename AMDGPU SCC DWARF register to STATUS since the scalar
condition code is a bit within the STATUS register.
- Correct bit size of the VCC_64 register to 64 which is the size in
wave64 mode.
Differential Revision: https://reviews.llvm.org/D86259
Jonas Devlieghere [Thu, 20 Aug 2020 00:51:50 +0000 (17:51 -0700)]
[lldb] Return empty string from getExtraMakeArgs when not implemented
No return statement means the method returns None which breaks a list
comprehension down the line that expects a str instance.
Craig Topper [Thu, 20 Aug 2020 00:44:21 +0000 (17:44 -0700)]
[X86][AutoUpgrade] Simplify string management in UpgradeDataLayoutString a bit. NFCI
We don't need a std::string for a literal string, we can use a
StringRef.
The addition of StringRefs produces a Twine that we can just call
str() without converting to a SmallString ourselves. Twine will
do that internally.
Rahul Joshi [Wed, 19 Aug 2020 23:07:42 +0000 (16:07 -0700)]
[MLIR] Add PatternRewriter::mergeBlockBefore() to merge a block in the middle of another block.
- This utility to merge a block anywhere into another one can help inline single
block regions into other blocks.
- Modified patterns test to use the new function.
Differential Revision: https://reviews.llvm.org/D86251
Craig Topper [Wed, 19 Aug 2020 22:58:16 +0000 (15:58 -0700)]
[X86] Add support 'tune' in target attribute
This adds parsing and codegen support for tune in target attribute.
I've implemented this so that arch in the target attribute implicitly disables tune from the command line. I'm not sure what gcc does here. But since -march implies -mtune. I assume 'arch' in the target attribute implies tune in the target attribute.
Differential Revision: https://reviews.llvm.org/D86187
Craig Topper [Wed, 19 Aug 2020 22:58:06 +0000 (15:58 -0700)]
[X86] Add mtune command line test cases that should have gone with
4cbceb74bb5676d0181d4d0cab5194d90a42c2ec
Matt Arsenault [Mon, 3 Aug 2020 18:13:38 +0000 (14:13 -0400)]
GlobalISel: Implement fewerElementsVector for G_CONCAT_VECTORS sources
This fixes <6 x s16> = G_CONCAT_VECTORS from <3 x s16> handling.
Richard Smith [Wed, 19 Aug 2020 19:46:52 +0000 (12:46 -0700)]
[c++14] Implement missed piece of N3323: use "converted constant" rules
for array bounds, not "integer constant" rules.
For an array bound of class type, this causes us to perform an implicit
conversion to size_t, instead of looking for a unique conversion to
integral or unscoped enumeration type. This affects which cases are
valid when a class has multiple implicit conversion functions to
different types.
Richard Smith [Wed, 19 Aug 2020 19:46:22 +0000 (12:46 -0700)]
Explain why the array bound is non-constant in VLA diagnostics.
In passing, also use a more precise diagnostic to explain why an
expression is not an ICE if it's not of integral type.
Jonas Devlieghere [Wed, 19 Aug 2020 22:35:29 +0000 (15:35 -0700)]
[lldb] Update TestSimulatorPlatform.py to set ARCH_CFLAGS instead of TRIPLE
I move the triple (de)composition logic into the builder in
e5d08fcbac72
but this test is relying on Make to construct the set the ARCH,
ARCH_CFLAGS and SDKROOT based on the given TRIPLE. This patch updates
the test to pass these variables directly.
Differential revision: https://reviews.llvm.org/D86244
Med Ismail Bennani [Wed, 19 Aug 2020 20:04:35 +0000 (22:04 +0200)]
[lldb/interpreter] Add REPL-specific init file
This patch adds the infrastructure to have language specific REPL init
files. It's the foundation work to a following patch that will introduce
Swift REPL init file.
When lldb is launched with the `--repl` option, it will look for a REPL
init file in the home directory and source it. This overrides the
default `~/.lldbinit`, which content might make the REPL behave
unexpectedly. If the REPL init file doesn't exists, lldb will fall back
to the default init file.
rdar://
65836048
Differential Revision: https://reviews.llvm.org/D86242
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Dokyung Song [Wed, 19 Aug 2020 20:21:05 +0000 (20:21 +0000)]
[libFuzzer] Fix value-profile-load test.
The behavior of the CrossOver mutator has changed with
bb54bcf84970c04c9748004f3a4cf59b0c1832a7. This seems to affect the
value-profile-load test on Darwin. This patch provides a wider margin for
determining success of the value-profile-load test, by testing the targeted
functionality (i.e., GEP index value profile) more directly and faster. To this
end, LoadTest.cpp now uses a narrower condition (Size != 8) for initial pruning
of inputs, effectively preventing libFuzzer from generating inputs longer than
necessary and spending time on mutating such long inputs in the corpus - a
functionality not meant to be tested by this specific test.
Previously, on x86/Linux, it required 6,597,751 execs with -use_value_profile=1
and 19,605,575 execs with -use_value_profile=0 to hit the crash. With this
patch, the test passes with 174,493 execs, providing a wider margin from the
given trials of 10,000,000. Note that, without the value profile (i.e.,
-use_value_profile=0), the test wouldn't pass as it still requires 19,605,575
execs to hit the crash.
Differential Revision: https://reviews.llvm.org/D86247
Matt Morehouse [Wed, 19 Aug 2020 22:07:17 +0000 (15:07 -0700)]
[DFSan] Handle mmap() calls before interceptors are installed.
InitializeInterceptors() calls dlsym(), which calls calloc(). Depending
on the allocator implementation, calloc() may invoke mmap(), which
results in a segfault since REAL(mmap) is still being resolved.
We fix this by doing a direct syscall if interceptors haven't been fully
resolved yet.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D86168
Siva Chandra Reddy [Wed, 19 Aug 2020 21:44:23 +0000 (14:44 -0700)]
[libc][obvious] Fix x86 long double conversion to integer.
Fixes incorrectly constructed ceill tests.
Francesco Petrogalli [Wed, 19 Aug 2020 19:50:24 +0000 (19:50 +0000)]
[llvm] Add default constructor of `llvm::ElementCount`.
This patch prevents failures like those reported in
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/34173.
We have enabled the default constructor for
`llvm::ElementCount` to make sure the code compiles on Windows.
Reviewed By: ormris
Differential Revision: https://reviews.llvm.org/D86240
Petr Hosek [Wed, 19 Aug 2020 21:33:52 +0000 (14:33 -0700)]
[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1119478
Patch By: haampie
Differential Revision: https://reviews.llvm.org/D86245
Kyungwoo Lee [Wed, 19 Aug 2020 21:28:06 +0000 (17:28 -0400)]
Force Remove Attribute
-force-attribute adds an attribute to function via command-line.
However, there was no counter-part to remove an attribute. This patch
adds -force-remove-attribute that removes an attribute from function.
Differential Revision: https://reviews.llvm.org/D85586
Sanjay Patel [Wed, 19 Aug 2020 20:32:24 +0000 (16:32 -0400)]
[ValueTracking] define/use max recursion depth in header
There's a potential motivating case to increase this limit in PR47191:
http://bugs.llvm.org/PR47191
But first we should make it less hacky. The limit in InstCombine is directly tied
to this value because an increase there can cause asserts in the underlying value
tracking calls if not changed together. The usage in VectorUtils is independent,
but the comment suggests that we should use the same value unless there's a known
reason to diverge. There are similar limits in codegen analysis, but I think we
should leave those independent in case we intentionally want the optimization
power/cost to be different there.
Differential Revision: https://reviews.llvm.org/D86113
Mars Saxman [Wed, 19 Aug 2020 20:45:18 +0000 (22:45 +0200)]
Implement FPToUI and UIToFP ops in standard dialect
Add the unsigned complements to the existing FPToSI and SIToFP operations in the
standard dialect, with one-to-one lowerings to the corresponding LLVM operations.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D85557
Hiroshi Yamauchi [Fri, 14 Aug 2020 19:20:08 +0000 (12:20 -0700)]
[X86] Add feature for Fast Short REP MOV (FSRM) for Icelake or newer.
Differential Revision: https://reviews.llvm.org/D85989
Jonas Devlieghere [Wed, 19 Aug 2020 20:25:57 +0000 (13:25 -0700)]
[lldb] Move Xcode SDK helper functions into lldbutil
This allows the logic to be reused by both the builders and the tests.
Craig Topper [Wed, 19 Aug 2020 20:12:46 +0000 (13:12 -0700)]
[X89] Ignore -mtune=generic to fix failures some users are seeing after D85384
Some code bases out there pass -mtune=generic to clang. This would have
been ignored prior to D85384. Now it results in an error
because "generic" isn't recognized by isValidCPUName.
And if we let it go through to the backend as a tune
setting it would get the tune flags closer to i386 rather
than a modern CPU.
I plan to change what tune=generic does in the backend in
a future patch. And allow this in the frontend.
But this should be a quick fix for the error some users
are seeing.
Alexey Bataev [Tue, 18 Aug 2020 18:51:51 +0000 (14:51 -0400)]
[OPENMP]Fix PR47158, case 2: do not report host-only functions in unused function in device mode.
If the function is not marked exlicitly as declare target and it calls
function(s), marked as declare target device_type(host), these host-only
functions should not be dignosed as used in device mode, if the caller
function is not used in device mode too.
Differential Revision: https://reviews.llvm.org/D86164
River Riddle [Wed, 19 Aug 2020 19:57:45 +0000 (12:57 -0700)]
[mlir] Add a new "Pattern Descriptor Language" (PDL) dialect.
PDL presents a high level abstraction for the rewrite pattern infrastructure available in MLIR. This abstraction allows for representing patterns transforming MLIR, as MLIR. This allows for applying all of the benefits that the general MLIR infrastructure provides, to the infrastructure itself. This means that pattern matching can be more easily verified for correctness, targeted by frontends, and optimized.
PDL abstracts over various different aspects of patterns and core MLIR data structures. Patterns are specified via a `pdl.pattern` operation. These operations contain a region body for the "matcher" code, and terminate with a `pdl.rewrite` that either dispatches to an external rewriter or contains a region for the rewrite specified via `pdl`. The types of values in `pdl` are handle types to MLIR C++ types, with `!pdl.attribute`, `!pdl.operation`, and `!pdl.type` directly mapping to `mlir::Attribute`, `mlir::Operation*`, and `mlir::Value` respectively.
An example pattern is shown below:
```mlir
// pdl.pattern contains metadata similarly to a `RewritePattern`.
pdl.pattern : benefit(1) {
// External input operand values are specified via `pdl.input` operations.
// Result types are constrainted via `pdl.type` operations.
%resultType = pdl.type
%inputOperand = pdl.input
%root, %results = pdl.operation "foo.op"(%inputOperand) -> %resultType
pdl.rewrite(%root) {
pdl.replace %root with (%inputOperand)
}
}
```
This is a culmination of the work originally discussed here: https://groups.google.com/a/tensorflow.org/g/mlir/c/j_bn74ByxlQ
Differential Revision: https://reviews.llvm.org/D84578
Sourabh Singh Tomar [Wed, 19 Aug 2020 20:00:31 +0000 (01:30 +0530)]
Re-apply "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"
This patch was reverted in
7c182663a857fc87 due to some failures
observed on PCC based machines. Failures were due to Endianness issue and
long double representation issues.
Patch is revised to address Endianness issue. Furthermore, support
for emission of `DW_OP_implicit_value` for `long double` has been removed
(since it was unclean at the moment). Planning to handle this in
a clean way soon!
For more context, please refer to following review link.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D83560
Shilei Tian [Wed, 19 Aug 2020 20:07:58 +0000 (16:07 -0400)]
[OpenMP] Refactored the function `DeviceTy::data_exchange`
This patch contains the following changes:
1. Renamed the function `DeviceTy::data_exchange` to `DeviceTy::dataExchange`;
2. Changed the second argument `DeviceTy DstDev` to `DeviceTy &DstDev`;
3. Renamed the last argument.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D86238
Sourabh Singh Tomar [Wed, 19 Aug 2020 19:58:03 +0000 (01:28 +0530)]
Revert "[DebugInfo] Emit DW_OP_implicit_value for Floating point constants"
This reverts commit
15801f16194a3d.
arc's land messed up! It removed the new commit message and took it
from revision.
Raul Tambre [Wed, 19 Aug 2020 19:50:35 +0000 (12:50 -0700)]
[AArch64][GlobalISel] Handle rtcGPR64RegClassID in AArch64RegisterBankInfo::getRegBankFromRegClass()
TargetRegisterInfo::getMinimalPhysRegClass() returns rtcGPR64RegClassID for X16
and X17, as it's the last matching class. This in turn gets passed to
AArch64RegisterBankInfo::getRegBankFromRegClass(), which hits an unreachable.
It seems sensible to handle this case, so copies from X16 and X17 work.
Copying from X17 is used in inline assembly in libunwind for pointer
authentication.
Differential Revision: https://reviews.llvm.org/D85720
Sourabh Singh Tomar [Thu, 23 Jul 2020 01:51:06 +0000 (07:21 +0530)]
[DebugInfo] Emit DW_OP_implicit_value for Floating point constants
llvm is missing support for DW_OP_implicit_value operation.
DW_OP_implicit_value op is indispensable for cases such as
optimized out long double variables.
For intro refer: DWARFv5 Spec Pg: 40 2.6.1.1.4 Implicit Location Descriptions
Consider the following example:
```
int main() {
long double ld = 3.14;
printf("dummy\n");
ld *= ld;
return 0;
}
```
when compiled with tunk `clang` as
`clang test.c -g -O1` produces following location description
of variable `ld`:
```
DW_AT_location (0x00000000:
[0x0000000000201691, 0x000000000020169b): DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_stack_value, DW_OP_bit_piece 0x10 0x40, DW_OP_stack_value)
DW_AT_name ("ld")
```
Here one may notice that this representation is incorrect(DWARF4
stack could only hold integers(and only up to the size of address)).
Here the variable size itself is `128` bit.
GDB and LLDB confirms this:
```
(gdb) p ld
$1 = <invalid float value>
(lldb) frame variable ld
(long double) ld = <extracting data from value failed>
```
GCC represents/uses DW_OP_implicit_value in these sort of situations.
Based on the discussion with Jakub Jelinek regarding GCC's motivation
for using this, I concluded that DW_OP_implicit_value is most appropriate
in this case.
Link: https://gcc.gnu.org/pipermail/gcc/2020-July/233057.html
GDB seems happy after this patch:(LLDB doesn't have support
for DW_OP_implicit_value)
```
(gdb) p ld
p ld
$1 = 3.
14000000000000012434
```
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D83560
Jonas Devlieghere [Wed, 19 Aug 2020 19:40:53 +0000 (12:40 -0700)]
[lldb] Print the load command that wasn't found in TestSimulatorPlatform
Print which load command we were looking for when the sanity check
fails:
AssertionError: 0 != 1 : wrong number of load commands for
LC_VERSION_MIN_MACOSX
Hiroshi Yamauchi [Tue, 11 Aug 2020 21:10:30 +0000 (14:10 -0700)]
[PGO][PGSO][LV] Fix loop not vectorized issue under profile guided size opts.
D81345 appears to accidentally disables vectorization when explicitly
enabled. As PGSO isn't currently accessible from LoopAccessInfo, revert back to
the vectorization with versioning-for-unit-stride for PGSO.
Differential Revision: https://reviews.llvm.org/D85784
Jonas Devlieghere [Wed, 19 Aug 2020 17:19:03 +0000 (10:19 -0700)]
[lldb] Code sign binaries with entitlements
Binaries need to be code signed with entitlements to run on device.
Differential revision: https://reviews.llvm.org/D86237
Petr Hosek [Wed, 19 Aug 2020 18:06:19 +0000 (11:06 -0700)]
[CMake] Always mark terminfo as unavailable on Windows
This addresses the issue introduced by D86134.
Differential Revision: https://reviews.llvm.org/D86234
Matt Arsenault [Fri, 31 Jul 2020 15:41:05 +0000 (11:41 -0400)]
GlobalISel: Add TargetLowering member to LegalizerHelper
Jonas Devlieghere [Wed, 19 Aug 2020 01:48:18 +0000 (18:48 -0700)]
[lldb] Extend Darwin builder to pass the ARCH_CFLAGS spec to Make.
Construct the ARCH_CFLAGS in Python rather than in Make by disassembling
the TRIPLE.
Differential revision: https://reviews.llvm.org/D85539
Florian Hahn [Wed, 19 Aug 2020 18:32:49 +0000 (19:32 +0100)]
[DSE] Remove dead argument from removePartiallyOverlappedStores (NFC).
The argument is unused and can be removed.
Matt Arsenault [Mon, 17 Aug 2020 12:50:11 +0000 (08:50 -0400)]
AMDGPU: Fix wrong type mangling in intrinsic test
The generic address space used to be 4, but the string here seems to
not matter.
Jan Korous [Tue, 14 Jul 2020 02:38:58 +0000 (19:38 -0700)]
[index-while-building] PathIndexer
Differential Revision: https://reviews.llvm.org/D66854
Matt Arsenault [Wed, 19 Aug 2020 18:06:17 +0000 (14:06 -0400)]
GlobalISel: Don't check for verifier enforced constraint
Loads are always required to have a single memory operand.
Matt Arsenault [Wed, 19 Aug 2020 17:59:11 +0000 (13:59 -0400)]
AMDGPU/GlobalISel: Remove hack for combines forming illegal extloads
Previously we weren't adding the LegalizerInfo to the post-legalizer
combiner. Since that's fixed, we don't need to try to filter out the
one case that was breaking.
Peter Collingbourne [Tue, 18 Aug 2020 20:06:41 +0000 (13:06 -0700)]
sanitizer_common: Use void* for madvise first argument on Solaris.
Differential Revision: https://reviews.llvm.org/D86166
Sanjay Patel [Wed, 19 Aug 2020 16:46:53 +0000 (12:46 -0400)]
[InstCombine] add tests for shifted xor; NFC
Matt Arsenault [Wed, 19 Aug 2020 16:10:32 +0000 (12:10 -0400)]
GlobalISel: Use Register
Petr Hosek [Wed, 19 Aug 2020 17:33:03 +0000 (10:33 -0700)]
[CMake] Fix OCaml build failure because of absolute path in system libs
D85820 introduced a full path in the LLVM_SYSTEM_LIBS property of the
LLVMSupport target, which made the OCaml bindings fail to build, since
they use -l [system_lib] flags for every lib in LLVM_SYSTEM_LIBS, which
cannot work with absolute paths.
This patch solves the issue in a similar vain as ZLIB does it: it adds
the full library path to imported_libs, and adds a stripped down version
without directories, lib prefix and lib suffix to system_libs
In the future we should probably make some changes to LLVM_SYSTEM_LIBS,
since both zlib and ncurses do not necessarily have to be system libs
anymore due to the find_package / find_library bits introduced in
D85820 and D79219.
Patch By: haampie
Differential Revision: https://reviews.llvm.org/D86134
Petr Hosek [Wed, 19 Aug 2020 17:30:32 +0000 (10:30 -0700)]
[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF
D85820 introduced a bug where LLVM_ENABLE_TERMINFO was set to true when
the library was found, even when the user had set
-DLLVM_ENABLE_TERMINFO=OFF.
Patch By: haampie
Differential Revision: https://reviews.llvm.org/D86173
Jakub Lichman [Wed, 19 Aug 2020 17:28:22 +0000 (17:28 +0000)]
[mlir][VectorToSCF] Fix of broken build - missing link to MLIRLinalgUtils
Mehdi Amini [Wed, 19 Aug 2020 17:26:36 +0000 (17:26 +0000)]
Revert "Revert "[NFC][llvm] Make the contructors of `ElementCount` private.""
Was reverted because MLIR/Flang builds were broken, these APIs have been
fixed in the meantime.
Mehdi Amini [Wed, 19 Aug 2020 17:19:49 +0000 (17:19 +0000)]
Fix flang test after MLIR API changes
Mehdi Amini [Wed, 19 Aug 2020 17:13:28 +0000 (17:13 +0000)]
Revert "[NFC][llvm] Make the contructors of `ElementCount` private."
This reverts commit
264afb9e6aebc98c353644dd0700bec808501cab.
(and dependent
6b742cc48 and
fc53bd610f)
MLIR/Flang are broken.
Jessica Paquette [Thu, 6 Aug 2020 17:40:46 +0000 (10:40 -0700)]
[GlobalISel] Add combine for (x & mask) -> x when (x & mask) == x
If we have a mask, and a value x, where (x & mask) == x, we can drop the AND
and just use x.
This is about a 0.4% geomean code size improvement on CTMark at -O3 for AArch64.
In AArch64, this is most useful post-legalization. Patterns like this often
show up when legalizing s1s, which must be extended to larger types.
e.g.
```
%cmp:_(s32) = G_ICMP ...
%and:_(s32) = G_AND %cmp, 1
```
Since G_ICMP only produces a single bit, there's no reason to mask it with the
G_AND.
Differential Revision: https://reviews.llvm.org/D85463
Jon Chesterfield [Wed, 19 Aug 2020 17:11:34 +0000 (18:11 +0100)]
[Clang] Fix BZ47169, loader_uninitialized on incomplete types
[Clang] Fix BZ47169, loader_uninitialized on incomplete types
Reported by @erichkeane. Fix proposed by @erichkeane works, tests included.
Bug introduced in D74361. Crash was on querying a CXXRecordDecl for
hasTrivialDefaultConstructor on an incomplete type. Fixed by calling
RequireCompleteType in the right place.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D85990
Caroline Concatto [Wed, 19 Aug 2020 16:53:29 +0000 (17:53 +0100)]
[clang][driver]Add quotation mark in test/fortran.f95 to avoid false positive
If a folder's name, where the test fortran.f95 is running, has cc1 the test
fails because of CHECK-ASM-NOT: cc1.
The solution used in this patch is to add quotation mark around cc1 and cc1as
because the driver returns these flags with quotation marks ("")
Reviewed By: DavidTruby, echristo
Differential Revision: https://reviews.llvm.org/D86132
Alex Zinenko [Wed, 19 Aug 2020 16:38:56 +0000 (18:38 +0200)]
[mlir] expose standard attributes to C API
Provide C API for MLIR standard attributes. Since standard attributes live
under lib/IR in core MLIR, place the C APIs in the IR library as well (standard
ops will go in a separate library).
Affine map and integer set attributes are only exposed as placeholder types
with IsA support due to the lack of C APIs for the corresponding types.
Integer and floating point attribute APIs expecting APInt and APFloat are not
exposed pending decision on how to support APInt and APFloat.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D86143
Alex Zinenko [Wed, 19 Aug 2020 16:46:53 +0000 (18:46 +0200)]
[mlir] fix build after llvm made ElementCount constructor private
The original patch (
264afb9e6aebc98c353644dd0700bec808501cab) did not
update subprojects.
Jonas Devlieghere [Wed, 19 Aug 2020 16:25:41 +0000 (09:25 -0700)]
[lldb] Add getExtraMakeArgs to Builder (NFC)
Instead of a new method for each variable any subclass might want to
set, have a method getExtraMakeArgs that each subclass can use to return
whatever extra Make arguments it wants.
As per Pavel's suggestion in D85539.
Jonas Devlieghere [Wed, 19 Aug 2020 16:08:40 +0000 (09:08 -0700)]
[lldb] Fix buildDsym signature in Builder base class
The method was missing the optional argument `testname`.
Hamilton Tobon Mosquera [Wed, 19 Aug 2020 16:03:23 +0000 (11:03 -0500)]
[OpenMPOpt][HideMemTransfersLatency] Moving the 'wait' counterpart of __tgt_target_data_begin_mapper
canBeMovedDownwards checks if the "wait" counterpart of __tgt_target_data_begin_mapper can be moved downwards, returning a pointer to the instruction that might require/modify the data transferred, and returning null it the movement is not possible or not worth it. The function splitTargetDataBeginRTC receives that returned instruction and instead of moving the "wait" it creates it at that point.
Differential Revision: https://reviews.llvm.org/D86155
Jonas Devlieghere [Wed, 19 Aug 2020 16:39:44 +0000 (09:39 -0700)]
[clang] Replace call to private ctor with ElementCount::getScalable (2/2)
Update the code for D86120 which made the constructors of `ElementCount`
private. Apparently I missed another instance in the macro just below.
Florian Hahn [Wed, 19 Aug 2020 16:37:20 +0000 (17:37 +0100)]
[docs] Clarify ENABLE_MODULES uses Clang Header Modules.
Suggested post-commit by @dblaikie, thanks!
Jonas Devlieghere [Wed, 19 Aug 2020 16:34:57 +0000 (09:34 -0700)]
[clang] Replace call to private ctor with ElementCount::getScalable
Update the code for D86120 which made the constructors of `ElementCount`
private.
Francesco Petrogalli [Mon, 17 Aug 2020 22:48:15 +0000 (22:48 +0000)]
[NFC][llvm] Make the contructors of `ElementCount` private.
Differential Revision: https://reviews.llvm.org/D86120
Stella Laurenzo [Wed, 19 Aug 2020 00:23:46 +0000 (17:23 -0700)]
Add python bindings for Type and IntegerType.
* The binding for Type is trivial and should be non-controversial.
* The way that I define the IntegerType should serve as a pattern for what I want to do next.
* I propose defining the rest of the standard types in this fashion and then generalizing for dialect types as necessary.
* Essentially, creating/accessing a concrete Type (vs interacting with the string form) is done by "casting" to the concrete type (i.e. IntegerType can be constructed with a Type and will throw if the cast is illegal).
* This deviates from some of our previous discussions about global objects but I think produces a usable API and we should go this way.
Differential Revision: https://reviews.llvm.org/D86179
Sanjay Patel [Wed, 19 Aug 2020 16:07:28 +0000 (12:07 -0400)]
[InstCombine] avoid 'tmp' names in tests; NFC
They may conflict with update_test_checks.py regexes.
Jonas Devlieghere [Wed, 19 Aug 2020 16:05:11 +0000 (09:05 -0700)]
[lldb] Move builders under lldbsuite.test as they import lldbtest (NFC)
Sanjay Patel [Wed, 19 Aug 2020 16:04:53 +0000 (12:04 -0400)]
[InstCombine] reduce code duplication; NFC
Jonas Devlieghere [Wed, 19 Aug 2020 15:27:54 +0000 (08:27 -0700)]
[lldb] Convert builders to use inheritance (NFC)
Rather than have different modules for different platforms, use
inheritance so we can have a Builer base class and optional child
classes that override platform specific methods.
Differential revision: https://reviews.llvm.org/D86174
Jakub Lichman [Wed, 19 Aug 2020 15:13:19 +0000 (15:13 +0000)]
[mlir][VectorToSCF] Bug in TransferRead lowering fixed
If Memref has rank > 1 this pass emits N-1 loops around
TransferRead op and transforms the op itself to 1D read. Since vectors
must have static shape while memrefs don't the pass emits if condition
to prevent out of bounds accesses in case some memref dimension is smaller
than the corresponding dimension of targeted vector. This logic is fine
but authors forgot to apply `permutation_map` on loops upper bounds and
thus if condition compares induction variable to incorrect loop upper bound
(dimension of the memref) in case `permutation_map` is not identity map.
This commit aims to fix that.
Jon Chesterfield [Wed, 19 Aug 2020 14:44:30 +0000 (15:44 +0100)]
[libomptarget][amdgpu] Support building with static rocm libraries
Matt Arsenault [Wed, 19 Aug 2020 14:07:57 +0000 (10:07 -0400)]
AMDGPU/GlobalISel: Add some bitcast tests
madhur13490 [Wed, 19 Aug 2020 11:18:52 +0000 (11:18 +0000)]
[NFC] Fix typo in AMDGPU doc
Reviewed By: t-tye, arsenm
Differential Revision: https://reviews.llvm.org/D86206
Matt Arsenault [Tue, 18 Aug 2020 18:45:05 +0000 (14:45 -0400)]
AMDGPU/GlobalISel: Add selection tests for pointer constants
Benjamin Kramer [Wed, 19 Aug 2020 13:59:39 +0000 (15:59 +0200)]
Make helpers static. NFC.
Roman Lebedev [Wed, 19 Aug 2020 13:52:09 +0000 (16:52 +0300)]
Revert "[InstCombine] Lower infinite combine loop detection thresholds"
And as being reported by Florian Hahn, there's a hit
in MultiSource/Benchmarks/mafft from the test-suite on X86 with -O3 -flto,
so reverting until addressed.
This reverts commit
71e0b82c9f5039cb3987c91075e78733ef044c07.
Simon Pilgrim [Wed, 19 Aug 2020 13:41:40 +0000 (14:41 +0100)]
Fix MSVC implicit truncation narrowing conversion warning.
Simon Pilgrim [Wed, 19 Aug 2020 13:34:12 +0000 (14:34 +0100)]
[X86][AVX] lowerShuffleWithVPMOV - minor refactor to more closely match lowerShuffleAsVTRUNC
Replace isBuildVectorAllZeros check by using the Zeroable bitmask instead.
Simon Pilgrim [Wed, 19 Aug 2020 13:14:44 +0000 (14:14 +0100)]
Fix unused variable warnings. NFCI.
Aaron Puchert [Wed, 19 Aug 2020 13:04:44 +0000 (15:04 +0200)]
[CodeGen] Use existing EmitLambdaVLACapture (NFC)
Xing GUO [Wed, 19 Aug 2020 13:13:46 +0000 (21:13 +0800)]
[obj2yaml] Refactor the .debug_pub* sections dumper.
It's good to reuse the DWARF parser in lib/DebugInfo so that we don't
need to maintain a separate parser in client side (obj2yaml). Besides,
A test case is added whose length field is a very huge value which makes
obj2yaml stuck when parsing the section.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D86192