Sam Clegg [Tue, 16 Jun 2020 19:23:25 +0000 (12:23 -0700)]
[lld][WebAssembly] Allow ctors functions that return values
Some projects use the constructor attribute on functions that also
return values. In this case we just ignore them.
The error was reported in the libgpg-error project that marks
gpg_err_init with the `__constructor__` attribute.
Differential Revision: https://reviews.llvm.org/D81962
Thomas Raoux [Thu, 18 Jun 2020 20:05:09 +0000 (13:05 -0700)]
[mlir][spirv] Allow mixed type cooperative matrix muladd
muladd can have differenti types for lhs/rhs and acc/destination. Change
verifier and update the test to use supported example.
Differential Revision: https://reviews.llvm.org/D82042
Jacques Pienaar [Thu, 18 Jun 2020 19:51:51 +0000 (12:51 -0700)]
[mlir][ods] Look through OpVariable for type constraint
If one uses an OpVariable (such as via Res) then the result type constraint
should be returned.
Differential Revision: https://reviews.llvm.org/D82119
Kirill Naumov [Sat, 6 Jun 2020 00:06:09 +0000 (00:06 +0000)]
[BasicBlock] Added AnnotationWriter functionality to BasicBlock class
This functionality is very similar to Function compatibility with
AnnotationWriter. This change allows us to use AnnotationWriter with
BasicBlock through BB.print() method.
Reviewed-By: apilipenko
Differntial Revision: https://reviews.llvm.org/D81321
Sanjay Patel [Thu, 18 Jun 2020 19:44:02 +0000 (15:44 -0400)]
[IRBuilder] add/use wrapper to create a generic compare based on predicate type; NFC
The predicate can always be used to distinguish between icmp and fcmp,
so we don't need to keep repeating this check in the callers.
Eric Christopher [Thu, 18 Jun 2020 19:36:34 +0000 (12:36 -0700)]
Add SveBFloat16 to type switch.
Matt Arsenault [Thu, 28 May 2020 15:33:15 +0000 (11:33 -0400)]
AMDGPU: Add IntrWillReturn to intrinsic definitions
This should probably be implied for all the speculatable ones. I think
the only ones where this plausibly doesn't apply is s_sendmsghalt and
maybe kill.
Davide Italiano [Thu, 18 Jun 2020 19:33:02 +0000 (12:33 -0700)]
[SimplifyCFG] Update debug location when folding branch to common destination
Sometimes a dead block gets folded and the debug information is still
retained. This manifests as jumpy stepping in lldb, see the bugzilla PR
for an end-to-end C testcase.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46008
Differential Revision: https://reviews.llvm.org/D82062
Eduardo Caldas [Thu, 18 Jun 2020 18:41:43 +0000 (20:41 +0200)]
Add support for DeclRefExpr in SyntaxTree, by generating IdExpressions
Reviewers: gribozavr2
Reviewed By: gribozavr2
Subscribers: hlopko, gribozavr2, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81168
Christopher Ferris [Thu, 18 Jun 2020 18:18:16 +0000 (11:18 -0700)]
[scudo][standalone] Allow Primary allocations to fail up multiple times.
Summary:
When enabling some malloc debug features on Android, multiple 32 bit
regions become exhausted, and the allocations fail. Allow allocations
to keep trying each bigger class in the Primary until it finds a fit.
In addition, some Android tests running on 32 bit fail sometimes due
to a running out of space in two regions, and then fail the allocation.
Reviewers: cryptoad
Reviewed By: cryptoad
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D82070
Michael Liao [Tue, 9 Jun 2020 19:07:08 +0000 (15:07 -0400)]
[TTI] Expose isNoopAddrSpaceCast in TTI.
Reviewers: arsenm
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82025
Louis Dionne [Thu, 18 Jun 2020 18:04:01 +0000 (14:04 -0400)]
[libc++] Add a dummy CMake file to include runtime subprojects
Add a simple CMakeLists.txt to build the runtimes in lockstep without
building all of LLVM. See [1] for details.
[1]: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142384.html
peter klausler [Wed, 17 Jun 2020 23:56:28 +0000 (16:56 -0700)]
[flang] Fix build problems on osx
Summary:
Fix build problems encountered on osx in two files.
The one in character.cpp fixes a legitimate bug that
elicited a valid warning.
Reviewers: tskeith, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby
Reviewed By: tskeith, PeteSteinfeld
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D82107
serge-sans-paille [Thu, 4 Jun 2020 21:35:25 +0000 (23:35 +0200)]
Fix return status of LoopDistribute
Move code that may update the IR after precondition, so that if precondition
fail, the IR isn't modified.
Differential Revision: https://reviews.llvm.org/D81225
Matt Arsenault [Thu, 28 May 2020 04:11:26 +0000 (00:11 -0400)]
AMDGPU: Remove mayLoad/mayStore from some side effecting intrinsics
These don't really modify any memory, and should not expect memory
operands.
Siva Chandra Reddy [Mon, 8 Jun 2020 18:11:49 +0000 (11:11 -0700)]
[libc] Add implementations long double fabsl and truncl functions.
Current implementations of single precision and double precision
floating point operations operate on bits of the integer type of
same size. The code made use of magic masks which were listed as
literal integer values. This is not possible in the case of long
double type as the mantissa of quad-precision long double type used
on non-x86 architectures is wider that the widest integer type for
which we can list literal values. So, in this patch, to avoid
using magic masks specified with literal values, we use packed
bit-field struct types and let the compiler generate the masks.
This new scheme allows us to implement long double flavors of the
various floating point operations. To keep the size of the patch
small, only the implementations of fabs and trunc have been
switched to the new scheme. In following patches, all exisiting
implementations will be switched to the new scheme.
Reviewers: asteinhauser
Differential Revision: https://reviews.llvm.org/D82036
aartbik [Thu, 18 Jun 2020 17:48:56 +0000 (10:48 -0700)]
[mlir] [VectorOps] remove print_i1 from runtime support library
Summary:
The "i1" (viz. bool) type does not have a proper equivalent on the "C"
size. So, to avoid any ABIs issues, we simply use print_i32 on an i32
value of one or zero for true and false. This has the added advantage
that one less function needs to be implemented when porting the runtime
support library.
Reviewers: ftynse, bkramer, nicolasvasilache
Reviewed By: ftynse
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D82048
Martijn Vels [Thu, 18 Jun 2020 17:14:02 +0000 (13:14 -0400)]
Optimize 'construct at end' loops in vector
Summary:
This change adds local 'end' and 'pos' variables for the main loop inmstead of using the ConstructTransaction variables directly.
We observed that not all vector initialization and resize operations got properly vectorized, i.e., (partially) unrolled into XMM stores for floats.
For example, `vector<int32_t> v(n, 1)` gets vectorized, but `vector<float> v(n, 1)`. It looks like the compiler assumes the state is leaked / aliased in the latter case (unclear how/why for float, but not for int32), and because of this fails to see vectorization optimization?
See https://gcc.godbolt.org/z/UWhiie
By using a local `__new_end_` (fixed), and local `__pos` (copied into __tx.__pos_ per iteration), we offer the compiler a clean loop for unrolling.
A demonstration can be seen in the isolated logic in https://gcc.godbolt.org/z/KoCNWv
The com
Reviewers: EricWF, #libc!
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D82111
Hanhan Wang [Mon, 15 Jun 2020 17:26:32 +0000 (10:26 -0700)]
[mlir] Add support for lowering tanh to LLVMIR.
Summary:
Fixed build of D81618
Add a pattern for expanding tanh op into exp form.
A `tanh` is expanded into:
1) 1-exp^{-2x} / 1+exp^{-2x}, if x => 0
2) exp^{2x}-1 / exp^{2x}+1 , if x < 0.
Differential Revision: https://reviews.llvm.org/D82040
Daniel Grumberg [Thu, 18 Jun 2020 17:10:08 +0000 (18:10 +0100)]
[NFC][TableGen] Fix some clang-tidy warnings
Alexey Bataev [Thu, 18 Jun 2020 17:29:33 +0000 (13:29 -0400)]
[OPENMP][DOCS]Update status of supported constructs, NFC.
Ties Stuij [Tue, 16 Jun 2020 16:45:57 +0000 (17:45 +0100)]
[ARM][bfloat] Do not coerce bfloat arguments and returns to integers
Summary:
As part of moving the argument lowering handling for bfloat arguments and
returns to the backend, this patch removes the code that was responsible for
handling the coercion of those arguments in Clang's Codegen.
Subscribers: kristof.beyls, danielkiss, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81837
Alexey Bataev [Wed, 17 Jun 2020 15:02:49 +0000 (11:02 -0400)]
[OPENMP]Fix PR46357: Do not allow types declarations in pragmas.
Summary:
Compiler may erroneously treat current context in OpenMP pragmas as the
context where new type declaration/definition is allowed. But the
declartation/definition of the new types in OpenMP pragmas should not be
allowed.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82019
Hiroshi Yamauchi [Wed, 17 Jun 2020 19:35:33 +0000 (12:35 -0700)]
[HIP] Improve check patterns to avoid test failures in case string "opt",
etc. happens to be in the InstallDir path in the -### output.
Differential Revision: https://reviews.llvm.org/D82046
Stanislav Mekhanoshin [Tue, 16 Jun 2020 22:15:15 +0000 (15:15 -0700)]
[AMDGPU] Added new encoding to getMCOpcodeGen
Nothing breaks yet, but all encodings shall be in the map.
Differential Revision: https://reviews.llvm.org/D81974
Alex Richardson [Thu, 18 Jun 2020 16:07:49 +0000 (17:07 +0100)]
[libc++] Don't override LIBCXX_CXX_ABI_INCLUDE_PATHS for libcxxrt
When testing libc++ for our cross-compiled CheriBSD target we specify an
explicit LIBCXX_CXX_ABI_INCLUDE_PATHS for libcxxrt. The hardcoded path
/usr/include/c++/v1 was introduced in
61e89737c5daf7b65341936f88f68efb680cdcd4
and overrides any value passed on the CMake command line. Fix this by using
it as a fallback rather than a fixed default value.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D82095
Alex Richardson [Thu, 18 Jun 2020 14:11:08 +0000 (15:11 +0100)]
[update_cc_test_checks.py] Handle C++ methods
Previously the script only handled C input, this change extends the JSON
parsing to to also include C++ function types such as methods, constructors
and destructors.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D80914
Alex Richardson [Thu, 18 Jun 2020 14:10:54 +0000 (15:10 +0100)]
[update_cc_test_checks.py] Correctly skip function definitions
Function declarations can in fact have an 'inner' node that lists the
ParmVarDecls. It seems like either the JSON output has changed or that I
tested the original JSON parsing change with test files that only have
function definitions without arguments.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D80913
Cullen Rhodes [Thu, 18 Jun 2020 16:42:22 +0000 (16:42 +0000)]
vim: add `bfloat` keyword
Highlight the `bfloat` type introduced in D78190.
Arthur Eubanks [Mon, 1 Jun 2020 20:32:15 +0000 (13:32 -0700)]
[GlobalOpt] Remove preallocated calls when possible
When possible (e.g. internal linkage), strip preallocated attribute off
parameters/arguments.
This requires removing the "preallocated" operand bundle from the call
site, replacing @llvm.call.preallocated.arg() with an alloca and a
bitcast to i8*, and removing the @llvm.call.preallocated.setup(). Since
@llvm.call.preallocated.arg() can be called multiple times with the same
arg index, we create an alloca per arg index.
We add a @llvm.stacksave() where the @llvm.call.preallocated.setup() was
and a @llvm.stackrestore() after the preallocated call to prevent the
stack from blowing up. This is valid because the argument would normally
not exist on the stack after the call before the transformation.
This does not currently handle all possible preallocated calls. We will
need to figure out where to put @llvm.stackrestore() in the cases where
there is no obvious place to put it, for example conditional
preallocated calls, invokes.
This sort of transformation may need to be moved to somewhere more
accessible to accomodate similar transformations (like inlining) in the
future.
Reviewers: efriedma, hans
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80951
Francesco Petrogalli [Mon, 15 Jun 2020 20:48:13 +0000 (20:48 +0000)]
[llvm][SveEmitter] Emit the bfloat version of `svld1ro`.
Summary:
The new SVE builtin type __SVBFloat16_t` is used to represent scalable
vectors of bfloat elements.
Reviewers: sdesmalen, efriedma, stuij, ctetreau, shafik, rengolin
Subscribers: tschuett, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81304
Roman Lebedev [Thu, 18 Jun 2020 16:29:23 +0000 (19:29 +0300)]
[NFC][IndVarSimplify] Test: replacing IV user with unsafe loop-invariant (PR45360)
https://bugs.llvm.org/show_bug.cgi?id=45360
This is reduced from the (runnable) test provided in the bug report.
The remainder operation is originally guarded, it never divides by zero.
Indvars should not make it execute unconditionally.
This is not a great test, running whole -O2 is fragile,
but i really don't understand why running -indvars on the IR before
that tranform happens doesn't work.
Alexey Bataev [Wed, 17 Jun 2020 16:52:37 +0000 (12:52 -0400)]
[OPENMP50]Allow nonmonotonic modifier for all schedule kinds.
Summary:
According to OpenMP 5.0, nonmonotonic modifier can be used with all
schedule kinds, not only dynamic and guided as in OpenMP 4.5.
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82026
Tobias Bosch [Fri, 5 Jun 2020 23:19:23 +0000 (16:19 -0700)]
[Dexter] Add --source-dir-root flag
Summary:
This allows to run dexter tests with separately compiled
binaries that are specified via --binary if the source file
location changed between compilation and dexter test run.
Reviewers: TWeaver, jmorse, probinson, #debug-info
Reviewed By: jmorse
Subscribers: #debug-info, cmtice, llvm-commits
Tags: #llvm, #debug-info
Differential Revision: https://reviews.llvm.org/D81319
Alexandros Lamprineas [Thu, 18 Jun 2020 14:40:23 +0000 (15:40 +0100)]
[ARM] Basic bfloat support
This patch adds basic support for BFloat in the Arm backend.
For now the code generation relies on fullfp16 being present.
Briefly:
* adds the bfloat scalar and vector types in the necessary register classes,
* adjusts the calling convention to cope with bfloat argument passing and return,
* adds codegen patterns for moves, loads and stores.
It's tested mostly by the intrinsic patches that depend on it (load/store, convert/copy).
The following people contributed to this patch:
* Alexandros Lamprineas
* Ties Stuij
Differential Revision: https://reviews.llvm.org/D81373
Amara Emerson [Wed, 17 Jun 2020 18:13:22 +0000 (11:13 -0700)]
[docs] Clarify semantics of ordered fadd/fmul reductions.
Differential Revision: https://reviews.llvm.org/D82034
Alexey Bataev [Tue, 9 Jun 2020 15:55:25 +0000 (11:55 -0400)]
[OPENMP50]Codegen for scan directives in parallel for regions.
Summary:
Added codegen for scan directives in parallel for regions.
Emits the code for the directive with inscan reductions.
Original code:
```
#pragma omp parallel for reduction(inscan, op : ...)
for() {
<input phase>;
#pragma omp scan (in)exclusive(...)
<scan phase>
}
```
is transformed to something:
```
#pragma omp parallel
{
size num_iters = <num_iters>;
<type> buffer[num_iters];
#pragma omp for
for (i: 0..<num_iters>) {
<input phase>;
buffer[i] = red;
}
#pragma omp barrier
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
buffer[i] op= buffer[i-pow(2,k)];
#pragma omp for
for (0..<num_iters>) {
red = InclusiveScan ? buffer[i] : buffer[i-1];
<scan phase>;
}
}
```
Reviewers: jdoerfert
Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81478
Pete Steinfeld [Thu, 18 Jun 2020 14:05:08 +0000 (07:05 -0700)]
[flang] Fix crash with alternate returns in modules
Summary:
We weren't handling the case of subroutines with alternate returns that
are contained in modules. I changed the code to add an `*` as the name
of the parameter when creating the `.mod` file.
Reviewers: tskeith, klausler, DavidTruby
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82096
Saleem Abdulrasool [Thu, 18 Jun 2020 15:51:44 +0000 (08:51 -0700)]
unwind: EHABISectionIterator `operator!=`, constify `operator-`
Add missing `operator!=` and make `operator-` const for
`EHABISectionIterator`. This repairs the build of libunwind when
building with GCC.
Patch by Chad Duffin!
Reviewed By: compnerd, libunwind
Differential Revision: https://reviews.llvm.org/D81597
Simon Pilgrim [Thu, 18 Jun 2020 15:40:51 +0000 (16:40 +0100)]
[TargetLowering] SimplifyMultipleUseDemandedBits - drop already extended ISD::SIGN_EXTEND_INREG nodes.
If the source of the SIGN_EXTEND_INREG node is already sign extended, use the source directly.
Nico Weber [Thu, 18 Jun 2020 15:31:41 +0000 (11:31 -0400)]
fix a typo to cycle bots
Hans Wennborg [Thu, 18 Jun 2020 15:12:43 +0000 (17:12 +0200)]
Don't require shell in clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_adda.c
rm works fine without it.
hyd-dev [Thu, 18 Jun 2020 15:12:36 +0000 (16:12 +0100)]
[clang-tidy] Add --use-color command line option and UseColor option to control colors in diagnostics
This patch adds `--use-color` command line option and `UseColor` option to clang-tidy to control colors in diagnostics. With these options, users can force colorful output. This is useful when using clang-tidy with parallelization command line tools (like ninja and GNU parallel), as they often pipe clang-tidy's standard output and make the colors disappear.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D79477
Matt Arsenault [Thu, 18 Jun 2020 12:39:13 +0000 (08:39 -0400)]
AMDGPU: Don't pass MachineFunction if only the IR Function is used
Ayke van Laethem [Sun, 19 Apr 2020 00:22:06 +0000 (02:22 +0200)]
[AVR] Fix miscompilation of zext + add
Code like the following:
define i32 @foo(i32 %a, i1 zeroext %b) addrspace(1) {
entry:
%conv = zext i1 %b to i32
%add = add nsw i32 %conv, %a
ret i32 %add
}
Would compile to the following (incorrect) code:
foo:
mov r18, r20
clr r19
add r22, r18
adc r23, r19
sbci r24, 0
sbci r25, 0
ret
Those sbci instructions are clearly wrong, they should have been adc
instructions.
This commit improves codegen to use adc instead:
foo:
mov r18, r20
clr r19
ldi r20, 0
ldi r21, 0
add r22, r18
adc r23, r19
adc r24, r20
adc r25, r21
ret
This code is not optimal (it could be just 5 instructions instead of the
current 9) but at least it doesn't miscompile.
Differential Revision: https://reviews.llvm.org/D78439
Nathan James [Thu, 18 Jun 2020 14:50:15 +0000 (15:50 +0100)]
[clang-tidy] RenamerClangTidy group redecls into 1 warning.
This changes the behavious of `RenamerClangTidyCheck` based checks by grouping declarations of the same thing into 1 warning where it is first declared.
This cleans up clang-tidy output and prevents issues where 1 fix-it couldn't be applied, yet all other warnings(and fix-its) for the same declaration would be applied.
The old behaviour of forward declaring a class without defining it isn't affected, i.e. no warnings will be emitted for that case.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D82059
Matt Arsenault [Thu, 18 Jun 2020 14:20:43 +0000 (10:20 -0400)]
Lanai: Remove unused method
This was depending on the MachineFunction at MachineFunctionInfo
construction, which will soon be disallowed.
Simon Pilgrim [Thu, 18 Jun 2020 13:22:02 +0000 (14:22 +0100)]
[X86][SSE] Fold MOVMSK(PCMPEQ(X,0)) == -1 -> PTESTZ(X,X)
Allow combineSetCCMOVMSK to handle 'allof' X == 0 patterns to be replaced with PTESTZ
This is a preliminary patch before properly handling PR35129
Christopher Di Bella [Thu, 18 Jun 2020 14:17:57 +0000 (10:17 -0400)]
[libc++] Add equality for spaceship types for themselves
- Adds operator==(partial_ordering, partial_ordering)
- Adds operator==(weak_ordering, weak_ordering)
- Adds operator==(strong_ordering, strong_ordering)
Differential Revision: https://reviews.llvm.org/D81823
Michael Park [Tue, 16 Jun 2020 22:15:10 +0000 (15:15 -0700)]
[libcxx/variant] Fix build error for when exceptions disabled.
Reviewers: #libc!
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D81973
Alexandre Ganea [Thu, 18 Jun 2020 14:07:18 +0000 (10:07 -0400)]
Fix linker error in clang-fuzzer following
89ea0b05207d45c145fb525df554b3b986ae379b.
This fixes:
tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o:handle_cxx.cpp:function clang_fuzzer::HandleCXX(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, std::vector<char const*, std::allocator<char const*> > const&): error: undefined reference to 'clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'
Alexandre Ganea [Thu, 18 Jun 2020 14:02:02 +0000 (10:02 -0400)]
[CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string.
Previously, the DIA SDK didn't like the empty reference in the 'pdb' entry.
Louis Dionne [Fri, 12 Jun 2020 19:19:55 +0000 (15:19 -0400)]
[libc++] Allow specifying custom Lit config files
Before this patch, the libc++ test suite first loads lit.site.cfg
(generated by CMake), and then lit.cfg. It's also possible to load
lit.cfg before lit.site.cfg and to point to a custom lit.site.cfg
file using '--param=libcxx_site_config'. However, in that case, lit.cfg
still relies on the site configuration filling up the 'config' object
like the default lit.site.cfg file does, which isn't flexible enough.
This commit simplifies the setup by having just a single Lit site config
file per CMake configuration, and always loading exactly that config file.
However, the config file to use can be selected when setting up CMake via
the LIBCXX_TEST_CONFIG setting. Furthermore, the site configs are entirely
standalone, which means that a new site config can be added that doesn't
need to conform what's expected by config.py.
Differential Revision: https://reviews.llvm.org/D81846
Kamlesh Kumar [Thu, 18 Jun 2020 13:46:54 +0000 (19:16 +0530)]
[RISCV64] Emit correct lib call for fp(float/double) to ui/si
Since i32 is not legal in riscv64,
it always promoted to i64 before emitting lib call and
for conversions like float/double to int and float/double to unsigned int
wrong lib call was emitted. This commit fix it using custom lowering.
Differential Revision: https://reviews.llvm.org/D80526
Jean-Michel Gorius [Thu, 18 Jun 2020 13:31:13 +0000 (15:31 +0200)]
[llvm][docs] Document the LLVM_INSTALL_UTILS CMake option (NFC)
Igor Kudrin [Thu, 18 Jun 2020 13:15:55 +0000 (20:15 +0700)]
[MC] Rename a misnamed function. NFC.
The patch renames MakeStartMinusEndExpr() to makeEndMinusStartExpr() to
better reflect an expression it creates and fix a naming style issue.
Differential Revision: https://reviews.llvm.org/D82079
Alexandre Ganea [Thu, 18 Jun 2020 13:16:59 +0000 (09:16 -0400)]
[CodeView] Add full repro to LF_BUILDINFO record
This patch adds some missing information to the LF_BUILDINFO which allows for rebuilding an .OBJ without any external dependency but the .OBJ itself (other than the compiler executable).
Some tools need this information to reproduce a build without any knowledge of the build system. The LF_BUILDINFO therefore stores a full path to the compiler, the PWD (which is the CWD at program startup), a relative or absolute path to the TU, and the full CC1 command line. The command line needs to be freestanding (not depend on any environment variable). In the same way, MSVC doesn't store the provided command-line, but an expanded version (somehow their equivalent of CC1) which is also freestanding.
For more information see PR36198 and D43002.
Differential Revision: https://reviews.llvm.org/D80833
Alexandre Ganea [Thu, 18 Jun 2020 12:57:50 +0000 (08:57 -0400)]
[MC] Pass down argv0 & cc1 cmd-line to the back-end and store in MCTargetOptions
When targetting CodeView, the goal is to store argv0 & cc1 cmd-line in the emitted .OBJ, in order to allow a reproducer from the .OBJ alone.
This patch is to simplify https://reviews.llvm.org/D80833
Alexandre Ganea [Thu, 18 Jun 2020 12:21:39 +0000 (08:21 -0400)]
[CodeView] Add TypeCollection::replaceType to replace type records post-merging
The API is not called in this patch. This is to simply/support https://reviews.llvm.org/D80833
Alexandre Ganea [Wed, 17 Jun 2020 22:33:18 +0000 (18:33 -0400)]
[Clang] Move clang::Job::printArg to llvm::sys::printArg. NFCI.
This patch is to support/simplify https://reviews.llvm.org/D80833
Yaxun (Sam) Liu [Fri, 12 Jun 2020 03:24:50 +0000 (23:24 -0400)]
[HIP] Fix rocm not found on rocm3.5
Currently rocm detector expects device library bitcodes named as *.bc
instead of *.amdgcn.bc. However in rocm3.5 the device library bitcodes
are named as *.amdgcn.bc, which causes rocm3.5 not detected.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D81713
Bruno Ricci [Thu, 18 Jun 2020 12:02:11 +0000 (13:02 +0100)]
[clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests
An AST serialization dump test is a test which compares the output of -ast-dump
on the source and of -ast-dump-all on a PCH generated from the source. Modulo
a few differences the outputs should match.
This patch to make-ast-dump-check.sh enables automatically generating
these tests.
Differential Revision: https://reviews.llvm.org/D81786
Reviewed By: aaron.ballman, lebedev.ri
Bruno Ricci [Thu, 18 Jun 2020 11:51:11 +0000 (12:51 +0100)]
[clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody
The body of LambdaExpr is currently not properly serialized. Instead
LambdaExpr::getBody checks if the body has been already deserialized and if
not mutates LambdaExpr. This can be observed with an AST dump test, where
the body of the LambdaExpr will be null.
The mutation in LambdaExpr::getBody was left because of another bug: it is not
true that the body of a LambdaExpr is always a CompoundStmt; it can also be
a CoroutineBodyStmt wrapping a CompoundStmt. This is fixed by returning a
Stmt * from getBody and introducing a convenience function getCompoundStmtBody
which always returns a CompoundStmt *. This function can be used by callers who
do not care about the coroutine node.
Happily all but one user of getBody treat it as a Stmt * and so this change
is non-intrusive.
Differential Revision: https://reviews.llvm.org/D81787
Reviewed By: aaron.ballman
Florian Hahn [Thu, 18 Jun 2020 12:33:14 +0000 (13:33 +0100)]
[Matrix] Pass darwin tripe to SeamObjc test to fix windows bot failure.
Without the triple, the test fails on a windows bot
(http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/16531/steps/stage%201%20check/logs/stdio)
because of different full type widths (unsigned long long vs unsigned long)
Florian Hahn [Thu, 18 Jun 2020 12:06:00 +0000 (13:06 +0100)]
[Matrix] Use alignment info when lowering loads/stores.
This patch updates LowerMatrixIntrinsics to preserve the alignment
specified at the original load/stores and the align attribute for the
pointer argument of the column.major.load/store intrinsics.
We can always use the specified alignment for the load of the first
column. For subsequent columns, the alignment may need to be reduced.
For ConstantInt strides, compute the offset for the start of the column in
bytes and use commonAlignment to get the largest valid alignment.
For non-ConstantInt strides, we need to take the common alignment of the
initial alignment and the element size in bytes.
Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, rjmccall
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D81960
David Sherwood [Thu, 28 May 2020 10:29:26 +0000 (11:29 +0100)]
[SVE] Add checks for no warnings in SVE tests
There are now quite a few SVE tests in LLVM and Clang that do not
emit warnings related to invalid use of EVT::getVectorNumElements()
and VectorType::getNumElements(). For these tests I have added
additional checks that there are no warnings in order to prevent
any future regressions.
Differential Revision: https://reviews.llvm.org/D80712
Lucas Prates [Tue, 9 Jun 2020 08:52:01 +0000 (09:52 +0100)]
[ARM][Clang] Removing lowering of half-precision FP arguments and returns from Clang's CodeGen
Summary:
On the process of moving the argument lowering handling for
half-precision floating point arguments and returns to the backend, this
patch removes the code that was responsible for handling the coercion of
those arguments in Clang's Codegen.
Reviewers: rjmccall, chill, ostannard, dnsampaio
Reviewed By: ostannard
Subscribers: stuij, kristof.beyls, dmgreen, danielkiss, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81451
Lucas Prates [Fri, 5 Jun 2020 12:23:30 +0000 (13:23 +0100)]
[ARM] Moving CMSE handling of half arguments and return to the backend
Summary:
As half-precision floating point arguments and returns were previously
coerced to either float or int32 by clang's codegen, the CMSE handling
of those was also performed in clang's side by zeroing the unused MSBs
of the coercer values.
This patch moves this handling to the backend's calling convention
lowering, making sure the high bits of the registers used by
half-precision arguments and returns are zeroed.
Reviewers: chill, rjmccall, ostannard
Reviewed By: ostannard
Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D81428
Lucas Prates [Tue, 9 Jun 2020 08:45:47 +0000 (09:45 +0100)]
[ARM] Supporting lowering of half-precision FP arguments and returns in AArch32's backend
Summary:
Half-precision floating point arguments and returns are currently
promoted to either float or int32 in clang's CodeGen and there's
no existing support for the lowering of `half` arguments and returns
from IR in AArch32's backend.
Such frontend coercions, implemented as coercion through memory
in clang, can cause a series of issues in argument lowering, as causing
arguments to be stored on the wrong bits on big-endian architectures
and incurring in missing overflow detections in the return of certain
functions.
This patch introduces the handling of half-precision arguments and returns in
the backend using the actual "half" type on the IR. Using the "half"
type the backend is able to properly enforce the AAPCS' directions for
those arguments, making sure they are stored on the proper bits of the
registers and performing the necessary floating point convertions.
Reviewers: rjmccall, olista01, asl, efriedma, ostannard, SjoerdMeijer
Reviewed By: ostannard
Subscribers: stuij, hiraditya, dmgreen, llvm-commits, chill, dnsampaio, danielkiss, kristof.beyls, cfe-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D75169
Paul Walker [Fri, 13 Dec 2019 15:03:17 +0000 (15:03 +0000)]
[SVE] Add flag to specify SVE register size, using this to calculate legal vector types.
Adds aarch64-sve-vector-bits-{min,max} to allow the size of SVE
data registers (in bits) to be specified. This allows the code
generator to make assumptions it normally couldn't. As a starting
point this information is used to mark fixed length vector types
that can fit within the specified size as legal.
Reviewers: rengolin, efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80384
Sameer Sahasrabuddhe [Thu, 18 Jun 2020 12:09:20 +0000 (17:39 +0530)]
[DA] conservatively mark the join of every divergent branch
For a loop, a join block is a block that is reachable along multiple
disjoint paths from the exiting block of a loop. If the exit condition
of the loop is divergent, then such join blocks must also be marked
divergent. This currently fails in some cases because not all join
blocks are identified correctly.
The workaround is to conservatively mark every join block of any
branch (not necessarily the exiting block of a loop) as divergent.
https://bugs.llvm.org/show_bug.cgi?id=46372
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D81806
Hans Wennborg [Thu, 18 Jun 2020 12:06:55 +0000 (14:06 +0200)]
Make matrix-type-builtins.m pass also on platforms where the type is 'unsigned long long'
Tres Popp [Tue, 9 Jun 2020 09:33:43 +0000 (11:33 +0200)]
[mlir] Add a pass to remove all shape.cstr_ and assuming_ ops.
Summary:
This is to provide a utility to remove unsupported constraints or for
pipelines that happen to receive these but cannot lower them due to not
supporting assertions.
Differential Revision: https://reviews.llvm.org/D81560
Florian Hahn [Thu, 18 Jun 2020 11:14:19 +0000 (12:14 +0100)]
[Matrix] Preserve volatile when loading loads/stores.
Currently the matrix lowering turns volatile loads/stores into
non-volatile ones. This patch updates the lowering to preserve the
volatile bit.
Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, nicolasvasilache
Reviewed By: anemet
Differential Revision: https://reviews.llvm.org/D81498
Florian Hahn [Thu, 18 Jun 2020 09:49:56 +0000 (10:49 +0100)]
[Matrix] Add __builtin_matrix_column_store to Clang.
This patch add __builtin_matrix_column_major_store to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.
Reviewers: rjmccall, jfb, rsmith, Bigcheese
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D72782
Sander de Smalen [Thu, 18 Jun 2020 09:08:25 +0000 (10:08 +0100)]
[SveEmitter] Add builtins to insert/extract subvectors from tuples (svget/svset)
For example:
svint32_t svget4(svint32x4_t tuple, uint64_t imm_index)
returns the subvector at `index`, which must be in range `0..3`.
svint32x3_t svset3(svint32x3_t tuple, uint64_t index, svint32_t vec)
returns a tuple vector with `vec` inserted into `tuple` at `index`,
which must be in range `0..2`.
Reviewers: c-rhodes, efriedma
Reviewed By: c-rhodes
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81464
Hans Wennborg [Thu, 18 Jun 2020 09:59:42 +0000 (11:59 +0200)]
Try to remove the acle_sve_adda.s file that's breaking tests
Jean-Michel Gorius [Thu, 18 Jun 2020 09:58:07 +0000 (11:58 +0200)]
[mlir] NFC: Fix link in traits documentation
Jeremy Morse [Thu, 18 Jun 2020 09:54:09 +0000 (10:54 +0100)]
[NFC][LiveDebugValues] Document how LiveDebugValues operates
We're missing a plain English explanation of how this pass is supposed
to operate -- add one to the file comment.
Differential Revision: https://reviews.llvm.org/D80929
Florian Hahn [Thu, 18 Jun 2020 09:06:38 +0000 (10:06 +0100)]
[Matrix] Add __builtin_matrix_column_load to Clang.
This patch add __builtin_matrix_column_major_load to Clang,
as described in clang/docs/MatrixTypes.rst. In the initial version,
the stride is not optional yet.
Reviewers: rjmccall, rsmith, jfb, Bigcheese
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D72781
Alex Zinenko [Wed, 17 Jun 2020 14:46:45 +0000 (16:46 +0200)]
[mlir] Provide OpBuilder-based replacements for edsc::BlockBuilder
The ScopedBuilder class in EDSC is being gradually phased out in favor of core
OpBuilder-based helpers with callbacks. Provide helper functions that are
compatible with `edsc::ScopedContext` and can be used to create and populate
blocks using callbacks that take block arguments as callback arguments. This
removes the need for `edsc::BlockHandle`, forward-declaration of `Value`s used
for block arguments and the tag `edsc::Append` class, leading to noticable
reduction in the verbosity of the code using helper functions.
Remove "eager mode" construction tests that are only relevant to the
`BlockBuilder`-based approach.
`edsc::BlockHandle` and `edsc::BlockBuilder` are now deprecated and will be
removed soon.
Differential Revision: https://reviews.llvm.org/D82008
lorenzo chelini [Thu, 18 Jun 2020 09:32:09 +0000 (11:32 +0200)]
[MLIR][Linalg] Retire C++ MatvecOp in favor of a linalg-ods-gen'd op
Replace C++ MatvecOp, now that DRR rules have been dropped.
Differential Revision: https://reviews.llvm.org/D82007
Ayke van Laethem [Tue, 16 Jun 2020 19:39:09 +0000 (21:39 +0200)]
[AVR] Implement disassembly of 32-bit instructions
This needed two fixes:
* 32-bit instructions were read in the wrong order. The machine code
swaps the two 16-bit instruction words, which wasn't undone when
decoding instructions.
* Jump and call instructions don't encode the lowest address bit,
which is always zero. Therefore, the address needed to be shifted by
one to fix that.
Differential Revision: https://reviews.llvm.org/D81961
Sander de Smalen [Thu, 18 Jun 2020 08:36:40 +0000 (09:36 +0100)]
[SveEmitter] Add builtins for tuple creation (svcreate2/svcreate3/etc)
The svcreate builtins allow constructing a tuple from individual vectors, e.g.
svint32x2_t svcreate2(svint32_t v2, svint32_t v2)`
Reviewers: c-rhodes, david-arm, efriedma
Reviewed By: c-rhodes, efriedma
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81463
Guillaume Chatelet [Thu, 18 Jun 2020 08:59:34 +0000 (08:59 +0000)]
[Clang][Sema] Use of incorrect __has_feature vs __has_builtin
Florian Hahn [Tue, 9 Jun 2020 15:25:11 +0000 (16:25 +0100)]
[Matrix] Add volatile load/store tests (NFC).
David Sherwood [Thu, 11 Jun 2020 06:47:23 +0000 (07:47 +0100)]
[CodeGen] Fix warnings in getVectorTypeBreakdown
Added NextPowerOf2() routine to TypeSize and rewritten the code
in getVectorTypeBreakdown to avoid warnings being generated.
Differential Revision: https://reviews.llvm.org/D81578
Florian Hahn [Thu, 18 Jun 2020 08:30:41 +0000 (09:30 +0100)]
[Matrix] Update load/store intrinsics.
This patch adjust the load/store matrix intrinsics, formerly known as
llvm.matrix.columnwise.load/store, to improve the naming and allow
passing of extra information (volatile).
The patch performs the following changes:
* Rename columnwise.load/store to column.major.load/store. This is more
expressive and also more in line with the naming in Clang.
* Changes the stride arguments from i32 to i64. The stride can be
larger than i32 and this makes things more uniform with the way
things are handled in Clang.
* A new boolean argument is added to indicate whether the load/store
is volatile. The lowering respects that when emitting vector
load/store instructions
* MatrixBuilder is updated to require both Alignment and IsVolatile
arguments, which are passed through to the generated intrinsic. The
alignment is set using the `align` attribute.
The changes are grouped together in a single patch, to have a single
commit that breaks the compatibility. We probably should be fine with
updating the intrinsics, as we did not yet officially support them in
the last stable release. If there are any concerns, we can add
auto-upgrade rules for the columnwise intrinsics though.
Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor, LuoYuanke, nicolasvasilache, rjmccall, ftynse
Reviewed By: anemet, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D81472
David Sherwood [Tue, 16 Jun 2020 13:12:38 +0000 (14:12 +0100)]
[CodeGen] Fix warnings in foldCONCAT_VECTORS
Instead of asserting the number of elements is the same, we should be
comparing the element counts instead. In addition, when looking at
concats of extract_subvectors it's fine to use getVectorMinNumElements()
for scalable vectors.
I discovered these warnings when compiling the structured loads tests in
this file:
test/CodeGen/AArch64/sve-intrinsics-loads.ll
Differential Revision: https://reviews.llvm.org/D81936
serge-sans-paille [Mon, 15 Jun 2020 10:21:05 +0000 (12:21 +0200)]
Correctly report modified status for HWAddressSanitizer
Differential Revision: https://reviews.llvm.org/D81238
Pierre Oechsel [Thu, 18 Jun 2020 08:21:53 +0000 (10:21 +0200)]
[mlir] [Vector] Add missing edsc intrinsics.
Differential Revision: https://reviews.llvm.org/D81934
David Sherwood [Tue, 16 Jun 2020 16:00:12 +0000 (17:00 +0100)]
[CodeGen] Fix warnings in isPow2VectorType and getPow2VectorType
We should either call getVectorMinNumElements() or
getVectorElementCount().
Differential Revision: https://reviews.llvm.org/D81945
Frederik Gossen [Thu, 18 Jun 2020 08:00:33 +0000 (08:00 +0000)]
[MLIR][Shape] Lower `size_to_index` and `index_to_size` with declarative rules
Replace implemented rewrite patterns with equivalent declarative rules.
Differential Revision: https://reviews.llvm.org/D82023
Frederik Gossen [Thu, 18 Jun 2020 07:51:03 +0000 (07:51 +0000)]
[MLIR][Shape] Realize `shape` to `std` lowering with declarative patterns
Setup declarative rewrite rules to lower the `shape` dialect to the `std`
dialect with two exemplary rules for `from/to_extent_tensor`.
Differential Revision: https://reviews.llvm.org/D82022
David Green [Wed, 17 Jun 2020 21:16:43 +0000 (22:16 +0100)]
[ARM] Adjust AND/OR combines to not call isConstantSplat on i1 vectors. NFC.
The rearranges PerformANDCombine and PerformORCombine to try and make
sure we don't call isConstantSplat on any i1 vectors. As pointed out in
D81860 it may not be very well defined in those cases.
David Sherwood [Thu, 18 Jun 2020 07:03:11 +0000 (08:03 +0100)]
Revert "[SVE] Add checks for no warnings in SVE tests"
This reverts commit
fb495c31701b2cd697cf4282f63764c9cefd49c0.
Was causing test failures and broke buildbot.
David Sherwood [Tue, 16 Jun 2020 11:18:00 +0000 (12:18 +0100)]
[CodeGen] Fix warnings in getVectorElementCount()
In EVT::getVectorElementCount() when the type is not simple we
should return getExtendedVectorElementCount() from the function
instead of constructing the ElementCount object manually.
I discovered this warning in an existing test:
test/CodeGen/AArch64/sve-intrinsics-loads.ll
Differential Revision: https://reviews.llvm.org/D81927
David Sherwood [Thu, 28 May 2020 10:29:26 +0000 (11:29 +0100)]
[SVE] Add checks for no warnings in SVE tests
There are now quite a few SVE tests in LLVM and Clang that do not
emit warnings related to invalid use of EVT::getVectorNumElements()
and VectorType::getNumElements(). For these tests I have added
additional checks that there are no warnings in order to prevent
any future regressions.
Differential Revision: https://reviews.llvm.org/D80712
Haojian Wu [Fri, 5 Jun 2020 14:48:32 +0000 (16:48 +0200)]
[AST] Move the "fallback to recovery expr" mechanism to CorrectDelayedTyposInExpr, NFC
Summary: Also delete two overloads, which don't seem necessary.
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82047
Jean Perier [Thu, 18 Jun 2020 05:46:19 +0000 (07:46 +0200)]
[flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit
Summary:
This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.
- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let
folding rewrite it and introduc the conversion on the MIN/MAX result.
- Also make operand promotion explicit in MIN/MAX folding.
For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))
All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.
Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby
Reviewed By: klausler, schweitz
Subscribers: llvm-commits, flang-commits
Tags: #flang, #llvm
Differential Revision: https://reviews.llvm.org/D81940