Sanjay Patel [Sat, 3 Mar 2018 17:20:37 +0000 (17:20 +0000)]
[InstCombine] add tests for notnotsub; NFC
As shown in D44043, we may need this fold in the backend,
but it's also missing in the IR optimizer.
llvm-svn: 326659
Simon Pilgrim [Sat, 3 Mar 2018 16:31:17 +0000 (16:31 +0000)]
[X86] This bit-test TODO has been moved in PR36551
llvm-svn: 326658
Kamil Rytarowski [Sat, 3 Mar 2018 16:21:13 +0000 (16:21 +0000)]
Remove obsolete ptrace(2) operations from NetBSD
PT_SET_SIGMASK and PT_GET_SIGMASK will be removed from NetBSD
without backward compat (it shortlived in a development branch).
Sponsored by <The NetBSD Foundation>
llvm-svn: 326657
Philip Pfaffe [Sat, 3 Mar 2018 15:34:49 +0000 (15:34 +0000)]
Revert "[Acc] Fix for PR33208"
This reverts commit r326643. Fix didn't really fix anything.
llvm-svn: 326656
Kamil Rytarowski [Sat, 3 Mar 2018 14:50:36 +0000 (14:50 +0000)]
Revert D44035
Broken syntax.
llvm-svn: 326655
Kamil Rytarowski [Sat, 3 Mar 2018 14:31:06 +0000 (14:31 +0000)]
Hotfix for D44035
Try to fix the syntax.
llvm-svn: 326654
Kamil Rytarowski [Sat, 3 Mar 2018 14:13:08 +0000 (14:13 +0000)]
Support OpenBSD in common interceptors
Summary:
Extract INIT_PTHREAD_ATTR_GET_SCHED from INIT_PTHREAD_ATTR_GET,
as the former is not supported on OpenBSD.
Supported interceptors
getdetachstate, getguardsize, getscope, getstacksize, getgrouplist and getstack
Unsupported
getschedparam, getgroupmembership and getschedpolicy
Patch by David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: fedor.sergeev, srhines, kubamracek, mgorny, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44035
llvm-svn: 326653
Kamil Rytarowski [Sat, 3 Mar 2018 12:28:54 +0000 (12:28 +0000)]
Disable tests of -fsanitize on OpenBSD
This causes failures on buildbots:
/export/users/atombot/llvm/clang-atom-d525-fedora-rel/llvm/tools/clang/test/Driver/fsanitize.c:18:29: error: expected string not found in input
// CHECK-UNDEFINED-OPENBSD: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
^
<stdin>:1:1: note: scanning from here
clang version 7.0.0 (trunk 326648)
^
This will be investigated.
llvm-svn: 326652
Kamil Rytarowski [Sat, 3 Mar 2018 12:12:03 +0000 (12:12 +0000)]
OpenBSD UBsan support enabling SANITIZER_OPENBSD widely
Summary: Adding OpenBSD platform
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44049
llvm-svn: 326651
Kamil Rytarowski [Sat, 3 Mar 2018 12:04:40 +0000 (12:04 +0000)]
OpenBSD UBsan support / common
Summary:
Sanitizer common, enable OpenBSD platform.
- Enable common interceptors as possible and create few distinct ones.
- Create necessary sanitizer_struct types.
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka, visa, kettenis
Reviewed By: vitalybuka
Subscribers: emaste, srhines, kubamracek, mgorny, fedor.sergeev, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43909
llvm-svn: 326650
Kamil Rytarowski [Sat, 3 Mar 2018 12:00:12 +0000 (12:00 +0000)]
[msan] Restrict -ftls-model=initial-exec to FreeBSD
Noted by <eugenis> in D43613
llvm-svn: 326649
Kamil Rytarowski [Sat, 3 Mar 2018 11:52:52 +0000 (11:52 +0000)]
OpenBSD Driver basic sanitiser support
Summary:
Basic support of Sanitiser to follow-up ubsan support in compiler-rt.
Needs to use lld instead of base ld to be fully workable.
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka, kettenis
Reviewed By: vitalybuka
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43961
llvm-svn: 326648
Kamil Rytarowski [Sat, 3 Mar 2018 11:50:58 +0000 (11:50 +0000)]
Sanitiser common, using u64 type for GetTid on posix systems
Summary: Moving from ptr to u64 for GetTid posix implementation.
[FreeBSD] Moving from pthread_self to thr_self more appropriate to get thread ID.
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43998
llvm-svn: 326647
Kamil Rytarowski [Sat, 3 Mar 2018 11:48:54 +0000 (11:48 +0000)]
OpenBSD UBsan support, cmake part
Summary:
On OpenBSD no multi arch support
Enabling only UBsan and disabling Asan.
Patch by: David CARLIER
Reviewers: krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: srhines, mgorny, fedor.sergeev, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D44017
llvm-svn: 326646
Kamil Rytarowski [Sat, 3 Mar 2018 11:47:27 +0000 (11:47 +0000)]
Better OpenBSD frontend support
Summary:
- Like other *BSD, conditioning certain flags to pass
- To prepare future OpenBSD sanitisers.
Patch by: David CARLIER
Reviewers: dlj, krytarowski, vitalybuka
Reviewed By: vitalybuka
Subscribers: krytarowski, cfe-commits
Differential Revision: https://reviews.llvm.org/D43818
llvm-svn: 326645
Kamil Rytarowski [Sat, 3 Mar 2018 11:43:11 +0000 (11:43 +0000)]
Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski
Reviewed By: vitalybuka
Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43080
llvm-svn: 326644
Philip Pfaffe [Sat, 3 Mar 2018 10:47:37 +0000 (10:47 +0000)]
[Acc] Fix for PR33208
During codegen, Polly attempts to clear all loops from ScalarEvolution
and LoopInfo, and it does so one block at a time. This causes undefined
behaviour, since this way a loop header might be removed from a loop
before the entire loop is erased, causing ScalarEvolution to run into an
error.
Instead, just delete the entire loop atomically. This fixes currently
failing testcases.
llvm-svn: 326643
Craig Topper [Sat, 3 Mar 2018 05:18:21 +0000 (05:18 +0000)]
[X86] Remove 'else' after return. NFC
llvm-svn: 326642
Rafael Espindola [Sat, 3 Mar 2018 02:13:50 +0000 (02:13 +0000)]
Simplify. NFC.
Since r321982 we don't set VersionId in scanShlibUndefined, which
makes InVersionScript redundant.
llvm-svn: 326641
Adrian Prantl [Fri, 2 Mar 2018 23:57:09 +0000 (23:57 +0000)]
Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function.
llvm-svn: 326640
Manoj Gupta [Fri, 2 Mar 2018 23:52:44 +0000 (23:52 +0000)]
Do not generate calls to fentry with __attribute__((no_instrument_function))
Summary:
Currently only calls to mcount were suppressed with
no_instrument_function attribute.
Linux kernel requires that calls to fentry should also not be
generated.
This is an extended fix for PR PR33515.
Reviewers: hfinkel, rengolin, srhines, rnk, rsmith, rjmccall, hans
Reviewed By: rjmccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43995
llvm-svn: 326639
Chandler Carruth [Fri, 2 Mar 2018 23:40:08 +0000 (23:40 +0000)]
[ThinLTO] Revert r325320: Import global variables
This caused some links to fail with ThinLTO due to missing symbols as
well as causing some binaries to have failures at runtime. We're working
with the author to get a test case, but want to get the tree green
again.
Further, it appears to introduce a data race. While the test usage of
threads was disabled in r325361 & r325362, that isn't an acceptable fix.
I've reverted both of these as well. This code needs to be thread safe.
Test cases for this are already on the original commit thread.
llvm-svn: 326638
Craig Topper [Fri, 2 Mar 2018 23:27:50 +0000 (23:27 +0000)]
[LegalizeVectorTypes] When scalarizing the operand of a unary op like TRUNC, use a SCALAR_TO_VECTOR rather than a single element BUILD_VECTOR to convert back to a vector type.
X86 considers v1i1 a legal type under AVX512 and as such a truncate from a v1iX type to v1i1 can be turned into a scalar truncate plus a conversion to v1i1. We would much prefer a v1i1 SCALAR_TO_VECTOR over a one element BUILD_VECTOR.
During lowering we were detecting the v1i1 BUILD_VECTOR as a splat BUILD_VECTOR like we try to do for v2i1/v4i1/etc. In this case we create (select i1 splat_elt, v1i1 all-ones, v1i1 all-zeroes). That goes through some more legalization and we end up with a CMOV choosing between 0 and 1 in scalar and a scalar_to_vector.
Arguably we could detect the v1i1 BUILD_VECTOR and do this better in X86 target code. But just using a SCALAR_TO_VECTOR in legalization is much easier.
llvm-svn: 326637
Dmitry Mikulin [Fri, 2 Mar 2018 23:23:48 +0000 (23:23 +0000)]
Implementation of MRI "delete" command.
Differential Revision: https://reviews.llvm.org/D43989
llvm-svn: 326636
Vedant Kumar [Fri, 2 Mar 2018 23:22:49 +0000 (23:22 +0000)]
[AggressiveInstCombine] Use use_empty() instead of !getNumUses(), NFC
use_empty() runs in O(1), whereas getNumUses() runs in O(# uses).
llvm-svn: 326635
Adrian Prantl [Fri, 2 Mar 2018 23:15:04 +0000 (23:15 +0000)]
Don't compile testcase with clang modules enabled.
It isn't actually necessary for what we are testing here and should
fix the test on the Linux bots.
llvm-svn: 326634
Eugene Zelenko [Fri, 2 Mar 2018 23:11:49 +0000 (23:11 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 326633
Sanjay Patel [Fri, 2 Mar 2018 23:06:45 +0000 (23:06 +0000)]
[InstCombine] rearrange visitFMul; NFCI
Put the simplest non-FMF folds first, so it's easier to
see what's left to fix/group/add with the FMF folds.
llvm-svn: 326632
Adrian Prantl [Fri, 2 Mar 2018 22:59:51 +0000 (22:59 +0000)]
Add DBG_VALUE support to the linear DAG scheduler
The fast/linear DAG scheduler doesn't lower DBG_VALUEs except for
function entry nodes.
Patch by Joshua Cranmer!
Differential Revision: https://reviews.llvm.org/D43028
llvm-svn: 326631
Francis Ricci [Fri, 2 Mar 2018 22:56:45 +0000 (22:56 +0000)]
[llvm-symbolizer] Use correct path when resolving .gnu_debuglink in .debug
Summary:
The symbolizer was checking for .debug as a subdirectory of the
binary file itself, not of the directory containing the binary. This led to
a failure to find split debug info when it was contained in a .debug directory.
Reviewers: rnk, glider, zturner
Subscribers: llvm-commits, aprantl
Differential Revision: https://reviews.llvm.org/D44025
llvm-svn: 326630
Vedant Kumar [Fri, 2 Mar 2018 22:46:48 +0000 (22:46 +0000)]
[Utils] Salvage debug info in block simplification
In stage2 -O3 builds of llc, this results in small but measurable
increases in the number of variables with locations, and in the number
of unique source variables overall.
(According to llvm-dwarfdump --statistics, there are 123 additional
variables with locations, which is just a 0.006% improvement).
The size of the .debug_loc section of the llc dsym increases by 0.004%.
llvm-svn: 326629
Adrian Prantl [Fri, 2 Mar 2018 22:42:44 +0000 (22:42 +0000)]
Make the clang module cache setting available without a target
It turns out that setting the clang module cache after LLDB has a
Target can be too late. In particular, the Swift language plugin needs
to know the setting without having access to a Target. This patch
moves the setting into the *LLDB* module cache, where it is a global
setting that is available before any Target is created and more
importantly, is shared between all Targets.
rdar://problem/
37944432
Differential Revision: https://reviews.llvm.org/D43984
llvm-svn: 326628
Krzysztof Parzyszek [Fri, 2 Mar 2018 22:22:19 +0000 (22:22 +0000)]
[Hexagon] Generate valignb for shifting shuffles (instead of vdelta)
llvm-svn: 326627
Sameer AbuAsal [Fri, 2 Mar 2018 22:04:12 +0000 (22:04 +0000)]
[RISCV] Implement MC relaxations for compressed instructions.
Summary:
This patch implements relaxation for RISCV in the MC layer.
The following relaxations are currently handled:
1) Relax C_BEQZ to BEQ and C_BNEZ to BNEZ in RISCV.
2) Relax and C_J $imm to JAL x0, $imm and CJAL to JAL ra, $imm.
Reviewers: asb, llvm-commits, efriedma
Reviewed By: asb
Subscribers: shiva0217
Differential Revision: https://reviews.llvm.org/D43055
llvm-svn: 326626
Rui Ueyama [Fri, 2 Mar 2018 22:00:38 +0000 (22:00 +0000)]
Make llvm::djbHash an inline function.
Differential Revision: https://reviews.llvm.org/D43644
llvm-svn: 326625
Richard Smith [Fri, 2 Mar 2018 21:55:03 +0000 (21:55 +0000)]
PR36581: Support data recursion over Stmts in AST matchers.
llvm-svn: 326624
Erich Keane [Fri, 2 Mar 2018 21:53:25 +0000 (21:53 +0000)]
Remove -i command line option, add -imultilib
I discovered that '-i' is a command line option for the driver,
however it actually does not do anything and is not supported by any
other compiler. In fact, it is completely undocumented for Clang.
I found a couple of instances of people confusing it with one of
the variety of other command line options that control the driver.
Because of this, we should delete this option so that it is clear
that it isn't valid.
HOWEVER, I found that GCC DOES support -imultilib, which the -i
was hiding our lack of support for. We currently only use imultilib
for the purpose of forwarding to gfortran (in a specific test written
by chandlerc for this purpose).
imultilib is a rarely used (if ever?) feature that I could find no
references to on the internet, and in fact, my company's massive test
suite has zero references to it ever being used.
SO, this patch removes the -i option so that we will now give an error
on its usage (so that it won't be confused with -I), and replaces it with
-imultilib, which is now specified as a gfortran_group option.
Differential Revision: https://reviews.llvm.org/D44032
llvm-svn: 326623
Reid Kleckner [Fri, 2 Mar 2018 21:41:08 +0000 (21:41 +0000)]
Don't claim that va_start has special semantic checks
We don't have special checks for BI_va_start in
Sema::CheckBuiltinFunctionCall, so setting the 't' flag for va_start in
Builtins.def disables semantic checking for it. That's not desired, and
IRGen crashes when it tries to generate a call to va_start that doesn't
have at least one argument.
Follow-up to r322573
Fixes PR36565
llvm-svn: 326622
Vedant Kumar [Fri, 2 Mar 2018 21:36:35 +0000 (21:36 +0000)]
[Utils] Salvage debug info in recursive inst deletion
In stage2 -O3 builds of llc, this results in a 0.3% increase in the
number of variables with locations, and a 0.2% increase in the number of
unique source variables overall.
The size of the .debug_loc section of the llc dsym increases by 0.5%.
llvm-svn: 326621
Vedant Kumar [Fri, 2 Mar 2018 21:36:33 +0000 (21:36 +0000)]
[unittests] Make some parseIR calls more readable, NFC
llvm-svn: 326620
George Karpenkov [Fri, 2 Mar 2018 21:34:24 +0000 (21:34 +0000)]
[analyzer] Don't throw NSNumberObjectConversion warning on object initialization in if-expression
```
if (NSNumber* x = ...)
```
is a reasonable pattern in objc++, we should not warn on it.
rdar://
35152234
Differential Revision: https://reviews.llvm.org/D44044
llvm-svn: 326619
Sam Clegg [Fri, 2 Mar 2018 21:33:14 +0000 (21:33 +0000)]
[WebAssembly] Avoid cast ExprType to wasm::ValType
This cast was causing invalid signatures to be written
for libcall functions.
Add an MC test which includes a call to builtin memcpy.
Differential Revision: https://reviews.llvm.org/D44037
llvm-svn: 326618
Craig Topper [Fri, 2 Mar 2018 21:25:18 +0000 (21:25 +0000)]
[InstCombine] Rewrite the binary op shrinking in visitFPTrunc to avoid creating overly small ConstantFPs that we'll just need to extend again.
Instead of returning the smaller FP constant we now return the minimal Type the constant can fit into. We also return the Type of the input to any fp extends. The legality checks are then done on just the size of these Types. If we find something profitable we then emit FPTruncs in front of the smaller binop and assume those FPTruncs will be constant folded or combined with any ConstantFPs or fpextends.
Differential Revision: https://reviews.llvm.org/D44038
llvm-svn: 326617
Ulrich Weigand [Fri, 2 Mar 2018 21:22:42 +0000 (21:22 +0000)]
[SystemZ] Fix test cases after r326613
I forgot to check in the updated test cases after the r326613 commit.
llvm-svn: 326616
Rui Ueyama [Fri, 2 Mar 2018 21:19:55 +0000 (21:19 +0000)]
[WebAssembly] Simplify createDefined. NFC.
Differential Revision: https://reviews.llvm.org/D43849
llvm-svn: 326615
Heejin Ahn [Fri, 2 Mar 2018 20:52:59 +0000 (20:52 +0000)]
Reland "[WebAssembly] More uses of uint8_t for single byte values"
Summary:
Original change was D43991 (rL326541) and was reverted by rL326571 and
rL326572. This adds also the necessary MCCodeEmitter patch.
Reviewers: sbc100
Subscribers: jfb, dschuff, sbc100, jgravelle-google, sunfish, llvm-commits, ncw
Differential Revision: https://reviews.llvm.org/D44034
llvm-svn: 326614
Ulrich Weigand [Fri, 2 Mar 2018 20:51:59 +0000 (20:51 +0000)]
[SystemZ] Allow LRV/STRV with volatile memory accesses
The byte-swapping loads and stores do not actually perform multiple
accesses to their memory operand, so they are OK to use with volatile
memory operands as well. Remove overly cautious check.
llvm-svn: 326613
Ulrich Weigand [Fri, 2 Mar 2018 20:40:11 +0000 (20:40 +0000)]
[SystemZ] Add support for anyregcc calling convention
This adds back-end support for the anyregcc calling convention
for use with patchpoints.
Since all registers are considered call-saved with anyregcc
(except for 0 and 1 which may still be clobbered by PLT stubs
and the like), this required adding support for saving and
restoring vector registers in prologue/epilogue code for the
first time. This is not used by any other calling convention.
llvm-svn: 326612
Ulrich Weigand [Fri, 2 Mar 2018 20:39:30 +0000 (20:39 +0000)]
[SystemZ] Support stackmaps and patchpoints
This adds back-end support for the @llvm.experimental.stackmap and
@llvm.experimental.patchpoint intrinsics.
llvm-svn: 326611
Ulrich Weigand [Fri, 2 Mar 2018 20:38:41 +0000 (20:38 +0000)]
[SystemZ] Fix common-code users of stack size
On SystemZ we need to provide a register save area of 160 bytes to
any called function. This size needs to be added when allocating
stack in the function prologue. However, it was not accounted for
as part of MachineFrameInfo::getStackSize(); instead the back-end
used a private routine getAllocatedStackSize().
This is OK for code-gen purposes, but it breaks other users of
the getStackSize() routine, in particular it breaks the recently-
added -stack-size-section feature.
Fix this by updating the main stack size tracked by common code
(in emitPrologue) instead of using the private routine.
No change in code generation intended.
llvm-svn: 326610
Ulrich Weigand [Fri, 2 Mar 2018 20:36:34 +0000 (20:36 +0000)]
[SystemZ] Support vector registers in inline asm
This adds support for specifying vector registers for use with inline
asm statements, either via the 'v' constraint or by explicit register
names (v0 ... v31).
llvm-svn: 326609
Sanjay Patel [Fri, 2 Mar 2018 20:32:46 +0000 (20:32 +0000)]
[InstCombine] partly fix FMF for fmul+log2 fold
The code was checking that all of the instructions in the
sequence are 'fast', but that's not necessary. The final
multiply is all that we need to check (tests adjusted).
The fmul doesn't need to be fully 'fast' either, but that
can be another patch.
llvm-svn: 326608
George Burgess IV [Fri, 2 Mar 2018 20:10:38 +0000 (20:10 +0000)]
Range-ify a for loop. NFC
llvm-svn: 326607
Sanjay Patel [Fri, 2 Mar 2018 19:26:13 +0000 (19:26 +0000)]
[InstCombine] add tests for rL169025; NFC
This narrow fold was added with no motivation or test cases
a bit over 5 years ago. Removing a constant operand is a
good canonicalization? We should handle Y*2.0 too then?
llvm-svn: 326606
Aaron Ballman [Fri, 2 Mar 2018 19:14:34 +0000 (19:14 +0000)]
Adds a clang-tidy test for a failing assertion in the misc-misplaced-const check.
The test case previously triggered an assertion in the AST matchers because the QualType being matched is invalid. That is no longer the case after r326604.
llvm-svn: 326605
Aaron Ballman [Fri, 2 Mar 2018 19:14:21 +0000 (19:14 +0000)]
Fix the hasType() AST matcher to not assert when the QualType is invalid.
There's not a particularly good way to test this with the AST matchers unit tests because the only way to get an invalid type (that I can devise) involves creating parse errors, which the test harness always treats as a failure. Instead, a clang-tidy test case will be added in a follow-up commit based on the original bug report.
llvm-svn: 326604
Joel E. Denny [Fri, 2 Mar 2018 19:03:27 +0000 (19:03 +0000)]
[Attr] Use -fsyntax-only in test
Suggested at: https://reviews.llvm.org/D43248
llvm-svn: 326603
Joel E. Denny [Fri, 2 Mar 2018 19:03:22 +0000 (19:03 +0000)]
[Attr] Fix parameter indexing for several attributes
The patch fixes a number of bugs related to parameter indexing in
attributes:
* Parameter indices in some attributes (argument_with_type_tag,
pointer_with_type_tag, nonnull, ownership_takes, ownership_holds,
and ownership_returns) are specified in source as one-origin
including any C++ implicit this parameter, were stored as
zero-origin excluding any this parameter, and were erroneously
printing (-ast-print) and confusingly dumping (-ast-dump) as the
stored values.
* For alloc_size, the C++ implicit this parameter was not subtracted
correctly in Sema, leading to assert failures or to silent failures
of __builtin_object_size to compute a value.
* For argument_with_type_tag, pointer_with_type_tag, and
ownership_returns, the C++ implicit this parameter was not added
back to parameter indices in some diagnostics.
This patch fixes the above bugs and aims to prevent similar bugs in
the future by introducing careful mechanisms for handling parameter
indices in attributes. ParamIdx stores a parameter index and is
designed to hide the stored encoding while providing accessors that
require each use (such as printing) to make explicit the encoding that
is needed. Attribute declarations declare parameter index arguments
as [Variadic]ParamIdxArgument, which are exposed as ParamIdx[*]. This
patch rewrites all attribute arguments that are processed by
checkFunctionOrMethodParameterIndex in SemaDeclAttr.cpp to be declared
as [Variadic]ParamIdxArgument. The only exception is xray_log_args's
argument, which is encoded as a count not an index.
Differential Revision: https://reviews.llvm.org/D43248
llvm-svn: 326602
Vedant Kumar [Fri, 2 Mar 2018 18:57:02 +0000 (18:57 +0000)]
Fix more spelling mistakes in comments of LLVM Analysis passes
Patch by Reshabh Sharma!
Differential Revision: https://reviews.llvm.org/D43939
llvm-svn: 326601
Sanjay Patel [Fri, 2 Mar 2018 18:36:08 +0000 (18:36 +0000)]
[PatternMatch, InstSimplify] fix m_NaN to work with vector constants and use it
This is NFC for the moment (and independent of any potential NaN semantic
controversy). Besides making the code in InstSimplify easier to read, the
motivation is to eventually allow undef elements in vector constants to
match too. A proposal to add the base logic for that is in D43792.
llvm-svn: 326600
Krzysztof Parzyszek [Fri, 2 Mar 2018 18:35:57 +0000 (18:35 +0000)]
[Hexagon] Handle VACOPY in isel lowering
llvm-svn: 326599
Ilya Biryukov [Fri, 2 Mar 2018 18:23:41 +0000 (18:23 +0000)]
[clangd] Use higher timoout values in TUSchedulerTest::Debounce
Should unbreak windows buildbots.
llvm-svn: 326598
Simon Pilgrim [Fri, 2 Mar 2018 18:20:35 +0000 (18:20 +0000)]
[X86][BTVER2] Fix throughput of YMM bitwise instructions
These instructions are double-pumped, split into 2 128-bit ops and then passing through either FPU pipe.
Found while testing llvm-mca (D43951)
llvm-svn: 326597
Craig Topper [Fri, 2 Mar 2018 18:19:40 +0000 (18:19 +0000)]
[X86] Reject xmm16-31 in inline asm constraints when AVX512 is disabled
Fixes PR36532
Differential Revision: https://reviews.llvm.org/D43960
llvm-svn: 326596
Craig Topper [Fri, 2 Mar 2018 18:16:51 +0000 (18:16 +0000)]
[InstCombine] Allow fptrunc (fpext X)) to be reduced to a single fpext/ftrunc
If we are only truncating bits from the extend we should be able to just use a smaller extend.
If we are truncating more than the extend we should be able to just use a fptrunc since the presense of the fpextend shouldn't affect rounding.
Differential Revision: https://reviews.llvm.org/D43970
llvm-svn: 326595
Alexey Bataev [Fri, 2 Mar 2018 18:07:00 +0000 (18:07 +0000)]
[OPENMP] Scan all redeclarations looking for `declare simd` attribute.
Patch fixes the problem with the functions marked as `declare simd`. If
the canonical declaration does not have associated `declare simd`
construct, we may not generate required code even if other
redeclarations are marked as `declare simd`.
llvm-svn: 326594
Derek Schuff [Fri, 2 Mar 2018 17:46:39 +0000 (17:46 +0000)]
[X86][x32] Save callee-save register used as base pointer for x32 ABI
For the x32 ABI, since the base pointer register (EBX) is a callee save register
it should be saved before use.
This fixes https://bugs.llvm.org/show_bug.cgi?id=36011
Differential Revision: https://reviews.llvm.org/D42358
Patch by Pratik Bhatu
llvm-svn: 326593
Benjamin Kramer [Fri, 2 Mar 2018 17:39:20 +0000 (17:39 +0000)]
[ARM] Fold variable into assert.
Avoids unused variable warnings in Release mode.
llvm-svn: 326592
Fangrui Song [Fri, 2 Mar 2018 17:37:04 +0000 (17:37 +0000)]
[utils] Add utils/update_cc_test_checks.py
A utility to update LLVM IR in C/C++ FileCheck test files.
Example RUN lines in .c/.cc test files:
// RUN: %clang -S -Os -DXX %s -o - | FileCheck %s
// RUN: %clangxx -S -Os %s -o - | FileCheck -check-prefix=IR %s
Usage:
% utils/update_cc_test_checks.py --llvm-bin=release/bin test/a.cc
% utils/update_cc_test_checks.py --c-index-test=release/bin/c-index-test --clang=release/bin/clang /tmp/c/a.cc
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang -emit-llvm -S -Os -DXX %s -o - | FileCheck -check-prefix=AA %s
// RUN: %clangxx -emit-llvm -S -Os %s -o - | FileCheck -check-prefix=BB %s
using T =
#ifdef XX
int __attribute__((vector_size(16)))
#else
short __attribute__((vector_size(16)))
#endif
;
// AA-LABEL: _Z3fooDv4_i:
// AA: entry:
// AA-NEXT: %add = shl <4 x i32> %a, <i32 1, i32 1, i32 1, i32 1>
// AA-NEXT: ret <4 x i32> %add
//
// BB-LABEL: _Z3fooDv8_s:
// BB: entry:
// BB-NEXT: %add = shl <8 x i16> %a, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
// BB-NEXT: ret <8 x i16> %add
T foo(T a) {
return a + a;
}
Differential Revision: https://reviews.llvm.org/D42712
llvm-svn: 326591
Alexey Bataev [Fri, 2 Mar 2018 17:17:12 +0000 (17:17 +0000)]
[OPENMP] Treat local variables in CUDA mode as thread local.
In CUDA mode all local variables are actually thread
local|threadprivate, not private, and, thus, they cannot be shared
between threads|lanes.
llvm-svn: 326590
Matt Arsenault [Fri, 2 Mar 2018 16:55:37 +0000 (16:55 +0000)]
AMDGPU/GlobalISel: InstrMapping for G_ZEXT
llvm-svn: 326589
Matt Arsenault [Fri, 2 Mar 2018 16:55:33 +0000 (16:55 +0000)]
AMDGPU/GlobalISel: InstrMapping for G_TRUNC
llvm-svn: 326588
Matt Arsenault [Fri, 2 Mar 2018 16:53:15 +0000 (16:53 +0000)]
AMDGPU/GlobalISel: Define InstrMappings for G_FCMP
Patch by Tom Stellard
llvm-svn: 326587
Matt Arsenault [Fri, 2 Mar 2018 16:40:17 +0000 (16:40 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for @llvm.minnum
Patch by Tom Stellard
llvm-svn: 326586
Yaxun Liu [Fri, 2 Mar 2018 16:22:32 +0000 (16:22 +0000)]
LoopUnroll: respect pragma unroll when AllowRemainder is disabled
Currently when AllowRemainder is disabled, pragma unroll count is not
respected even though there is no remainder. This bug causes a loop
fully unrolled in many cases even though the user specifies a unroll
count. Especially it affects OpenCL/CUDA since in many cases a loop
contains convergent instructions and currently AllowRemainder is
disabled for such loops.
Differential Revision: https://reviews.llvm.org/D43826
llvm-svn: 326585
Momchil Velikov [Fri, 2 Mar 2018 15:47:14 +0000 (15:47 +0000)]
[ARM] Fix access to stack arguments when re-aligning SP in Armv6m
When an Armv6m function dynamically re-aligns the stack, access to incoming
stack arguments (and to stack area, allocated for register varargs) is done via
SP, which is incorrect, as the SP is offset by an unknown amount relative to the
value of SP upon function entry.
This patch fixes it, by making access to "fixed" frame objects be done via FP
when the function needs stack re-alignment. It also changes the access to
"fixed" frame objects be done via FP (instead of using R6/BP) also for the case
when the stack frame contains variable sized objects. This should allow more
objects to fit within the immediate offset of the load instruction.
All of the above via a small refactoring to reuse the existing
`ARMFrameLowering::ResolveFrameIndexReference.`
Differential Revision: https://reviews.llvm.org/D43566
llvm-svn: 326584
Nicholas Wilson [Fri, 2 Mar 2018 14:54:34 +0000 (14:54 +0000)]
[WebAssembly] Rename global types to match the notation in the spec
llvm-svn: 326583
Clement Courbet [Fri, 2 Mar 2018 14:53:33 +0000 (14:53 +0000)]
[MergeICmps] Revert accidentally submitted failing test case.
Reverts r326574.
llvm-svn: 326582
Nicholas Wilson [Fri, 2 Mar 2018 14:51:36 +0000 (14:51 +0000)]
[WebAssembly] Export non-hidden defined data symbols via wasm globals
This fixes a TODO introduced in rLLD325861.
Differential Revision: https://reviews.llvm.org/D43930
llvm-svn: 326581
Nicholas Wilson [Fri, 2 Mar 2018 14:48:50 +0000 (14:48 +0000)]
[WebAssembly] Pass ownership of body to SyntheticFunction. NFC
This avoids the Writer unnecessarily having a member to retain ownership
of the function body.
Differential Revision: https://reviews.llvm.org/D43933
llvm-svn: 326580
Nicholas Wilson [Fri, 2 Mar 2018 14:46:54 +0000 (14:46 +0000)]
[WebAssembly] Add validation for init function signature
Differential Revision: https://reviews.llvm.org/D43947
llvm-svn: 326579
Stefan Pintilie [Fri, 2 Mar 2018 14:41:38 +0000 (14:41 +0000)]
[Power9] Add missing instructions to the Power 9 scheduler
Adding more instructions using InstRW so that we can move away from ItinRW
and ultimately have a complete Power 9 scheduler.
llvm-svn: 326578
Nicholas Wilson [Fri, 2 Mar 2018 14:35:29 +0000 (14:35 +0000)]
[WebAssembly] Check function type indexes
Also update tests containing invalid Wasm files, exposed by the check
Differential Revision: https://reviews.llvm.org/D43954
llvm-svn: 326577
Florian Hahn [Fri, 2 Mar 2018 14:35:02 +0000 (14:35 +0000)]
[Docs] Add LLVM for Grad Students to Contributing page.
Adrian Sampson's blog post provides a good and relatively up-do-date
introduction to LLVM. I think this post could be helpful for people wanting
to get started with LLVM.
Reviewers: asb, tonic, silvas, probinson, kristof.beyls, rengolin
Reviewed By: rengolin
Differential Revision: https://reviews.llvm.org/D42904
llvm-svn: 326576
Clement Courbet [Fri, 2 Mar 2018 14:34:49 +0000 (14:34 +0000)]
[MergeICmps] Revert 324317 "Enable the MergeICmps Pass by default."
While working on PR36557.
llvm-svn: 326575
Clement Courbet [Fri, 2 Mar 2018 14:34:39 +0000 (14:34 +0000)]
[MergeIcmps] Add the test case from PR36557.
Summary: See PR36557.
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44009
llvm-svn: 326574
David Stenberg [Fri, 2 Mar 2018 14:28:56 +0000 (14:28 +0000)]
Test commit: Remove an extraneous space. NFC
Test commit access.
llvm-svn: 326573
Nicholas Wilson [Fri, 2 Mar 2018 14:07:39 +0000 (14:07 +0000)]
Revert "[WebAssembly] More uses of uint8_t" and "[WebAssembly] Update tests"
This reverts commits r326541 and r326571.
The tests were correct, and were updated with incorrect expectations.
The original commit was broken and should be reverted to get things back
to a working state.
llvm-svn: 326572
Ilya Biryukov [Fri, 2 Mar 2018 13:52:21 +0000 (13:52 +0000)]
[WebAssembly] Update tests after r326541
r326541 slightly increased the size of WebAssembly object files
and it broke test/MC/WebAssembly/global-ctor-dtor.ll.
This commit updates the test to unbreak it, also mentioned this to the
author of the original commit in case they don't want it.
llvm-svn: 326571
Florian Hahn [Fri, 2 Mar 2018 13:02:55 +0000 (13:02 +0000)]
[ARM] Fix codegen for VLD3/VLD4/VST3/VST4 with WB
Code generation of VLD3, VLD4, VST3 and VST4 with register writeback is
broken due to 2 separate bugs:
1) VLD1d64TPseudoWB_register and VLD1d64QPseudoWB_register are missing
rules to expand them to non pseudo MIR. These are selected for
ARMISD::VLD3_UPD/VLD4_UPD with v1i64 vectors in SelectVLD.
2) Selection of the right VLD/VST instruction is broken for load and
store of 3 and 4 v1i64 vectors. SelectVLD and SelectVST are called
with MIR opcode for fixed writeback (ie increment is access size)
and call getVLDSTRegisterUpdateOpcode() to select an opcode with
register writeback if base register update is of a different size.
Since getVLDSTRegisterUpdateOpcode() only knows about
VLD1/VLD2/VST1/VST2 the call is currently conditional on the number
of element in the vector.
However, VLD1/VST1 is selected by SelectVLD/SelectVST's caller for
load and stores of 3 or 4 v1i64 vectors. Therefore the opcode is not
updated which later lead to a fixed writeback instruction being
constructed with an extra operand for the register writeback.
This patch addresses the two issues as follows:
- it adds the necessary mapping from VLD1d64TPseudoWB_register and
VLD1d64QPseudoWB_register to VLD1d64Twb_register and
VLD1d64Qwb_register respectively. Like for the existing _fixed
variants, the cost of these is bumped for unaligned access.
- it changes the logic in SelectVLD and SelectVSD to call isVLDfixed
and isVSTfixed respectively to decide whether the opcode should be
updated. It also reworks the logic and comments for pushing the
writeback offset operand and r0 operand to clarify the logic:
writeback offset needs to be pushed if it's a register writeback,
r0 needs to be pushed if not and the instruction is a
VLD1/VLD2/VST1/VST2.
Reviewers: rengolin, t.p.northover, samparker
Reviewed By: samparker
Patch by Thomas Preud'homme <thomas.preudhomme@arm.com>
Differential Revision: https://reviews.llvm.org/D42970
llvm-svn: 326570
Ilya Biryukov [Fri, 2 Mar 2018 12:28:27 +0000 (12:28 +0000)]
[clang] Fix use-after-free on code completion
Summary:
Found by asan. Fiddling with code completion AST after
FrontendAction::Exceute can lead to errors.
Calling the callback in ProcessCodeCompleteResults to make sure we
don't access uninitialized state.
This particular issue comes from the fact that Sema::TUScope is
deleted when destructor of ~Parser runs, but still present in
Sema::TUScope and accessed when building completion items.
I'm still struggling to come up with a small repro. The relevant
stackframes reported by asan are:
ERROR: AddressSanitizer: heap-use-after-free on address
READ of size 8 at 0x61400020d090 thread T175
#0 0x5632dff7821b in llvm::SmallPtrSetImplBase::isSmall() const include/llvm/ADT/SmallPtrSet.h:195:33
#1 0x5632e0335901 in llvm::SmallPtrSetImplBase::insert_imp(void const*) include/llvm/ADT/SmallPtrSet.h:127:9
#2 0x5632e067347d in llvm::SmallPtrSetImpl<clang::Decl*>::insert(clang::Decl*) include/llvm/ADT/SmallPtrSet.h:372:14
#3 0x5632e065df80 in clang::Scope::AddDecl(clang::Decl*) tools/clang/include/clang/Sema/Scope.h:287:18
#4 0x5632e0623eea in clang::ASTReader::pushExternalDeclIntoScope(clang::NamedDecl*, clang::DeclarationName) clang/lib/Serialization/ASTReader.cpp
#5 0x5632e062ce74 in clang::ASTReader::finishPendingActions() tools/clang/lib/Serialization/ASTReader.cpp:9164:9
....
#30 0x5632e02009c4 in clang::index::generateUSRForDecl(clang::Decl const*, llvm::SmallVectorImpl<char>&) tools/clang/lib/Index/USRGeneration.cpp:1037:6
#31 0x5632dff73eab in clang::clangd::(anonymous namespace)::getSymbolID(clang::CodeCompletionResult const&) tools/clang/tools/extra/clangd/CodeComplete.cpp:326:20
#32 0x5632dff6fe91 in clang::clangd::CodeCompleteFlow::mergeResults(std::vector<clang::CodeCompletionResult, std::allocator<clang::CodeCompletionResult> > const&, clang::clangd::SymbolSlab const&)::'lambda'(clang::CodeCompletionResult const&)::operator()(clang::CodeCompletionResult const&) tools/clang/tools/extra/clangd/CodeComplete.cpp:938:24
#33 0x5632dff6e426 in clang::clangd::CodeCompleteFlow::mergeResults(std::vector<clang::CodeCompletionResult, std::allocator<clang::CodeCompletionResult> > const&, clang::clangd::SymbolSlab const&) third_party/llvm/llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:949:38
#34 0x5632dff7a34d in clang::clangd::CodeCompleteFlow::runWithSema() llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:894:16
#35 0x5632dff6df6a in clang::clangd::CodeCompleteFlow::run(clang::clangd::(anonymous namespace)::SemaCompleteInput const&) &&::'lambda'()::operator()() const third_party/llvm/llvm/tools/clang/tools/extra/clangd/CodeComplete.cpp:858:35
#36 0x5632dff6cd42 in clang::clangd::(anonymous namespace)::semaCodeComplete(std::unique_ptr<clang::CodeCompleteConsumer, std::default_delete<clang::CodeCompleteConsumer> >, clang::CodeCompleteOptions const&, clang::clangd::(anonymous namespace)::SemaCompleteInput const&, llvm::function_ref<void ()>) tools/clang/tools/extra/clangd/CodeComplete.cpp:735:5
0x61400020d090 is located 80 bytes inside of 432-byte region [0x61400020d040,0x61400020d1f0)
freed by thread T175 here:
#0 0x5632df74e115 in operator delete(void*, unsigned long) projects/compiler-rt/lib/asan/asan_new_delete.cc:161:3
#1 0x5632e0b06973 in clang::Parser::~Parser() tools/clang/lib/Parse/Parser.cpp:410:3
#2 0x5632e0b06ddd in clang::Parser::~Parser() clang/lib/Parse/Parser.cpp:408:19
#3 0x5632e0b03286 in std::unique_ptr<clang::Parser, std::default_delete<clang::Parser> >::~unique_ptr() .../bits/unique_ptr.h:236:4
#4 0x5632e0b021c4 in clang::ParseAST(clang::Sema&, bool, bool) tools/clang/lib/Parse/ParseAST.cpp:182:1
#5 0x5632e0726544 in clang::FrontendAction::Execute() tools/clang/lib/Frontend/FrontendAction.cpp:904:8
#6 0x5632dff6cd05 in clang::clangd::(anonymous namespace)::semaCodeComplete(std::unique_ptr<clang::CodeCompleteConsumer, std::default_delete<clang::CodeCompleteConsumer> >, clang::CodeCompleteOptions const&, clang::clangd::(anonymous namespace)::SemaCompleteInput const&, llvm::function_ref<void ()>) tools/clang/tools/extra/clangd/CodeComplete.cpp:728:15
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: klimek, jkorous-apple, cfe-commits, ioeric
Differential Revision: https://reviews.llvm.org/D44000
llvm-svn: 326569
Florian Hahn [Fri, 2 Mar 2018 12:24:25 +0000 (12:24 +0000)]
[LV][CFG] Add irreducible CFG detection for outer loops
This patch adds support for detecting outer loops with irreducible control
flow in LV. Current detection uses SCCs and only works for innermost loops.
This patch adds a utility function that works on any CFG, given its RPO
traversal and its LoopInfoBase. This function is a generalization
of isIrreducibleCFG from lib/CodeGen/ShrinkWrap.cpp. The code in
lib/CodeGen/ShrinkWrap.cpp is also updated to use the new generic utility
function.
Patch by Diego Caballero <diego.caballero@intel.com>
Differential Revision: https://reviews.llvm.org/D40874
llvm-svn: 326568
Matt Arsenault [Fri, 2 Mar 2018 12:23:00 +0000 (12:23 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for @llvm.maxnum
Patch by Tom Stellard
llvm-svn: 326567
Alexey Sotkin [Fri, 2 Mar 2018 12:11:40 +0000 (12:11 +0000)]
Add possibility to specify output stream for CompilerInstance
Patch by: krisb
Reviewers: teemperor
Reviewed By: teemperor
Subscribers: klimek, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D43809
llvm-svn: 326566
Simon Pilgrim [Fri, 2 Mar 2018 11:59:37 +0000 (11:59 +0000)]
[X86] Remove old UNIMPLEMENTED list
All of these are implemented and have appropriate test coverage
llvm-svn: 326553
Jonas Devlieghere [Fri, 2 Mar 2018 10:38:11 +0000 (10:38 +0000)]
[testsuite] Remove workaround for categories and inline tests.
Adding categories to inline tests does not work because the attribute
is set at the function level. For methods, this means it applies to all
instances of that particular class. While this is what we want in most
cases, it's not for inline tests, where different instances correspond
to different tests.
With the workaround in place, assigning a category to one test resulted
in the category applied to *all* inline tests.
This patch removes the workaround and throws an exception with an
informative error message, to prevent this from happening in the future.
llvm-svn: 326552
Mikhail Maltsev [Fri, 2 Mar 2018 10:03:02 +0000 (10:03 +0000)]
[Sema] Improve test coverage of narrowing conversion diagnostics
Summary:
This patch adds tests of narrowing conversion diagnostics for the
'unscoped enum -> integer' case.
Reviewers: faisalv, rsmith, rogfer01
Reviewed By: rogfer01
Subscribers: cfe-commits, rogfer01
Differential Revision: https://reviews.llvm.org/D43572
llvm-svn: 326551
Eric Liu [Fri, 2 Mar 2018 09:26:17 +0000 (09:26 +0000)]
[clangd:vscode] Bump clangd-vscode version to 0.0.4.
llvm-svn: 326548
Eric Liu [Fri, 2 Mar 2018 09:21:41 +0000 (09:21 +0000)]
[clangd:vscode] check empty/null string correctly.
llvm-svn: 326547
Sam McCall [Fri, 2 Mar 2018 08:56:37 +0000 (08:56 +0000)]
[clangd] Debounce streams of updates.
Summary:
Don't actually start building ASTs for new revisions until either:
- 500ms have passed since the last revision, or
- we actually need the revision for something (or to unblock the queue)
In practice, this avoids the "first keystroke results in diagnostics" problem.
This is kind of awkward to test, and the test is pretty bad.
It can be observed nicely by capturing a trace, though.
Reviewers: hokein, ilya-biryukov
Subscribers: klimek, jkorous-apple, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D43648
llvm-svn: 326546