Commit Graph

270402 Commits

Author SHA1 Message Date
Kostya Serebryany 3a8e3c8336 [libFuzzer] refactoring: move reading the seed corpus closer to where it's consumed; NFC
llvm-svn: 311972
2017-08-29 02:05:01 +00:00
Yuka Takahashi 45244edfa2 [Bash-autocompletion] Add support for -std=
Summary:
Add support for autocompleting values of -std= by including
LangStandards.def. This patch relies on D36782, and is using two-stage
code generation.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36820

llvm-svn: 311971
2017-08-29 02:01:56 +00:00
Richard Smith 2cd5604823 Improve constant expression evaluation of arrays of unknown bound.
The standard is not clear on how these are supposed to be handled, so we
conservatively treat as non-constant any cases whose value is unknown or whose
evaluation might result in undefined behavior.

llvm-svn: 311970
2017-08-29 01:52:13 +00:00
Bob Haarman a8d0d1ab91 [codeview] don't try to emit variable locations without registers
This fixes a problem introduced 311957, where the compiler would crash
with "fatal error: error in backend: unknown codeview register".

llvm-svn: 311969
2017-08-29 01:45:54 +00:00
Kostya Serebryany dd4c61ff10 fix llvm-dwarfdump-fuzzer.cpp to use the current libFuzzer API
llvm-svn: 311968
2017-08-29 01:14:05 +00:00
Marshall Clow 589453458d Fix test for C++03
llvm-svn: 311967
2017-08-29 01:10:51 +00:00
Kamil Rytarowski 802afb4c0a Shorten filenames of tests (-with-calls to -calls)
Summary:
The NetBSD's 8(beta) versions of kernel functions to retrieve
program name (vnode to path translator) and process memory
map have internal limit of processing filenames with maximum
of 31 characters.

Filenames like Asan-x86_64-with-calls-Noinst-Test break this
limit and affect tests. Rename "-with-calls" to "-calls".

This changes fixes all issues for the Address Sanitizer test
target (check-asan) on the current NetBSD support caused
by long filenames.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, fjricci, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D37149

llvm-svn: 311966
2017-08-29 01:03:13 +00:00
Juergen Ributzka c0fc219bd5 Re-apply "Fix cmake check for futimens when deploying to earlier macOS releases."
This fixes an issue with the use of LLVM_PARALLEL_LINK_JOBS.

Original commit message:
macOS 10.13 added a new API (futimens). This API is only available on macOS 10.13
and later, but the cmake check we have in place only tests if the symbol is
present and ignores the availability attribute. Luckily we have new warning for
this and by making this warning an error the cmake check will return the correct
result.

See also rdar://problem/33992750.

Differential Revision: https://reviews.llvm.org/D37027

llvm-svn: 311965
2017-08-29 00:34:56 +00:00
Justin Bogner 2ebcca2323 Implement llvm-isel-fuzzer for fuzzing instruction selection
This implements a fuzzer tool for instruction selection, as described
in my [EuroLLVM 2017 talk][1].

The fuzzer must be given both libFuzzer args and llc-like args to
configure the backend. For example, to fuzz AArch64 GlobalISel at -O0,
you could invoke like so:

  llvm-isel-fuzzer <corpus dirs> -ignore_remaining_args=1 \
                   -mtriple arm64-apple-ios -global-isel -O0

If you would like to seed the fuzzer with an initial corpus, simply
provide a directory of valid LLVM bitcode (not textual IR) as one of
the corpus dirs.

[1]: http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#2

llvm-svn: 311964
2017-08-29 00:22:08 +00:00
Craig Topper 5d6ddda92d [InstCombine] Teach foldSelectICmpAndOr to handle vector splats
This was pretty close to working already. While I was here I went ahead and passed the ICmpInst pointer from the caller instead of doing a dyn_cast that can never fail.

Differential Revision: https://reviews.llvm.org/D37237

