Sanjay Patel [Fri, 14 Oct 2016 15:30:31 +0000 (15:30 +0000)]
[InstCombine] update test to use FileCheck and auto-generate checks
llvm-svn: 284242
Sanjay Patel [Fri, 14 Oct 2016 15:24:31 +0000 (15:24 +0000)]
[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)
Prefer add/zext because they are better supported in terms of value-tracking.
Note that the backend should be prepared for this IR canonicalization
(including vector types) after:
https://reviews.llvm.org/rL284015
Differential Revision: https://reviews.llvm.org/D25135
llvm-svn: 284241
David L Kreitzer [Fri, 14 Oct 2016 14:41:46 +0000 (14:41 +0000)]
Define "contiki" OS specifier.
Patch by Michael LeMay
Differential revision: http://reviews.llvm.org/D24897
llvm-svn: 284240
Sanjay Patel [Fri, 14 Oct 2016 14:26:47 +0000 (14:26 +0000)]
[DAG] add folds for negated shifted sign bit
The same folds exist in InstCombine already.
This came up as part of:
https://reviews.llvm.org/D25485
llvm-svn: 284239
Sanjay Patel [Fri, 14 Oct 2016 14:14:40 +0000 (14:14 +0000)]
[x86] add tests to show missing folds for negated shifted sign bit
llvm-svn: 284238
Asiri Rathnayake [Fri, 14 Oct 2016 13:56:58 +0000 (13:56 +0000)]
[libcxx] Improve the gcc workaround for the missing __has_include macro.
NFC.
llvm-svn: 284237
Haojian Wu [Fri, 14 Oct 2016 13:43:49 +0000 (13:43 +0000)]
[clang-move] Don't overuse Replacements::add.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25613
llvm-svn: 284236
Martin Bohme [Fri, 14 Oct 2016 13:23:39 +0000 (13:23 +0000)]
[clang-tidy] Add additional diagnostic to misc-use-after-move
Summary:
This adds a diagnostic to the misc-use-after-move check that is output when the
use happens on a later loop iteration than the move, for example:
A a;
for (int i = 0; i < 10; ++i) {
a.foo();
std::move(a);
}
This situation can be confusing to users because, in terms of source code
location, the use is above the move. This can make it look as if the warning
is a false positive, particularly if the loop is long but the use and move are
close together.
In cases like these, misc-use-after-move will now output an additional
diagnostic:
a.cpp:393:7: note: the use happens in a later loop iteration than the move
Reviewers: hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25612
llvm-svn: 284235
George Rimar [Fri, 14 Oct 2016 13:02:22 +0000 (13:02 +0000)]
[ELF] - Added support of PT_OPENBSD_RANDOMIZE
This is 30646.
PT_OPENBSD_RANDOMIZE
The array element specifies the location and size of a part of the memory image of the program that must be filled with random data before any code in the object is executed. The memory region specified by a segment of this type may overlap the region specified by a PT_GNU_RELRO segment, in which case the intersection will be filled with random data before being marked read-only.
Reference links:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
https://github.com/openbsd/src/commit/
c494713c450d98da3f2e1451ee8c7fb675a7c461
Differential revision: https://reviews.llvm.org/D25469
llvm-svn: 284234
Haojian Wu [Fri, 14 Oct 2016 13:01:36 +0000 (13:01 +0000)]
[clang-move] Add header guard for the new header.
Summary:
The header guard generated by clang-move isn't always a perfect
style, just avoid getting the header included multiple times during
compiling period.
Also, we can use llvm-Header-guard clang-tidy check to correct the guard
automatically.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25610
llvm-svn: 284233
Asiri Rathnayake [Fri, 14 Oct 2016 13:00:07 +0000 (13:00 +0000)]
[libcxx] Do not declare the thread api when __external_threading is present
This fixes a small omission where even when __external_threading is provided,
we attempt to declare a pthread based threading API. Instead, we should leave
out everything for the __external_threading header to take care of.
The __threading_support header provides a proof-of-concept externally threaded
libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the
__external_threading header is present, we should exclude all of that POC stuff.
Reviewers: EricWF
Differential revision: https://reviews.llvm.org/D25468
llvm-svn: 284232
Vadim Macagon [Fri, 14 Oct 2016 12:58:02 +0000 (12:58 +0000)]
[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Summary:
Placeholder c-strings don't need to be instance variables.
Reviewers: ki.stfu, abidh
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D25592
llvm-svn: 284231
Eric Fiselier [Fri, 14 Oct 2016 12:56:52 +0000 (12:56 +0000)]
Disable Modules when building the libc++ sources.
Libc++ will not build with modules enabled. In order to support an in-tree
libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature.
Unfortunately the libc++ sources are fundamentally non-modular. For example
iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams
in order to better control initialization/destruction. Not shockingly Clang
diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to
provide definitions for normally inline symbols (See bind.cpp). Finally The
current module.map prohibits using <strstream> in C++11 so we can't build
strstream.cpp.
I think I can fix most of these issues but until then just disable modules.
llvm-svn: 284230
Alexey Bataev [Fri, 14 Oct 2016 12:43:59 +0000 (12:43 +0000)]
Fix for PR30632: Name mangling issue.
There was a bug in the implementation of captured statements. If it has
a lambda expression in it and the same lambda expression is used outside
the captured region, clang produced an error:
```
error: definition with same mangled name as another definition
```
Here is an example:
```
struct A {
template <typename L>
void g(const L&) { }
};
template<typename T>
void f() {
{
A().g([](){});
}
A().g([](){});
}
int main() {
f<void>();
}
```
Error report:
```
main.cpp:3:10: error: definition with same mangled name as another
definition
void g(const L&) { }
^
main.cpp:3:10: note: previous definition is here
```
Patch fixes this bug.
llvm-svn: 284229
Eric Liu [Fri, 14 Oct 2016 11:48:10 +0000 (11:48 +0000)]
Removed duplicate header include
Reviewers: ioeric
Subscribers: klimek
Patch by Krasimir Georgiev!
Differential Revision: https://reviews.llvm.org/D25599
llvm-svn: 284228
George Rimar [Fri, 14 Oct 2016 11:10:36 +0000 (11:10 +0000)]
[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS
Issue was revealed by AFl and I was able to generate such object using yaml2obj.
When object has more than one SHT_MIPS_OPTIONS,
each except the last one is destroyed after placing into Sections array.
Sections array contains dead pointers finally. LLD may crash then.
Differential revision: https://reviews.llvm.org/D25555
llvm-svn: 284227
George Rimar [Fri, 14 Oct 2016 10:34:36 +0000 (10:34 +0000)]
[ELF] - Implemented -z wxneeded.
-z wxneeded creates a PHDR PT_OPENBSD_WXNEEDED.
PT_OPENBSD_WXNEEDED
The array element specifies that a process executing this file may need to be able to map or protect memory regions as simultaneously executable and writable. If the system is unable or unwilling to permit that for this executable then it may fail immediately. This segment type is meaningful only for executable files and is ignored in other objects.
http://man.openbsd.org/OpenBSD-current/man5/elf.5
Differential revision: https://reviews.llvm.org/D25472
llvm-svn: 284226
Eric Fiselier [Fri, 14 Oct 2016 10:30:33 +0000 (10:30 +0000)]
Work around Clang driver segfault when --coverage is used with -c and /dev/null
llvm-svn: 284225
Nicolai Haehnle [Fri, 14 Oct 2016 10:30:00 +0000 (10:30 +0000)]
AMDGPU: Select 64-bit {ADD,SUB}{C,E} nodes
Summary:
This will be used for 64-bit MULHU, which is in turn used for the 64-bit
divide-by-constant optimization (see D24822).
Reviewers: arsenm, tstellarAMD
Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye
Differential Revision: https://reviews.llvm.org/D25289
llvm-svn: 284224
Diana Picus [Fri, 14 Oct 2016 10:19:40 +0000 (10:19 +0000)]
[GlobalISel] Get the AArch64 tests to work on Linux
Mostly this just means changing the triple from aarch64-apple-ios to the generic
aarch64--. Only one test needs more significant changes, but GlobalISel already
does the right thing so it's ok to just change the checks.
Differential Revision: https://reviews.llvm.org/D25532
llvm-svn: 284223
Eric Liu [Fri, 14 Oct 2016 10:10:26 +0000 (10:10 +0000)]
Try to fix windows bot file path style failure caused by r284219.
llvm-svn: 284222
Haojian Wu [Fri, 14 Oct 2016 10:07:58 +0000 (10:07 +0000)]
[clang-move] Matching static class member more correctly.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25598
llvm-svn: 284221
Nicolai Haehnle [Fri, 14 Oct 2016 09:49:51 +0000 (09:49 +0000)]
Fix use-after-frees
Extracted from D25313, as suggested by Justin Bogner.
llvm-svn: 284220
Eric Liu [Fri, 14 Oct 2016 09:32:06 +0000 (09:32 +0000)]
Deduplicate sets of replacements by file names.
Summary:
If there are multiple <File, Replacements> pairs with the same file
path after removing dots, we only keep one pair (with path after dots being
removed) and discard the rest.
Reviewers: djasper
Subscribers: klimek, hokein, bkramer, cfe-commits
Differential Revision: https://reviews.llvm.org/D25565
llvm-svn: 284219
Simon Dardis [Fri, 14 Oct 2016 09:31:42 +0000 (09:31 +0000)]
[mips] Fix aui/daui/dahi/dati for MIPSR6
For compatiblity with binutils, define these instructions to take
two registers with a 16bit unsigned immediate. Both of the registers
have to be same for dahi and dati.
Reviewers: dsanders, zoran.jovanovic
Differential Review: https://reviews.llvm.org/D21473
llvm-svn: 284218
Eric Fiselier [Fri, 14 Oct 2016 09:12:53 +0000 (09:12 +0000)]
Mark test as unsupported without threads
llvm-svn: 284217
Eric Fiselier [Fri, 14 Oct 2016 09:06:38 +0000 (09:06 +0000)]
Remove dead CMake target
llvm-svn: 284216
Nicolai Haehnle [Fri, 14 Oct 2016 09:03:04 +0000 (09:03 +0000)]
AMDGPU: Fix use-after-frees
Reviewers: arsenm, tstellarAMD
Subscribers: kzhuravl, wdng, yaxunl, tony-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D25312
llvm-svn: 284215
Eric Fiselier [Fri, 14 Oct 2016 08:47:09 +0000 (08:47 +0000)]
XFAIL aligned allocation tests for older Clang versions
llvm-svn: 284214
Michael Zuckerman [Fri, 14 Oct 2016 08:13:27 +0000 (08:13 +0000)]
[x86][ms-inline-asm] use of "jmp short" in asm is not supported
Test linked to: https://reviews.llvm.org/D24957
Committing in the name of Ziv Izhar: After check-all and LGTM .
Differential Revision: https://reviews.llvm.org/D24958
llvm-svn: 284213
Marek Kurdej [Fri, 14 Oct 2016 08:10:08 +0000 (08:10 +0000)]
[clang-tidy] Fix readability-braces-around-statements false positive
Summary:
This fixes a false-positive e.g. when string literals are returned from if statement.
This patch includes as well a small fix to includes and renames of the test suite that collided with the name of the check.
Reviewers: alexfh, hokein
Subscribers: hokein
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D25558
llvm-svn: 284212
Michael Zuckerman [Fri, 14 Oct 2016 08:09:40 +0000 (08:09 +0000)]
[x86][ms-inline-asm] use of "jmp short" in asm is not supported
Committing in the name of Ziv Izhar: After check-all and LGTM .
The following patch is for compatability with Microsoft.
Microsoft ignores the keyword "short" when used after a jmp, for example:
__asm {
jmp short label
label:
}
A test for that patch will be added in another patch, since it's located in clang's codegen tests. Link will be added shortly.
link to test: https://reviews.llvm.org/D24958
Differential Revision: https://reviews.llvm.org/D24957
llvm-svn: 284211
Eric Fiselier [Fri, 14 Oct 2016 07:49:15 +0000 (07:49 +0000)]
XFAIL aligned allocation test failures with UBSAN
llvm-svn: 284210
Eric Fiselier [Fri, 14 Oct 2016 07:19:52 +0000 (07:19 +0000)]
Add void_t and invoke feature test macros
llvm-svn: 284209
Eric Fiselier [Fri, 14 Oct 2016 06:49:30 +0000 (06:49 +0000)]
Update OS X ABI list
llvm-svn: 284208
Eric Fiselier [Fri, 14 Oct 2016 06:47:37 +0000 (06:47 +0000)]
Correct ABI changelog revision number
llvm-svn: 284207
Eric Fiselier [Fri, 14 Oct 2016 06:46:30 +0000 (06:46 +0000)]
Implement P0035R4 -- Add C++17 aligned allocation functions
Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.
In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.
Reviewers: mclow.lists, rsmith
Subscribers: rsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D25591
llvm-svn: 284206
Eric Fiselier [Fri, 14 Oct 2016 06:15:27 +0000 (06:15 +0000)]
Cleanup LIT testing doc
llvm-svn: 284205
Craig Topper [Fri, 14 Oct 2016 06:00:42 +0000 (06:00 +0000)]
[DAGCombiner] Teach createBuildVecShuffle to handle cases where input vectors are less than half of the output vector size.
This will be needed by a future commit to support sign/zero extending from v8i8 to v8i64 which requires a sign/zero_extend_vector_inreg to be created which requires v8i8 to be concatenated upto v64i8 and goes through this code.
llvm-svn: 284204
Eric Christopher [Fri, 14 Oct 2016 05:47:41 +0000 (05:47 +0000)]
In preparation for removing getNameWithPrefix off of TargetMachine,
sink the current behavior into the callers and sink
TargetMachine::getNameWithPrefix into TargetMachine::getSymbol.
llvm-svn: 284203
Eric Christopher [Fri, 14 Oct 2016 05:47:37 +0000 (05:47 +0000)]
Tidy the calls to getCurrentSection().first -> getCurrentSectionOnly to help
readability a bit.
llvm-svn: 284202
Eric Christopher [Fri, 14 Oct 2016 05:45:46 +0000 (05:45 +0000)]
Tidy up example of getting the pointer size.
llvm-svn: 284201
Eric Fiselier [Fri, 14 Oct 2016 05:29:46 +0000 (05:29 +0000)]
Remove two ABI symbols added after the 3.9 release
llvm-svn: 284200
Eric Fiselier [Fri, 14 Oct 2016 05:10:06 +0000 (05:10 +0000)]
Add ABI changelog entry for <any>
llvm-svn: 284199
Eric Fiselier [Fri, 14 Oct 2016 05:04:00 +0000 (05:04 +0000)]
Sort ABI lists by name so that changes don't generate big diffs
llvm-svn: 284198
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:51:43 +0000 (04:51 +0000)]
[ELF/AMDGPU]: Add support for new relocations
Differential Revision: https://reviews.llvm.org/D25563
llvm-svn: 284197
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:37:34 +0000 (04:37 +0000)]
[AMDGPU] Emit 32-bit lo/hi got and pc relative variant kinds for external and global address space variables
Differential Revision: https://reviews.llvm.org/D25562
llvm-svn: 284196
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:21:32 +0000 (04:21 +0000)]
[AMDGPU] Add 32-bit lo/hi got and pc relative variant kinds and emit appropriate relocations
Differential Revision: https://reviews.llvm.org/D25548
llvm-svn: 284195
Eric Fiselier [Fri, 14 Oct 2016 04:21:24 +0000 (04:21 +0000)]
Revert r284193 - it is not correct on OS X
llvm-svn: 284194
Eric Fiselier [Fri, 14 Oct 2016 04:14:24 +0000 (04:14 +0000)]
Re-export two previously exported std::string functions.
These functions were removed from the dylib sometime between the 3.9 release
and now. This patch manually exports them to re-gain ABI compatibility.
llvm-svn: 284193
Eric Fiselier [Fri, 14 Oct 2016 04:06:19 +0000 (04:06 +0000)]
Add ABI list for 3.9 linux
llvm-svn: 284192
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:03:49 +0000 (04:03 +0000)]
[Support/ELF/AMDGPU] Add 32-bit lo/hi got and pc relative relocations
Added relocation names:
- R_AMDGPU_GOTPCREL32_LO
- R_AMDGPU_GOTPCREL32_HI
- R_AMDGPU_REL32_LO
- R_AMDGPU_REL32_HI
AMDGPU isa only supports 32-bit immediates. In order to access 64-bit address we need to generate 32-bit lo/hi relocations, and do the right math (separate patch). Currently we only generate one 32 bit relocation for lower bits for each access, losing higher bits. Hence we need relocations listed above.
Differential Revision: https://reviews.llvm.org/D25546
llvm-svn: 284191
Mehdi Amini [Fri, 14 Oct 2016 03:54:46 +0000 (03:54 +0000)]
Add `llvm::` in clEnumVal macro (NFC)
This allows to use llvm:cl::opt without `using namespace llvm;`
llvm-svn: 284190
Eric Fiselier [Fri, 14 Oct 2016 02:55:43 +0000 (02:55 +0000)]
Add 3.9 symbol list for OS X
llvm-svn: 284189
Eric Fiselier [Fri, 14 Oct 2016 02:55:19 +0000 (02:55 +0000)]
Fix CMake configuration error and add ABI lists for OS X.
The primary reason for this patch is to add the OS X ABI lists for 3.9 and
ToT.
However while working on that I discovered that we incorrectly
exported the libc++abi symbols. Previously we had chosen the wrong CMake
configuration path and that caused us to re-export the c++abi binary instead
of using the symbol lists.
llvm-svn: 284188
Richard Smith [Fri, 14 Oct 2016 02:35:11 +0000 (02:35 +0000)]
Fix bogus assert breaking modules self-host.
llvm-svn: 284187
Eric Fiselier [Fri, 14 Oct 2016 02:32:54 +0000 (02:32 +0000)]
Add OS X abi list
llvm-svn: 284186
Eric Fiselier [Fri, 14 Oct 2016 02:27:44 +0000 (02:27 +0000)]
Add ABI Changelog and current symbol list for Linux
llvm-svn: 284185
Richard Smith [Fri, 14 Oct 2016 01:12:20 +0000 (01:12 +0000)]
Use SubstInitializer instead of SubstExpr when instantiating a default
argument, in order to correctly instantiate the initializer.
llvm-svn: 284184
Jim Ingham [Fri, 14 Oct 2016 01:11:19 +0000 (01:11 +0000)]
This test passes on i386 now.
llvm-svn: 284183
Jim Ingham [Fri, 14 Oct 2016 01:03:03 +0000 (01:03 +0000)]
This test is passing on i386 now.
llvm-svn: 284182
Matthias Braun [Fri, 14 Oct 2016 00:17:19 +0000 (00:17 +0000)]
Timer: Fix doxygen comments, use member initializer; NFC
llvm-svn: 284181
Teresa Johnson [Fri, 14 Oct 2016 00:13:59 +0000 (00:13 +0000)]
Add interface for querying physical hardware concurrency
Summary:
This will be used by ThinLTO to set the amount of backend
parallelism, which performs better when restricted to the number
of physical cores (on X86 at least, where getHostNumPhysicalCores is
currently defined). If not available this falls back to
thread::hardware_concurrency.
Note I didn't add to the thread class since that is a typedef to
std::thread where available.
Reviewers: mehdi_amini
Subscribers: beanz, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D25585
llvm-svn: 284180
Sebastian Pop [Fri, 14 Oct 2016 00:07:57 +0000 (00:07 +0000)]
remove warnings from google-benchmarks in libcxx
Differential Revision: https://reviews.llvm.org/D25522
Patch written by Aditya Kumar.
llvm-svn: 284179
Dean Michael Berris [Thu, 13 Oct 2016 23:56:54 +0000 (23:56 +0000)]
[compiler-rt][XRay] Support tail call sleds
Summary:
This change depends on D23986 which adds tail call-specific sleds. For
now we treat them first as normal exits, and in the future leave room
for implementing this as a different kind of log entry.
The reason for deferring the change is so that we can keep the naive
logging implementation more accurate without additional complexity for
reading the log. The accuracy is gained in effectively interpreting call
stacks like:
A()
B()
C()
Which when tail-call merged will end up not having any exit entries for
A() nor B(), but effectively in turn can be reasoned about as:
A()
B()
C()
Although we lose the fact that A() had called B() then had called C()
with the naive approach, a later iteration that adds the explicit tail
call entries would be a change in the log format and thus necessitate a
version change for the header. We can do this later to have a chance at
releasing some tools (in D21987) that are able to handle the naive log
format, then support higher version numbers of the log format too.
Reviewers: echristo, kcc, rSerge, majnemer
Subscribers: mehdi_amini, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D23988
llvm-svn: 284178
Rui Ueyama [Thu, 13 Oct 2016 23:08:33 +0000 (23:08 +0000)]
Improve comments.
llvm-svn: 284177
Richard Smith [Thu, 13 Oct 2016 23:04:14 +0000 (23:04 +0000)]
Reinstate r281429, reverted in r281452, with a fix for its mishandling of
compiles without -fmodules-local-submodule-visibility. Original commit message:
[modules] When merging one definition into another, propagate the list of
re-exporting modules from the discarded definition to the retained definition.
llvm-svn: 284176
Saleem Abdulrasool [Thu, 13 Oct 2016 23:00:11 +0000 (23:00 +0000)]
CodeGen: use MSVC division on windows itanium
Windows itanium is identical to MSVC when dealing with everything but C++.
Lower the math routines into msvcrt rather than compiler-rt.
llvm-svn: 284175
Arnold Schwaighofer [Thu, 13 Oct 2016 22:47:03 +0000 (22:47 +0000)]
Disable swiftcall test on windows: More brutal way to appease windows bots
The backtrace on the bot does not give me any indication what is wrong.
The test case interestingly passes in stage2 of the build.
I don't have a way of debugging this.
Disable the test on windows and hope if there is truly a bug in the code that
was causing we will eventually run into this on other platforms.
llvm-svn: 284174
Saleem Abdulrasool [Thu, 13 Oct 2016 22:38:15 +0000 (22:38 +0000)]
CodeGen: adjust floating point operations in Windows itanium
Windows itanium is equivalent to MSVC except in C++ mode. Ensure that the
promote the 32-bit floating point operations to their 64-bit equivalences.
llvm-svn: 284173
Albert Gutowski [Thu, 13 Oct 2016 22:35:07 +0000 (22:35 +0000)]
Add 64-bit MS _Interlocked functions as builtins again
Summary: Previously global 64-bit versions of _Interlocked functions broke buildbots on i386, so now I'm adding them as builtins for x86-64 and ARM only (should they be also on AArch64? I had problems with testing it for AArch64, so I left it)
Reviewers: hans, majnemer, mstorsjo, rnk
Subscribers: cfe-commits, aemerson
Differential Revision: https://reviews.llvm.org/D25576
llvm-svn: 284172
Kostya Serebryany [Thu, 13 Oct 2016 22:34:13 +0000 (22:34 +0000)]
Make lsan complain loudly when running under ptrace
Summary:
LeakSanitizer does not work with ptrace but currently it
will print warnings (only under verbosity=1) and then proceed
to print tons of false reports.
This patch makes lsan fail hard under ptrace with a verbose message.
https://github.com/google/sanitizers/issues/728
Reviewers: eugenis, vitalybuka, aizatsky
Subscribers: kubabrecka, llvm-commits
Differential Revision: https://reviews.llvm.org/D25538
llvm-svn: 284171
Sanjay Patel [Thu, 13 Oct 2016 22:27:10 +0000 (22:27 +0000)]
[DAG] hoist DL(N) and fix formatting; NFC
llvm-svn: 284170
Kostya Serebryany [Thu, 13 Oct 2016 22:24:10 +0000 (22:24 +0000)]
[libFuzzer] more detailed message for disabled leak detection
llvm-svn: 284169
Peter Collingbourne [Thu, 13 Oct 2016 22:20:18 +0000 (22:20 +0000)]
ELF: Override DSO definitions when creating __start_* and __stop_* symbols.
Previously we would fail to synthesise a __start_ or __stop_ symbol if
there existed a definition in a DSO. Instead, we would try to link against
the DSO definition. This became possible after D23552 when linking against
lld-produced DSOs but could in principle also occur when linking against
DSOs produced by other linkers.
Not only does it seem more likely that a user would expect the resolved
definition to be local to the executable, but if a __start_ or __stop_
symbol was synthesised by the linker, it is effectively impossible to link
against correctly from a non-PIC executable in a read-only section. Neither
a PLT nor a copy relocation would give us the right semantics here. The only
way the link could succeed is if the executable provided its own synthetic
definition of the symbol.
The fix is to also synthesise the definition if the only definition comes
from a DSO. Since this is what the addOptionalSynthetic function does,
switch to using that function.
Fixes PR30680.
Differential Revision: https://reviews.llvm.org/D25544
llvm-svn: 284168
Albert Gutowski [Thu, 13 Oct 2016 21:55:16 +0000 (21:55 +0000)]
fix _BitScan intrinsics missing header warnings; fix some line endings
llvm-svn: 284167
Alexander Shaposhnikov [Thu, 13 Oct 2016 21:31:46 +0000 (21:31 +0000)]
[analyzer] Remove superquadratic behaviour from DataflowWorklist
The class DataflowWorklist internally maintains a sorted list of pointers to CFGBlock
and the method enqueuePredecessors has to call sortWorklist to maintain the invariant.
The implementation based on vector + sort works well for small sizes
but gets infeasible for relatively large sizes. In particular the issue takes place
for some cryptographic libraries which use code generation.
The diff replaces vector + sort with priority queue.
For one of the implementations of AES this patch reduces
the time for analysis from 204 seconds to 8 seconds.
Test plan: make -j8 check-clang
Differential revision: https://reviews.llvm.org/D25503
llvm-svn: 284166
Marshall Clow [Thu, 13 Oct 2016 21:15:09 +0000 (21:15 +0000)]
Update the status of three papers that do not require library changes
llvm-svn: 284165
Marshall Clow [Thu, 13 Oct 2016 21:06:03 +0000 (21:06 +0000)]
Implement wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
Tom Stellard [Thu, 13 Oct 2016 21:03:49 +0000 (21:03 +0000)]
LegalizeDAG: Implement PROMOTE for ISD::BITREVERSE
Summary:
This operation is promoted the same way was ISD::BSWAP. This will
prevent a regression in test/Target/AMDGOU/bitreverse.ll when i16
support is implemented.
Reviewers: bogner, hfinkel
Subscribers: hfinkel, wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D25202
llvm-svn: 284163
Arnold Schwaighofer [Thu, 13 Oct 2016 20:59:23 +0000 (20:59 +0000)]
Add required targets to tests to (hopefully) appease bots
llvm-svn: 284162
David L Kreitzer [Thu, 13 Oct 2016 20:57:51 +0000 (20:57 +0000)]
[safestack] Reapply r283248 after moving X86-targeted SafeStack tests into
the X86 subdirectory. Original commit message:
Requires a valid TargetMachine to be passed to the SafeStack pass.
Patch by Michael LeMay
Differential revision: http://reviews.llvm.org/D24896
llvm-svn: 284161
Sriraman Tallam [Thu, 13 Oct 2016 20:54:39 +0000 (20:54 +0000)]
New llc option pie-copy-relocations to optimize access to extern globals.
This option indicates copy relocations support is available from the linker
when building as PIE and allows accesses to extern globals to avoid the GOT.
Differential Revision: https://reviews.llvm.org/D24849
llvm-svn: 284160
Justin Lebar [Thu, 13 Oct 2016 20:52:17 +0000 (20:52 +0000)]
Add and use isDiscardableGVALinkage function.
Reviewers: rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25571
llvm-svn: 284159
Justin Lebar [Thu, 13 Oct 2016 20:52:12 +0000 (20:52 +0000)]
[CUDA] Emit deferred diagnostics during Sema rather than during codegen.
Summary:
Emitting deferred diagnostics during codegen was a hack. It did work,
but usability was poor, both for us as compiler devs and for users. We
don't codegen if there are any sema errors, so for users this meant that
they wouldn't see deferred errors if there were any non-deferred errors.
For devs, this meant that we had to carefully split up our tests so that
when we tested deferred errors, we didn't emit any non-deferred errors.
This change moves checking for deferred errors into Sema. See the big
comment in SemaCUDA.cpp for an overview of the idea.
This checking adds overhead to compilation, because we have to maintain
a partial call graph. As a result, this change makes deferred errors a
CUDA-only concept (whereas before they were a general concept). If
anyone else wants to use this framework for something other than CUDA,
we can generalize at that time.
This patch makes the minimal set of test changes -- after this lands,
I'll go back through and do a cleanup of the tests that we no longer
have to split up.
Reviewers: rnk
Subscribers: cfe-commits, rsmith, tra
Differential Revision: https://reviews.llvm.org/D25541
llvm-svn: 284158
Nirav Dave [Thu, 13 Oct 2016 20:23:25 +0000 (20:23 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."
This reverts commit r284151 which appears to be triggering a LTO
failures on Hexagon
llvm-svn: 284157
Saleem Abdulrasool [Thu, 13 Oct 2016 20:10:22 +0000 (20:10 +0000)]
test: attempt to repair SCEI buildbots
The tests target ARM, ensure that the ARM target is registered.
llvm-svn: 284156
Eric Liu [Thu, 13 Oct 2016 19:49:19 +0000 (19:49 +0000)]
[clang-move] error out when fail to create new files.
llvm-svn: 284155
Saleem Abdulrasool [Thu, 13 Oct 2016 19:45:08 +0000 (19:45 +0000)]
CodeGen: ensure that the runtime calling convention matches
Incorrect specification of the calling convention results in UB which can cause
the code path to be eliminated. Simplify the existing code by using the
RuntimeCall constructor in `CodeGenFunction`.
llvm-svn: 284154
Quentin Colombet [Thu, 13 Oct 2016 19:27:48 +0000 (19:27 +0000)]
[RAGreedy] Empty live-ranges always succeed in last chance recoloring.
Relax the constraint for empty live-ranges while doing last chance
recoloring. Indeed, those live-ranges do not need an actual color to be
fond for the recoloring to work.
Empty live-range may happen as a result of splitting/spilling.
Unfortunately no test case for in-tree targets.
llvm-svn: 284152
Nirav Dave [Thu, 13 Oct 2016 19:20:16 +0000 (19:20 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Retrying after upstream changes.
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.
CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot-compute.ll -
This test appears to work but no longer exhibits the spill behavior.
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: 284151
Arnold Schwaighofer [Thu, 13 Oct 2016 19:19:37 +0000 (19:19 +0000)]
Swift Calling Convention: Fix out of bounds access
Use iterator instead of address of element in vector
It is not valid to access one after the last element.
rdar://
28759508
llvm-svn: 284150
Kostya Serebryany [Thu, 13 Oct 2016 19:06:46 +0000 (19:06 +0000)]
[libFuzzer] add -trace_malloc= flag
llvm-svn: 284149
Eric Liu [Thu, 13 Oct 2016 19:04:19 +0000 (19:04 +0000)]
Print stack trace for clang-move tool.
llvm-svn: 284148
Eric Liu [Thu, 13 Oct 2016 18:56:14 +0000 (18:56 +0000)]
Print stack trace for clang-change-namespace tool.
llvm-svn: 284147
Quentin Colombet [Thu, 13 Oct 2016 18:46:38 +0000 (18:46 +0000)]
[AArch64][RegisterBankInfo] Switch to fully static opds mapping for G_BITCAST.
NFC.
llvm-svn: 284146
Justin Lebar [Thu, 13 Oct 2016 18:45:17 +0000 (18:45 +0000)]
[CUDA] Allow static variables in __host__ __device__ functions, so long as they're never codegen'ed for device.
Reviewers: tra, rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25150
llvm-svn: 284145
Justin Lebar [Thu, 13 Oct 2016 18:45:13 +0000 (18:45 +0000)]
[CUDA] Disallow __shared__ variables in host functions.
Reviewers: tra, rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25143
llvm-svn: 284144
Justin Lebar [Thu, 13 Oct 2016 18:45:08 +0000 (18:45 +0000)]
[CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIf{Device,Host}Code().
Summary:
Together these let you easily create diagnostics that
- are never emitted for host code
- are always emitted for __device__ and __global__ functions, and
- are emitted for __host__ __device__ functions iff these functions are
codegen'ed.
At the moment there are only three diagnostics that need this treatment,
but I have more to add, and it's not sustainable to write code for emitting
every such diagnostic twice, and from a special wrapper in SemaCUDA.cpp.
While we're at it, don't emit the function name in
err_cuda_device_exceptions: It's not necessary to print it, and making
this work in the new framework in the face of a null value for
dyn_cast<FunctionDecl>(CurContext) isn't worth the effort.
Reviewers: rnk
Subscribers: cfe-commits, tra
Differential Revision: https://reviews.llvm.org/D25139
llvm-svn: 284143
Manman Ren [Thu, 13 Oct 2016 18:42:14 +0000 (18:42 +0000)]
Module: emit initializers for C/ObjC after r276159.
In r276159, we started to defer emitting initializers for VarDecls, but
forgot to add the initializers for non-C++ language.
rdar://
28740482
llvm-svn: 284142