Nirav Dave [Fri, 9 Dec 2016 17:18:24 +0000 (17:18 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."
This reverts commit r289221 which appears to be triggering an assertion
llvm-svn: 289226
Reid Kleckner [Fri, 9 Dec 2016 17:14:05 +0000 (17:14 +0000)]
Store decls in prototypes on the declarator instead of in the AST
This saves two pointers from FunctionDecl that were being used for some
rare and questionable C-only functionality. The DeclsInPrototypeScope
ArrayRef was added in r151712 in order to parse this kind of C code:
enum e {x, y};
int f(enum {y, x} n) {
return x; // should return 1, not 0
}
The challenge is that we parse 'int f(enum {y, x} n)' it its own
function prototype scope that gets popped before we build the
FunctionDecl for 'f'. The original change was doing two questionable
things:
1. Saving all tag decls introduced in prototype scope on a TU-global
Sema variable. This is problematic when you have cases like this, where
'x' and 'y' shouldn't be visible in 'f':
void f(void (*fp)(enum { x, y } e)) { /* no x */ }
This patch fixes that, so now 'f' can't see 'x', which is consistent
with GCC.
2. Storing the decls in FunctionDecl in ActOnFunctionDeclarator so that
they could be used in ActOnStartOfFunctionDef. This is just an
inefficient way to move information around. The AST lives forever, but
the list of non-parameter decls in prototype scope is short lived.
Moving these things to the Declarator solves both of these issues.
Reviewers: rsmith
Subscribers: jmolloy, cfe-commits
Differential Revision: https://reviews.llvm.org/D27279
llvm-svn: 289225
Rafael Espindola [Fri, 9 Dec 2016 16:44:05 +0000 (16:44 +0000)]
Fix parsing when one extern follows another.
llvm-svn: 289224
Greg Clayton [Fri, 9 Dec 2016 16:25:13 +0000 (16:25 +0000)]
Fix buildbots that are failing due to this test by adding all expected fails that TestMultipleDebuggers.py has.
llvm-svn: 289223
Greg Clayton [Fri, 9 Dec 2016 16:22:10 +0000 (16:22 +0000)]
Rename multiple target test so it is unique.
llvm-svn: 289222
Nirav Dave [Fri, 9 Dec 2016 16:15:12 +0000 (16:15 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Retrying after fixing overly aggressive load-store forwarding optimization.
Simplify Consecutive Merge Store Candidate Search
Now that address aliasing is much less conservative, push through
simplified store merging search which only checks for parallel stores
through the chain subgraph. This is cleaner as the separation of
non-interfering loads/stores from the store-merging logic.
Whem merging stores, search up the chain through a single load, and
finds all possible stores by looking down from through a load and a
TokenFactor to all stores visited. This improves the quality of the
output SelectionDAG and generally the output CodeGen (with some
exceptions).
Additional Minor Changes:
1. Finishes removing unused AliasLoad code
2. Unifies the the chain aggregation in the merged stores across
code paths
3. Re-add the Store node to the worklist after calling
SimplifyDemandedBits.
4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
arbitrary, but seemed sufficient to not cause regressions in
tests.
This finishes the change Matt Arsenault started in r246307 and
jyknight's original patch.
Many tests required some changes as memory operations are now
reorderable. Some tests relying on the order were changed to use
volatile memory operations
Noteworthy tests:
CodeGen/AArch64/argument-blocks.ll -
It's not entirely clear what the test_varargs_stackalign test is
supposed to be asserting, but the new code looks right.
CodeGen/AArch64/arm64-memset-inline.lli -
CodeGen/AArch64/arm64-stur.ll -
CodeGen/ARM/memset-inline.ll -
The backend now generates *worse* code due to store merging
succeeding, as we do do a 16-byte constant-zero store efficiently.
CodeGen/AArch64/merge-store.ll -
Improved, but there still seems to be an extraneous vector insert
from an element to itself?
CodeGen/PowerPC/ppc64-align-long-double.ll -
Worse code emitted in this case, due to the improved store->load
forwarding.
CodeGen/X86/dag-merge-fast-accesses.ll -
CodeGen/X86/MergeConsecutiveStores.ll -
CodeGen/X86/stores-merging.ll -
CodeGen/Mips/load-store-left-right.ll -
Restored correct merging of non-aligned stores
CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
Improved. Correctly merges buffer_store_dword calls
CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
Improved. Sidesteps loading a stored value and
merges two stores
CodeGen/X86/pr18023.ll -
This test has been removed, as it was asserting incorrect
behavior. Non-volatile stores *CAN* be moved past volatile loads,
and now are.
CodeGen/X86/vector-idiv.ll -
CodeGen/X86/vector-lzcnt-128.ll -
It's basically impossible to tell what these tests are actually
testing. But, looks like the code got better due to the memory
operations being recognized as non-aliasing.
CodeGen/X86/win32-eh.ll -
Both loads of the securitycookie are now merged.
Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, dsanders, resistor, tstellarAMD, t.p.northover, spatel
Differential Revision: https://reviews.llvm.org/D14834
llvm-svn: 289221
Simon Pilgrim [Fri, 9 Dec 2016 16:01:50 +0000 (16:01 +0000)]
Use SelectionDAG.getSplatBuildVector helper. NFCI.
llvm-svn: 289220
Tom Stellard [Fri, 9 Dec 2016 15:57:15 +0000 (15:57 +0000)]
AMDGPU/SI: Don't mark VINTRP instructions as mayLoad
Summary:
These instructions technically do read from memory, but the memory
is considered to be out of bounds for normal load/store instructions.
shader-db stats:
SGPRS: 1416075 -> 1413323 (-0.19 %)
VGPRS: 867413 -> 863935 (-0.40 %)
Spilled SGPRs: 1409 -> 1354 (-3.90 %)
Spilled VGPRs: 63 -> 63 (0.00 %)
Private memory VGPRs: 880 -> 880 (0.00 %)
Scratch size: 2648 -> 2632 (-0.60 %) dwords per thread
Code Size:
37889052 ->
37897340 (0.02 %) bytes
LDS: 2147 -> 2147 (0.00 %) blocks
Max Waves: 279243 -> 280369 (0.40 %)
Wait states: 0 -> 0 (0.00 %)
Reviewers: nhaehnle, mareko, arsenm
Subscribers: kzhuravl, wdng, yaxunl, tony-tye
Differential Revision: https://reviews.llvm.org/D27593
llvm-svn: 289219
Simon Pilgrim [Fri, 9 Dec 2016 15:23:41 +0000 (15:23 +0000)]
[SelectionDAG] Use SelectionDAG.getBuildVector helper. NFCI.
Makes interception of BUILD_VECTOR creation easier for debugging.
llvm-svn: 289218
Rafael Espindola [Fri, 9 Dec 2016 15:08:40 +0000 (15:08 +0000)]
Don't crash on an extra symbol in a version script.
llvm-svn: 289217
Sanjoy Das [Fri, 9 Dec 2016 14:42:14 +0000 (14:42 +0000)]
[SCEVExpander] Remove \brief, reflow comments; NFC
llvm-svn: 289216
Sanjoy Das [Fri, 9 Dec 2016 14:42:11 +0000 (14:42 +0000)]
[SCEVExpander] Use llvm data structures; NFC
llvm-svn: 289215
Simon Pilgrim [Fri, 9 Dec 2016 14:27:52 +0000 (14:27 +0000)]
[SelectionDAG] Add additional checks to CONCAT_VECTORS creation
Part of the work for PR31323 - add extra asserts checking that the input vectors are of consistent type and result in the correct number of vector elements.
llvm-svn: 289214
Vassil Vassilev [Fri, 9 Dec 2016 14:20:32 +0000 (14:20 +0000)]
Document and publish the useful module-file-info flag.
llvm-svn: 289213
Rafael Espindola [Fri, 9 Dec 2016 14:12:02 +0000 (14:12 +0000)]
Give preempting symbols precedence over linker script.
llvm-svn: 289212
Nitesh Jain [Fri, 9 Dec 2016 13:54:47 +0000 (13:54 +0000)]
[LLDB][MIPS] Fix TestWatchpointIter failure
Reviewers: jingham
Subscribers: jaydeep, bhushan, slthakur, lldb-commits
Differential Revision: https://reviews.llvm.org/D27124
llvm-svn: 289211
Nitesh Jain [Fri, 9 Dec 2016 13:44:15 +0000 (13:44 +0000)]
[LLDB][MIPS] Fix TestMultipleHits for MIPS
Reviewers: clayborg, labath, zturner
Subscribers: jaydeep, bhushan, slthakur, lldb-commits
Differential Revision: https://reviews.llvm.org/D27085
llvm-svn: 289210
Nitesh Jain [Fri, 9 Dec 2016 13:37:14 +0000 (13:37 +0000)]
[LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet.
Reviewers: jaydeep, bhushan, clayborg
Subscribers: slthakur, lldb-commits
Differential Revision: https://reviews.llvm.org/D26542
llvm-svn: 289209
Benjamin Kramer [Fri, 9 Dec 2016 13:33:41 +0000 (13:33 +0000)]
Plug another leak in the DWARF unittests, DIEInlineStrings are never destroyed.
llvm-svn: 289208
Benjamin Kramer [Fri, 9 Dec 2016 13:12:30 +0000 (13:12 +0000)]
Fix memory leak in unit test.
The StringPool entries are destroyed with the allocator, the string pool
itself is not.
llvm-svn: 289207
Eric Fiselier [Fri, 9 Dec 2016 12:33:49 +0000 (12:33 +0000)]
Update doc version to 4.0
llvm-svn: 289206
Eric Fiselier [Fri, 9 Dec 2016 12:32:02 +0000 (12:32 +0000)]
[NFC] Change whitespace to force docs rebuild
llvm-svn: 289205
Eric Fiselier [Fri, 9 Dec 2016 12:17:31 +0000 (12:17 +0000)]
Fix missing const on set::count. Patch from Andrey Khalyavin
llvm-svn: 289204
Eric Liu [Fri, 9 Dec 2016 11:45:50 +0000 (11:45 +0000)]
[clang-format] calculate MaxInsertOffset in the original code correctly.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D27615
llvm-svn: 289203
NAKAMURA Takumi [Fri, 9 Dec 2016 11:44:57 +0000 (11:44 +0000)]
llvm/test/Object/archive-thin-create.test: Make sure that %t is empty to stabilize the test.
llvm-svn: 289202
Dylan McKay [Fri, 9 Dec 2016 11:22:26 +0000 (11:22 +0000)]
[AVR] Remove a set of redundant tests
This fixes the build.
llvm-svn: 289201
Simon Pilgrim [Fri, 9 Dec 2016 10:13:45 +0000 (10:13 +0000)]
[SelectionDAG] Add partial BITCAST support to computeKnownBits
Adds support for bitcasting a little endian 'small element' vector to 'large element' scalar/vector (e.g. v16i8 to v4i32 or v2i32 to i64), which is required for PR30845. We extract the knownbits for each 'small element' part and concatenate the results together.
We can add support for big endian and 'large element' scalar/vector to 'small element' vector bitcasting once we have test cases for them.
Differential Revision: https://reviews.llvm.org/D27129
llvm-svn: 289200
Pavel Labath [Fri, 9 Dec 2016 10:05:07 +0000 (10:05 +0000)]
Fix TestMultipleTargets for on x86_64 architectures
This test links against liblldb, so it can only run when the target arch is the
same arch as liblldb. We already have a decorator for that, so apply it.
While I'm in there, also mark the test as debug-info independent.
llvm-svn: 289199
Peter Smith [Fri, 9 Dec 2016 09:59:54 +0000 (09:59 +0000)]
[ELF][I386] .got.plt entries for i386 should use VA of ifunc resolver
The i386 glibc ld.so expects the .got.slot entry that is relocated by a
R_386_IRELATIVE relocation to point directly at the ifunc resolver and
not the address of the PLT entry + 6 (thus entering the lazy resolver).
This is also the case for ARM and I suspect it is because these use REL
relocations and can't use the addend field to store the address of the
ifunc resolver. If the lazy resolver is used we get an error message
stating that only R_386_JUMP_SLOT is supported.
As ARM and i386 share the same code, I've removed the ARM specific test
and added a writeIgotPlt() function that by default calls writeGotPlt().
ARM and i386 override this to write the address of the ifunc resolver.
Differential Revision: https://reviews.llvm.org/D27581
llvm-svn: 289198
Eric Fiselier [Fri, 9 Dec 2016 09:51:09 +0000 (09:51 +0000)]
Refactor uses_allocator test types for upcoming fixes
llvm-svn: 289197
Malcolm Parsons [Fri, 9 Dec 2016 09:33:33 +0000 (09:33 +0000)]
Update Doxygen comment in StringSaver (NFC)
llvm-svn: 289196
Eric Fiselier [Fri, 9 Dec 2016 09:31:01 +0000 (09:31 +0000)]
Put C++ ABI headers in a special build directory instead of the top level.
This patch changes where the C++ ABI headers are put during the build. Previously
they were put in the top level include directory (not the libc++ header directory).
However that just polutes the top level directory. Instead this patch creates a special
directory to put them in. The reason they can't be put under c++/v1 until after the build
is because libc++ uses the in-source headers, so we can't add the include path of the libc++
headers in the object dir.
Additionally this patch teaches the test suite how to find the ABI headers,
and adds a demangling utility to help debug tests with.
llvm-svn: 289195
Daniel Jasper [Fri, 9 Dec 2016 09:04:51 +0000 (09:04 +0000)]
Revert "[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes"
This reverts commit r288916 as it is currently causing a crasher in
Halide. Reproducer on llvm.org/PR31323. While it might be that halide is
generating invalid IR, llc shouldn't crash.
llvm-svn: 289194
Craig Topper [Fri, 9 Dec 2016 07:57:21 +0000 (07:57 +0000)]
[X86] Modify patterns from memory form of RCP/RSQRT/SQRT intrinsics to only allow (scalar_to_vector (loadf32/load64)) instead of anything that sse_load_f32/f64 can match.
sse_load_f32/f64 can also match loads that are zero extended to vectors. We shouldn't match that because we wouldn't be able to get the instruction to zero the upper bits like the intrinsic semantics would require for such a case.
There is a test case that does depend on this behavior.
llvm-svn: 289193
Dylan McKay [Fri, 9 Dec 2016 07:49:14 +0000 (07:49 +0000)]
[AVR] Use a more appropriate integer type for wide IN/OUT instructions
We could previously select an integer which would hit an assertion error
in pseudo expansion.
The new type will also generate the appropriate fixups if needed, which
wasn't done beforehand.
llvm-svn: 289192
Dylan McKay [Fri, 9 Dec 2016 07:49:04 +0000 (07:49 +0000)]
[AVR] Add tests for a large number of pseudo instructions
This adds MIR tests for 24 pseudo instructions.
llvm-svn: 289191
Craig Topper [Fri, 9 Dec 2016 06:42:28 +0000 (06:42 +0000)]
[AVX-512] Correctly preserve the passthru semantics of the FMA scalar intrinsics
Summary:
Scalar intrinsics have specific semantics about the which input's upper bits are passed through to the output. The same input is also supposed to be the input we use for the lower element when the mask bit is 0 in a masked operation. We aren't currently keeping these semantics with instruction selection.
This patch corrects this by introducing new scalar FMA ISD nodes that indicate whether operand 1(one of the multiply inputs) or operand 3(the additon/subtraction input) should pass thru its upper bits.
We use this information to select 213/132 form for the operand 1 version and the 231 form for the operand 3 version.
We also use this information to suppress combining FNEG operations on the passthru input since semantically the passthru bits aren't negated. This is stronger than the earlier check added for a user being SELECTS so we can remove that.
This fixes PR30913.
Reviewers: delena, zvi, v_klochkov
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27144
llvm-svn: 289190
Matt Arsenault [Fri, 9 Dec 2016 06:19:12 +0000 (06:19 +0000)]
AMDGPU: Select i16 instructions to VOP3 forms
These were selecting directly to the VOP2 form instead
of VOP3 like the i32 instructions. Fixes regressions in
future commits where an immediate isn't folded because it was
initially used for the second operand.
Because uniform 16-bit operations are promoted to i32, it's
difficult to get a simple testcase where this matters. Fold
failures in SIFoldOperands here tend to be hidden by commute
and fold in SIShrinkInstructions.
llvm-svn: 289189
Zachary Turner [Fri, 9 Dec 2016 05:46:41 +0000 (05:46 +0000)]
Remove some more uses of Args::GetArgumentAtIndex.
llvm-svn: 289188
Peter Collingbourne [Fri, 9 Dec 2016 05:20:43 +0000 (05:20 +0000)]
Re-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." with a configure-time check for lseek64.
llvm-svn: 289187
Craig Topper [Fri, 9 Dec 2016 05:20:11 +0000 (05:20 +0000)]
[X86] Add masked versions of VPERMT2* and VPERMI2* to load folding tables.
llvm-svn: 289186
Peter Collingbourne [Fri, 9 Dec 2016 05:04:30 +0000 (05:04 +0000)]
Revert r289184, we need more configury for Darwin and *BSD.
llvm-svn: 289185
Peter Collingbourne [Fri, 9 Dec 2016 04:57:19 +0000 (04:57 +0000)]
Support: Use a 64-bit seek in raw_fd_ostream::seek().
llvm-svn: 289184
Rui Ueyama [Fri, 9 Dec 2016 04:46:54 +0000 (04:46 +0000)]
Add type records to TPI stream.
I don't think the data I add to a TPI stream in this patch is correct,
but at least it can be displayed using llvm-pdbdump. Until I add more
streams to a PDB file, I'm not able to know whether the data will be
accepted by MSVC tools or not.
llvm-svn: 289183
Davide Italiano [Fri, 9 Dec 2016 03:49:20 +0000 (03:49 +0000)]
[SCCP] Make the test added in r289175 more meaningful.
Add a comment while here.
llvm-svn: 289182
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:30:46 +0000 (03:30 +0000)]
[Headers] Add #include_next for tgmath.h on Darwin
Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.
rdar://problem/
19019845
llvm-svn: 289181
Kostya Kortchinsky [Fri, 9 Dec 2016 03:28:12 +0000 (03:28 +0000)]
Reverting rL289088 while investigating some test issue on the build servers
Subscribers: kubabrecka
Differential Revision: https://reviews.llvm.org/D27605
llvm-svn: 289180
Kelvin Li [Fri, 9 Dec 2016 03:24:30 +0000 (03:24 +0000)]
[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma
This patch is to implement sema and parsing for 'teams distribute parallel for' pragma.
Differential Revision: https://reviews.llvm.org/D27345
llvm-svn: 289179
Eric Fiselier [Fri, 9 Dec 2016 03:18:45 +0000 (03:18 +0000)]
fix misspelling in .clang-format
llvm-svn: 289178
Eric Fiselier [Fri, 9 Dec 2016 03:17:25 +0000 (03:17 +0000)]
Turn off header sorting and comment formatting
llvm-svn: 289177
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:11:48 +0000 (03:11 +0000)]
[CrashReproducer] Provide a clean dir path for -fmodules-cache-path
The most common workflow with module reproducers involves deleting the
module cache before running the script. This happens because leftovers
from the crash are present in the cache and could trigger unrelated and
confusing errors, misleading from the initial reproduction intent.
Change this to point to a clean path but leave the leftovers untouched.
rdar://problem/
28655070
llvm-svn: 289176
Davide Italiano [Fri, 9 Dec 2016 03:08:42 +0000 (03:08 +0000)]
[SCCP] Teach the pass about `mul %x 0` even if %x is overdefined.
The motivating example is:
extern int patatino;
int goo() {
int x = 0;
for (int i = 0; i < 1000000; ++i) {
x *= patatino;
}
return x;
}
Currently SCCP will not realize that this function returns always zero,
therefore will try to unroll and vectorize the loop at -O3 producing an
awful lot of (useless) code. With this change, it will just produce:
0000000000000000 <g>:
xor %eax,%eax
retq
llvm-svn: 289175
Bruno Cardoso Lopes [Fri, 9 Dec 2016 02:22:47 +0000 (02:22 +0000)]
[CrashReproducer] Rewrite relative include paths
When -fmodules is on, the reproducer invocation currently leave paths
for include-like flags as is. If the path is relative, the reproducer
doesn't know how to access that file during reproduction time because
the VFS cannot reason about relative paths.
Expand relative paths to absolute ones when creating the reproducer
command line. This allows, for example, the reproducer to work for
crashes while building clang with modules; this wasn't possible before
because building clang requires using relative inc dir from within the
build directory.
rdar://problem/
28655070
llvm-svn: 289174
Craig Topper [Fri, 9 Dec 2016 02:18:11 +0000 (02:18 +0000)]
[AVX-512] Add vpermilps/pd to load folding tables.
llvm-svn: 289173
Craig Topper [Fri, 9 Dec 2016 02:18:07 +0000 (02:18 +0000)]
[AVX-512] Move some floating point stack folding test cases out of the integer test.
llvm-svn: 289172
Craig Topper [Fri, 9 Dec 2016 02:18:04 +0000 (02:18 +0000)]
[Analysis] Fix typo in comment. NFC
llvm-svn: 289171
Rui Ueyama [Fri, 9 Dec 2016 02:13:12 +0000 (02:13 +0000)]
COFF: Use make() in SymbolTable and Writer.
llvm-svn: 289170
Greg Clayton [Fri, 9 Dec 2016 01:21:14 +0000 (01:21 +0000)]
Calling SBDebugger::CeeateTarget being called on multiple threads was crashing LLDB.
I found the race condition in:
ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create);
More than one "ScriptInterpreter *" was being returned due to the race which caused any clients with the first one to now be pointing to freed memory and we would quickly crash.
Added a test to catch this so we don't regress.
<rdar://problem/
28356584>
llvm-svn: 289169
Zachary Turner [Fri, 9 Dec 2016 01:20:58 +0000 (01:20 +0000)]
Fix some occurrences of passing StringRef to Printf.
Hopefully these will all disappear in the future once we move
to formatv.
llvm-svn: 289168
Paul Robinson [Fri, 9 Dec 2016 01:20:40 +0000 (01:20 +0000)]
Specify -std=gnu++98 on some Rewriter tests. NFC.
Rewriter tests rewrite Objective-C++ to C++, and then compile the
result. The rewritten result sometimes doesn't work with C++11. As
we want to allow Clang's default dialect to become C++11, we need to
make sure the tests will still pass.
llvm-svn: 289167
Kostya Serebryany [Fri, 9 Dec 2016 01:17:24 +0000 (01:17 +0000)]
[libFuzzer] implement crash-resistant merge (https://github.com/google/sanitizers/issues/722). This is a first experimental variant that needs some more testing, thus not yet adding a lit test (but there are unit tests).
llvm-svn: 289166
Peter Collingbourne [Fri, 9 Dec 2016 01:10:11 +0000 (01:10 +0000)]
WholeProgramDevirt: Teach the pass to handle structs of arrays.
This will become necessary in some cases once D22296 lands.
llvm-svn: 289165
Zachary Turner [Fri, 9 Dec 2016 01:08:29 +0000 (01:08 +0000)]
Modernize the Args access pattern in a few more commands.
llvm-svn: 289164
Chandler Carruth [Fri, 9 Dec 2016 00:46:44 +0000 (00:46 +0000)]
[LCG] Minor cleanup to the LCG walk over a function, NFC.
This just hoists the check for declarations up a layer which allows
various sets used in the walk to be smaller. Also moves the relevant
comments to match, and catches a few other cleanups in this code.
llvm-svn: 289163
Peter Collingbourne [Fri, 9 Dec 2016 00:33:27 +0000 (00:33 +0000)]
Make WholeProgramDevirt understand ConstStruct vtables.
Based on a patch by LemonBoy!
Differential Revision: https://reviews.llvm.org/D26581
llvm-svn: 289162
Chris Bieneman [Fri, 9 Dec 2016 00:26:44 +0000 (00:26 +0000)]
[ObjectYAML] Support for DWARF debug_aranges
This patch adds support for round tripping DWARF debug_aranges in and out of YAML.
llvm-svn: 289161
Eugene Zelenko [Fri, 9 Dec 2016 00:11:53 +0000 (00:11 +0000)]
[AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 289160
Ekaterina Romanova [Thu, 8 Dec 2016 23:58:39 +0000 (23:58 +0000)]
[DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.
Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.
llvm-svn: 289159
Eric Fiselier [Thu, 8 Dec 2016 23:57:08 +0000 (23:57 +0000)]
Fix PR27374 - Remove the implicit reduced-arity-extension in tuple.
This patch removes libc++'s tuple extension which allowed it to be
constructed from fewer initializers than elements; with the remaining
elements being default constructed. However the implicit version of
this extension breaks conforming code. For example:
int fun(std::string);
int fun(std::tuple<std::string, int>);
int x = fun("hello"); // ambigious
Because existing code may already depend on this extension it can be re-enabled
by defining _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION.
Note that the explicit version of this extension is still supported,
although it's somewhat less useful than the implicit one.
llvm-svn: 289158
Sanjay Patel [Thu, 8 Dec 2016 23:44:58 +0000 (23:44 +0000)]
[InstCombine] add tests for umin+icmp; NFC
llvm-svn: 289157
Sanjay Patel [Thu, 8 Dec 2016 23:36:57 +0000 (23:36 +0000)]
[InstCombine] add tests for umax+icmp; NFC
llvm-svn: 289156
Jason Molenda [Thu, 8 Dec 2016 23:34:56 +0000 (23:34 +0000)]
Clean up the new TestInterruptThreadNames test a bit.
llvm-svn: 289155
Ekaterina Romanova [Thu, 8 Dec 2016 23:32:07 +0000 (23:32 +0000)]
[DOXYGEN] Improved doxygen comments.
Improved doxygen comments for fxsrintrin.h and mmintrin.h intrinsics by taagging parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.
llvm-svn: 289154
Zia Ansari [Thu, 8 Dec 2016 23:27:40 +0000 (23:27 +0000)]
[InstSimplify] Add "X / 1.0" to SimplifyFDivInst.
Differential Revision: https://reviews.llvm.org/D27587
llvm-svn: 289153
Meador Inge [Thu, 8 Dec 2016 23:21:30 +0000 (23:21 +0000)]
[ELF] Allow output section data commands to take expressions
The current implementation of the output section data store commands
can only handle integer literals, but it should really handle arbitrary
expressions [1]. This commit fixes that.
[1] https://sourceware.org/binutils/docs-2.27/ld/Output-Section-Data.html#Output-Section-Data
Differential Revision: https://reviews.llvm.org/D27561
llvm-svn: 289152
Sanjay Patel [Thu, 8 Dec 2016 23:16:06 +0000 (23:16 +0000)]
[InstCombine] add tests for smax+icmp; NFC
llvm-svn: 289151
Tim Northover [Thu, 8 Dec 2016 22:44:13 +0000 (22:44 +0000)]
GlobalISel: fall back gracefully for debug intrinsics.
Supporting them properly is a reasonably complex chunk of work, so to allow bot
testing before then we should at least be able to fall back to DAG ISel.
llvm-svn: 289150
Tim Northover [Thu, 8 Dec 2016 22:44:00 +0000 (22:44 +0000)]
GlobalISel: factor overflow handling into separate function. NFC.
llvm-svn: 289149
Rui Ueyama [Thu, 8 Dec 2016 22:36:12 +0000 (22:36 +0000)]
Split linkerscript.s into small test files.
linkerscript.s is the first test file for linker script, and at the moment
it contains all tests for linker scripts. Now that test file doesn't make
sense.
linkerscript2.s was just badly named. Renamed searchdir.s.
llvm-svn: 289148
Davide Italiano [Thu, 8 Dec 2016 22:28:53 +0000 (22:28 +0000)]
[SCCP] Make sure SCCP and ConstantFolding agree on undef >> a.
Currently SCCP folds the value to -1, while ConstantProp folds to
0. This changes SCCP to do what ConstantFolding does.
llvm-svn: 289147
Rui Ueyama [Thu, 8 Dec 2016 22:26:31 +0000 (22:26 +0000)]
Print a warning message if ENTRY() symbol is not found.
llvm-svn: 289146
Vitaly Buka [Thu, 8 Dec 2016 22:26:03 +0000 (22:26 +0000)]
[sanitizer] Add workaround for empty strings
Summary: I see crashes on this check when some reports are being generated.
Reviewers: eugenis
Subscribers: kubabrecka, llvm-commits
Differential Revision: https://reviews.llvm.org/D27574
llvm-svn: 289145
Mike Aizatsky [Thu, 8 Dec 2016 22:25:01 +0000 (22:25 +0000)]
[sanitizers] lsan+sancov doesn't need ubsanrt (multi def error)
Reviewers: eugenis
Differential Revision: https://reviews.llvm.org/D27594
llvm-svn: 289144
Simon Atanasyan [Thu, 8 Dec 2016 22:10:52 +0000 (22:10 +0000)]
[mips] Make the test case more specific and provide OS component of a triple. NFC
llvm-svn: 289117
Ekaterina Romanova [Thu, 8 Dec 2016 22:10:51 +0000 (22:10 +0000)]
[DOXYGEN] Improved doxygen comments for emmintrin.h intrinsics.
Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.
llvm-svn: 289116
Simon Atanasyan [Thu, 8 Dec 2016 22:10:48 +0000 (22:10 +0000)]
[mips] Change instruction s/daddiu/addiu/ since O32 prohibits the use of 64-bit GPRs. NFC
llvm-svn: 289115
Simon Atanasyan [Thu, 8 Dec 2016 22:10:44 +0000 (22:10 +0000)]
[mips] Change gnueabi to gnu in the triple because EABI has been removed recently. NFC
llvm-svn: 289114
Simon Atanasyan [Thu, 8 Dec 2016 22:10:38 +0000 (22:10 +0000)]
[mips] Remove N32 Android test because Android does not support N32 ABI. NFC
llvm-svn: 289113
Rui Ueyama [Thu, 8 Dec 2016 21:49:18 +0000 (21:49 +0000)]
Fix -Wunused-private-field.
llvm-svn: 289112
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:57 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 7/7.
test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4).
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1).
test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
This test is intentionally writing doubles to ostream_iterator<int>.
It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC.
test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning
when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float.
test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long.
Saying static_cast<double>(x) avoids this.
test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is
unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the
unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index,
we can just iterate with `T s`.
test/std/re/re.traits/value.pass.cpp
regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is
using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t
(which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t.
test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor
isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was
testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way
to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation.
(And 100 is representable even when char has a signed range.)
test/std/strings/string.view/string.view.hash/string_view.pass.cpp
Add static_cast<char_type> because `'0' + i` has type int.
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that
std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2
says that pow(int, int) returns double, so this was truncating double to int.
Adding static_cast<T> silences this.
test/std/utilities/function.objects/unord.hash/integral.pass.cpp
This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating
when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this.
test/std/utilities/utility/exchange/exchange.pass.cpp
First, this was exchanging 67.2 into an int, but that's inherently truncating.
Changing this to static_cast<short>(67) avoids the truncation while preserving the
"what if T and U are different" test coverage.
Second, this was exchanging {} with the explicit type float into an int, and that's also
inherently truncating. Specifying short is just as good.
test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
Add static_cast<short>. Note that this affects template argument deduction for make_pair(),
better fulfilling the test's intent. For example, this was saying
`typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking
make_pair() to return pair<int, int>, which was then being converted to pair<int, short>.
(pair's converting constructors are tested elsewhere.)
Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>.
(There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.)
Fixes D27544.
llvm-svn: 289111
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:44 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 6/7.
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
(Affects 64-bit architectures.) Include <cstddef> so we can take/return std::ptrdiff_t
(instead of int) in random_shuffle()'s RNG. (C++14 D.12 [depr.alg.random.shuffle]/2 says that
difference_type is used, and we're shuffling a plain array.)
test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
(Affects 64-bit architectures.) Include <iterator> because we're already using iterator_traits.
Then, store the result of subtracting two RanIts as difference_type instead of long
(which truncates on LLP64 architectures like MSVC x64).
test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
(Affects 64-bit architectures.) Include <cstddef> so we can store the result of
subtracting two pointers as std::ptrdiff_t (instead of int).
test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
(Affects 32-bit architectures.) Sometimes, size_t is too small. That's the case here,
where tellg() returns pos_type (N4606 27.7.2.3 [istream.unformatted]/39). Implementations can
have 64-bit pos_type (to handle large files) even when they have 32-bit size_t.
Fixes D27543.
llvm-svn: 289110
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:32 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 5/7.
Instead of storing double in double and then truncating to int, store int in long
and then widen to long long. This preserves test coverage (as these tests are
interested in various tuple conversions) while avoiding truncation warnings.
test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
Since we aren't physically truncating anymore, t1 is equal to p0.
test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
One edit is different from the usual pattern. Previously, we were storing
double in double and then converting to A, which has an implicitly converting
constructor from int. Now, we're storing int in int and then converting to A,
avoiding the truncation.
Fixes D27542.
llvm-svn: 289109
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:23 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 4/7.
Change char to long and remove some char casts. This preserves test coverage for tuple's
heterogeneous comparisons, while avoiding int-to-char truncation warnings.
Fixes D27541.
llvm-svn: 289108
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:14 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 3/7.
Add static_cast<short> when constructing pair<Whatever, short> from (Something, int).
Fixes D27540.
llvm-svn: 289107
Stephan T. Lavavej [Thu, 8 Dec 2016 21:38:01 +0000 (21:38 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 2/7.
These tests for some guy's transparent operator functors were needlessly truncating their
double results to int. Preserving the doubleness makes compilers happier. I'm following
existing practice by adding an "// exact in binary" comment when the result isn't a whole number.
(The changes from 6 to 6.0 and so forth are stylistic, not critical.)
Fixes D27539.
llvm-svn: 289106
Stephan T. Lavavej [Thu, 8 Dec 2016 21:37:47 +0000 (21:37 +0000)]
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 1/7.
Given `std::basic_streambuf<CharT>::int_type __c`, `std::basic_string<CharT> str_`,
and having checked `__c != std::basic_streambuf<CharT>::traits_type::eof()` (substituting typedefs
for clarity), the line `str_.push_back(__c);` is safe according to humans, but truncates according
to compilers. `str_.push_back(static_cast<CharT>(__c));` avoids that problem.
Fixes D27538.
llvm-svn: 289105
Rui Ueyama [Thu, 8 Dec 2016 21:27:09 +0000 (21:27 +0000)]
COFF: Use a string saver in Memory.h in Driver.
llvm-svn: 289104
David Gross [Thu, 8 Dec 2016 21:15:17 +0000 (21:15 +0000)]
[DebugInfo] Relax test case for long double constants.
Summary:
D27549 (partial fix for PR26619) emits a constant value in the debug
metadata for a floating-point static const that does not exceed 64
bits in size. The regression test accompanying that fix assumes that
a long double exceeds 64 bits in size and hence does not get a
constant value in the debug metadata. However, for some targets --
such as "--target=hexagon-unknown-elf" -- a long double does not
exceed 64 bits in size, and hence the test fails.
As a temporary fix, modify the regression test to no longer inspect
the debug metadata for a long double.
Reviewers: cfe-commits, probinson
Differential Revision: https://reviews.llvm.org/D27589
llvm-svn: 289103
Rui Ueyama [Thu, 8 Dec 2016 20:50:47 +0000 (20:50 +0000)]
Remove unnecessary `llvm::`.
llvm-svn: 289102
Reid Kleckner [Thu, 8 Dec 2016 20:38:46 +0000 (20:38 +0000)]
Don't emit .seh_handler directives for any cleanup funclets
We were falsely claiming that we had an LSDA for the relevant EH
personality before this change, which could lead to the EH machinery
interpreting random adjacent data as an LSDA.
Fixes PR31317
This change is safe because cleanups can't contain exception handlers
today. We do these things to maintain that invariant:
- C++ destructors are naturally out-of-line
- __finally blocks are outlined in clang
- LLVM's inliner will not inline EH constructs into cleanups
llvm-svn: 289101