llvm-svn: 311960
2017-08-29 00:13:49 +00:00
Justin Bogner f1a54a47b0 [sanitizer-coverage] Mark the guard and 8-bit counter arrays as used
In r311742 we marked the PCs array as used so it wouldn't be dead
stripped, but left the guard and 8-bit counters arrays alone since
these are referenced by the coverage instrumentation. This doesn't
quite work if we want the indices of the PCs array to match the other
arrays though, since elements can still end up being dead and
disappear.

Instead, we mark all three of these arrays as used so that they'll be
consistent with one another.

llvm-svn: 311959
2017-08-29 00:11:05 +00:00
Yuka Takahashi 24bc6a4c4f Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

llvm-svn: 311958
2017-08-29 00:09:31 +00:00
Bob Haarman b2a04a1513 [codeview] support more DW_OPs for more complete debug info
Summary:
Some variables show up in Visual Studio as "optimized out" even in -O0
-Od builds. This change fixes two issues that would cause this to
happen. The first issue is that not all DIExpressions we generate were
recognized by the CodeView writer. This has been addressed by adding
support for DW_OP_constu, DW_OP_minus, and DW_OP_plus. The second
issue is that we had no way to encode DW_OP_deref in CodeView. We get
around that by changinge the type we encode in the debug info to be
a reference to the type in the source code.

This fixes PR34261.

Reviewers: aprantl, rnk, zturner

Reviewed By: rnk

Subscribers: mgorny, llvm-commits, aprantl, hiraditya

Differential Revision: https://reviews.llvm.org/D36907

llvm-svn: 311957
2017-08-29 00:06:59 +00:00
Marek Sokolowski 99ecb0ebca [llvm-rc] Add MENU parsing ability (parser, pt 4/8).
This extends llvm-rc parsing tool by MENU resource
(msdn.microsoft.com/en-us/library/windows/desktop/aa381025(v=vs.85).aspx).
As for now, MENUEX
(msdn.microsoft.com/en-us/library/windows/desktop/aa381023(v=vs.85).aspx)
seems unnecessary.

Thanks for Nico Weber for his original work in this area.

Differential Revision: https://reviews.llvm.org/D36898

llvm-svn: 311956
2017-08-28 23:46:30 +00:00
Justin Bogner 873a0746f1 [sanitizer-coverage] Return the array from CreatePCArray. NFC
Be more consistent with CreateFunctionLocalArrayInSection in the API
of CreatePCArray, and assign the member variable in the caller like we
do for the guard and 8-bit counter arrays.

This also tweaks the order of method declarations to match the order
of definitions in the file.

llvm-svn: 311955
2017-08-28 23:46:11 +00:00
Justin Bogner be757de2b6 [sanitizer-coverage] Clean up trailing whitespace. NFC
llvm-svn: 311954
2017-08-28 23:38:12 +00:00
Juergen Ributzka ce82c7fb83 Revert "Fix cmake check for futimens when deploying to earlier macOS releases."
This reverts r311949. The ARM bots don't like it.

llvm-svn: 311953
2017-08-28 23:24:03 +00:00
Marshall Clow a763b36ff4 Fix PR31166: std::inplace_merge seems to be unstable. Thanks to Jan Wilken Dörrie for the suggested fix.
llvm-svn: 311952
2017-08-28 23:16:13 +00:00
Adrian Prantl 4cae108561 Fix a logic error in DwarfExpression::addMachineReg()
This fixes PR34323 and thus splitting undescribable registers into
smaller, describable sub-registers.

https://bugs.llvm.org/show_bug.cgi?id=34323

llvm-svn: 311951
2017-08-28 23:07:43 +00:00
Juergen Ributzka 1d4e04976a Fix cmake check for futimens when deploying to earlier macOS releases.
macOS 10.13 added a new API (futimens). This API is only available on macOS 10.13
and later, but the cmake check we have in place only tests if the symbol is
present and ignores the availability attribute. Luckily we have new warning for
this and by making this warning an error the cmake check will return the correct
result.

See also rdar://problem/33992750.

Differential Revision: https://reviews.llvm.org/D37027

llvm-svn: 311949
2017-08-28 23:04:38 +00:00
Adam Nemet 4846e66fdd Remove an unnecessary const_cast.
I think that this is dating back to when emit used to take a const reference.

llvm-svn: 311948
2017-08-28 23:00:13 +00:00
Alexander Shaposhnikov f1cfa039ae [analyzer] Adjust ptr arithmetic test
Replace "long" with __UINTPTR_TYPE__
to make the test added in rL311935 Windows-friendly.
Caught by the buildbot llvm-clang-x86_64-expensive-checks-win.

llvm-svn: 311947
2017-08-28 22:58:54 +00:00
Marek Sokolowski 7f11052741 [llvm-rc] Add ACCELERATORS parsing ability. (parser, pt 3/8).
This improves the current llvm-rc parser by the ability of parsing
ACCELERATORS statement.

Moreover, some small improvements to the original parsing commit
were made.

Thanks for Nico Weber for his original work in this area.

Differential Revision: https://reviews.llvm.org/D36894

llvm-svn: 311946
2017-08-28 22:58:31 +00:00
Kostya Serebryany c07008653c [libFuzzer] allow -print_funcs=N: N is the max number of new covered function printed
llvm-svn: 311945
2017-08-28 22:52:22 +00:00
Evandro Menezes 4976d6a0c6 [AArch64] Adjust the cost model for Exynos M1 and M2
Add new predicate to more accurately model the scheduling around branches
and function calls and of loads and stores of pairs and integer
multiplications.

llvm-svn: 311944
2017-08-28 22:51:52 +00:00
Evandro Menezes 509516d200 [AArch64] Adjust the cost model for Exynos M1 and M2
Add new predicate to more accurately model the cost of arithmetic and
logical operations shifted left.

Differential revision: https://reviews.llvm.org/D37151

llvm-svn: 311943
2017-08-28 22:51:32 +00:00
Rui Ueyama 5ac94e768b Rewrite std::equal as plain for-loops.
Looks like there's no need to use a higher order function. We can simply
use the regular for-loop.

llvm-svn: 311942
2017-08-28 22:28:41 +00:00
Kamil Rytarowski a9f404f813 Define NetBSD/amd64 ASAN Shadow Offset
Summary:
Catch up after compiler-rt changes and define kNetBSD_ShadowOffset64
as (1ULL << 46).
 
Sponsored by <The NetBSD Foundation>

Reviewers: kcc, joerg, filcab, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D37234

llvm-svn: 311941
2017-08-28 22:13:52 +00:00
Craig Topper 516e39cd38 [InstCombine] Teach select01 helper of foldSelectIntoOp to handle vector splats
We were handling some vectors in foldSelectIntoOp, but not if the operand of the bin op was any kind of vector constant. This patch fixes it to treat vector splats the same as scalars.

Differential Revision: https://reviews.llvm.org/D37232

llvm-svn: 311940
2017-08-28 22:00:27 +00:00
Marek Sokolowski 72aa937ed8 [llvm-rc] Add ICON and HTML parsing ability (parser, pt 2/8).
This extends the current llvm-rc parser by ICON and HTML resources.
Moreover, some tests have been slightly rewritten.

Thanks for Nico Weber for his original work in this area.

Differential Revision: https://reviews.llvm.org/D36891

llvm-svn: 311939
2017-08-28 21:59:54 +00:00
Rui Ueyama cbf969eb20 Remove Symtab aliases.
Various classes have `Symtab` member variables even though we have
lld::coff::Symtab variable because previous attempts to make COFF lld's
internal structure resemble to ELF's was incomplete. This patch finishes
that job by removing member variables.

llvm-svn: 311938
2017-08-28 21:51:07 +00:00
Kamil Rytarowski 357bbc57f9 Add NetBSD ASAN shadow mapping for x86-64
Summary:
The maximal virtual address on NetBSD/amd64 is 0x7f7ffffff000.
Define shadow offset 0x400000000000 (1ULL << 46).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, fjricci, kcc, eugenis, pcc

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36587

llvm-svn: 311937
2017-08-28 21:41:04 +00:00
Rui Ueyama 5ad6bdf2fd Remove trailing space.
llvm-svn: 311936
2017-08-28 21:38:14 +00:00
Alexander Shaposhnikov 18d77984fb [analyzer] Fix crash in modeling arithmetic
This diff fixes modeling of arithmetic 
expressions where pointers are treated as integers 
(i.e. via C-style / reinterpret casts).
For now we return UnknownVal unless the operation is a comparison.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D37120

llvm-svn: 311935
2017-08-28 21:15:21 +00:00
Sanjay Patel e4dca92b4e [InstCombine] add tests to show failure of SimplifyDemandedVectorElts + shuffle combining; NFC
llvm-svn: 311934
2017-08-28 21:14:26 +00:00
Kamil Rytarowski 5abb0ac6ea Add NetBSD specific version of sanitizer_platform_limits_posix
Summary:
NetBSD is an Open-Source POSIX-like BSD Operating System.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, filcab, fjricci

Reviewed By: kcc

Subscribers: llvm-commits, kubamracek, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D37193

llvm-svn: 311933
2017-08-28 21:03:23 +00:00
Geoff Berry 40cdc0e053 [AArch64][Falkor] Avoid generating STRQro* instructions
Summary:
STRQro* instructions are slower than the alternative ADD/STRQui expanded
instructions on Falkor, so avoid generating them unless we're optimizing
for code size.

Reviewers: t.p.northover, mcrosier

Subscribers: aemerson, rengolin, javed.absar, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D37020

llvm-svn: 311931
2017-08-28 20:48:43 +00:00
Rui Ueyama affb40e9d2 Keep an instance of COFFOptTable alive as long as InputArgList is alive.
Summary:
ArgParser created an instance of COFFOptTable on stack to use it to
parser command line arguments. Parsed arguments were then returned from
the function as InputArgList. This was safe because InputArgList referred
only statically-allocated InfoTable.

That is not a safe assumption after https://reviews.llvm.org/D36782,
which changes the type of its internal table from ArrayRef to std::vector.
To make lld work with that patch, we need to keep an instance of
COFFOptTable at least as long as an InputArgList is alive. This patch
does that.

Reviewers: yamaguchi

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D37217

llvm-svn: 311930
2017-08-28 20:46:30 +00:00
Michael Kruse 4728184342 [ZoneAlgo] More fine-grained bail-out.
ZoneAlgo used to bail out for the complete SCoP if it encountered
something violating its assumption. This meant the neither OpTree can
forward any load nor DeLICM do anything in such cases, even if their
transformations are unrelated to the violations.

This patch adds a list of compatible elements (currently with the
granularity of entire arrays) that can be used for analysis. OpTree
and DeLICM can then check whether their transformations only concern
compatible elements, and skip non-compatible ones.

This will be useful for e.g. Polybench's benchmarks covariance,
correlation, bicg, doitgen, durbin, gramschmidt, adi that have
assumption violation, but which are not necessarily relevant
for all transformations.

Differential Revision: https://reviews.llvm.org/D37219

llvm-svn: 311929
2017-08-28 20:39:07 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

Differential Revision: https://reviews.llvm.org/D26764

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
Michal Gorny 62dc83b9b7 Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Use llvm::Triple::getArchTypeName() when looking for compiler-rt
libraries, rather than the exact arch string from the triple. This is
more correct as it matches the values used when building compiler-rt
(builtin-config-ix.cmake) which are the subset of the values allowed
in triples.

For example, this fixes an issue when the compiler set for
i686-pc-linux-gnu triple would not find an i386 compiler-rt library,
while this is the exact arch that is detected by compiler-rt. The same
applies to any other i?86 variant allowed by LLVM.

This also makes the special case for MSVC unnecessary, since now i386
will be used reliably for all 32-bit x86 variants.

Differential Revision: https://reviews.llvm.org/D26796

llvm-svn: 311923
2017-08-28 20:29:52 +00:00
Davide Italiano 20cb7e887f [LoopUnroll] Properly update loop structure in case of successful peeling.
When peeling kicks in, it updates the loop preheader.
Later, a successful full unroll of the loop needs to update a PHI
which i-th argument comes from the loop preheader, so it'd better look
at the correct block. Fixes PR33437.

Differential Revision:  https://reviews.llvm.org/D37153

llvm-svn: 311922
2017-08-28 20:29:33 +00:00
Joerg Sonnenberger 0f76a35c5e Fix ARMv4 support
ARMv4 doesn't support the "BX" instruction, which has been introduced
with ARMv4t. Adjust the call lowering and tail call implementation
accordingly.

Further changes are necessary to ensure that presence of the v4t feature
is correctly set. Most importantly, the "generic" CPU for thumb-*
triples should include ARMv4t, since thumb mode without thumb support
would naturally be pointless.

Add a couple of asserts to ensure thumb instructions are not emitted
without CPU support.

Differential Revision: https://reviews.llvm.org/D37030

llvm-svn: 311921
2017-08-28 20:20:47 +00:00
Tobias Grosser ee8ad1c0ff [IslAst] Do not compare arrays in alias check which are known to be identical
This possibly helps to avoid run-time check failures in the COSMO kernels.

llvm-svn: 311920
2017-08-28 20:17:02 +00:00
Matthias Braun 3923b319ad Try to fix compilation problem with libstdc++
llvm-svn: 311918
2017-08-28 20:11:28 +00:00
Matthias Braun abbc4a7f1a Address r311914 review comments
llvm-svn: 311917
2017-08-28 20:11:27 +00:00
George Karpenkov 52a3e48e9f [libFuzzer] Exclude a test failing on OS X.
llvm-svn: 311916
2017-08-28 20:10:30 +00:00
Davide Italiano 9a09ae448d [LoopUnroll] Add a cl::opt to force peeling, for testing purposes.
Will be used to test the patch proposed in D37153.

llvm-svn: 311915
2017-08-28 19:50:55 +00:00
Matthias Braun afcff2d0d9 TableGen: Fix subreg composition/concatenation
This fixes 2 problems in subregister hierarchies with multiple levels
and tuples:

1) For bigger tuples computing secondary subregs would miss 2nd order
effects.  In the test case a register like `S10_S11_S12_S13_S14` with D5
= S10_S11, D6 = S12_S13 we would correctly compute sub0 = D5, sub1 = D6
but would miss the fact that we could now form ssub0_ssub1_ssub2_ssub3
(aka sub0_sub1) = D5_D6. This is fixed by changing
computeSecondarySubRegs() to compute a fixpoint.

2) Fixing 1) exposed a problem where TableGen would create multiple
names for effectively the same subregister index. In the test case
the subregister index sub0 is composed from ssub0 and ssub1, and sub1 is
composed from ssub2 and ssub3. TableGen should not create both sub0_sub1
and ssub0_ssub1_ssub2_ssub3 as infered subregister indexes. This changes
the code to build a transitive closure of the subregister components
before forming new concatenated subregister indexes.

This fix was developed for an out of tree target. For the in-tree
targets the only change is in the register information computed for ARM.
There is a slight chance this fixed/improved some register coalescing
around the QQQQ/QQ register classes there but I couldn't see/provoke any
code generation differences.

Differential Revision: https://reviews.llvm.org/D36913

llvm-svn: 311914
2017-08-28 19:48:42 +00:00
Matthias Braun 3fdc099a6d TableGen: Add -gen-register-info-debug-dump
Adds a new --gen-register-info-debug-dump mode to tablegen that dumps various register related information:

- List of register classes with super and subclasses
- List of subregister indexes with lanemasks
- List of registers with subregisters

I will use this in an upcoming commit to create a test.

It may also be useful for target developers wanting to get an overview
of all the register related information, esp. the things inferred by
tablegen and not directly visible in the .td file.

Differential Revision: https://reviews.llvm.org/D36911

llvm-svn: 311913
2017-08-28 19:48:40 +00:00