Commit Graph

213023 Commits

Author SHA1 Message Date
Richard Smith d8d7e7e552 Fix layering violation: Analysis should not include headers from Transforms
(and in this case isn't even using anything from those headers).

llvm-svn: 250228
2015-10-13 21:32:32 +00:00
Rui Ueyama 38edcec272 ELF2: Add a note about performance.
llvm-svn: 250227
2015-10-13 21:28:02 +00:00
Davide Italiano cebb449e11 [ELF2] Add support for -Bsymbolic.
llvm-svn: 250225
2015-10-13 21:02:34 +00:00
Chad Rosier 7f08d80595 Typo.
llvm-svn: 250224
2015-10-13 20:59:16 +00:00
Davide Italiano 10d268d62c [ELF2/Linkerscript] Skip semicolon in linker directives parsing.
The documentation says: "You may separate commands using semicolons",
so they seem to be optional.

Differential Revision:	http://reviews.llvm.org/D13703

llvm-svn: 250223
2015-10-13 20:48:56 +00:00
Kevin Enderby 1c1add44b6 Tweak to r250117 and change to use ErrorOr and drop isSizeValid for
ArchiveMemberHeader, suggestion by Rafael Espíndola.

Also The clang-x86-win2008-selfhost bot still does not like the
malformed-machos 00000031.a test, so removing it for now.  All
the other bots are fine with it however.

llvm-svn: 250222
2015-10-13 20:48:04 +00:00
Aaron Ballman a742b84e5d Exposing an existing checker under the name cert-err61-cpp, as it corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR61-CPP.+Catch+exceptions+by+lvalue+reference
llvm-svn: 250221
2015-10-13 20:42:41 +00:00
Hal Finkel 515ed44776 [ELF2/PPC64] Fix the end-of-buffer check for TOC restoration
We'd miss the nop if it really did come right at the end of the buffer (nice
off-by-one error).

llvm-svn: 250220
2015-10-13 20:31:33 +00:00
Joseph Tremoulet 28c89bbb36 [WinEH] Add CoreCLR EH table emission
Summary:
Emit the handler and clause locations immediately after the standard
xdata.
Clauses are emitted in the same order and format used to communiate them
to the CLR Execution Engine.
Add a lit test to verify correct table generation on a small but
interesting example function.

Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: pgavlin, AndyAyers, llvm-commits

Differential Revision: http://reviews.llvm.org/D13451

llvm-svn: 250219
2015-10-13 20:18:27 +00:00
Duncan P. N. Exon Smith a73371a9b7 AMDGPU: Remove implicit ilist iterator conversions, NFC
One of the changes in lib/Target/AMDGPU/AMDGPUMCInstLower.cpp was a new
one.  Previously, bundle iterators and single-instruction iterators
could be compared to each other (comparing on underlying pointers).
I changed a comparison from using `MBB->end()` to using
`MBB->instr_end()`, since both end iterators should point at the some
place anyway.

I don't think the implicit conversion between the two iterator types is
a good idea since it's fairly easy to accidentally compare to the wrong
thing (they aren't always end iterators).  Otherwise I would have just
added the conversion.

Even with that, no there should be functionality change here.

llvm-svn: 250218
2015-10-13 20:07:10 +00:00
Tobias Grosser 6b948d5efb [tests] More testing for PHI-nodes in non-affine regions
We harden one test case by ensuring no additional stores may possibly be
introduced between the stores we check for and the basic block terminator
statements.

We also add a test case for the situation where a value that is passed from
a non-affine region to a PHI node does not dominate the exit of the non-affine
region. This case has come up in patch reviews, so we make sure it is properly
handled today and in the future.

llvm-svn: 250217
2015-10-13 20:03:09 +00:00
Duncan P. N. Exon Smith d3b9df02b3 AArch64: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250216
2015-10-13 20:02:15 +00:00
Rui Ueyama 34f2924675 ELF2: Add comments.
llvm-svn: 250215
2015-10-13 19:51:57 +00:00
Duncan P. N. Exon Smith e400a7d412 SelectionDAG: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250214
2015-10-13 19:47:46 +00:00
Zachary Turner 02545feb2e Change PyFile_FromFile to use PyFile_FromFd when using Py3.
llvm-svn: 250213
2015-10-13 19:32:53 +00:00
Hal Finkel 600ff141ec [ELF2] Simplify the NOBITS sorting logic
As Rafael suggested in his review of r250190, we can simplify this by writing
it like the earlier checks.

llvm-svn: 250212
2015-10-13 19:27:12 +00:00
Duncan P. N. Exon Smith be4d8cba1c Scalar: Remove remaining ilist iterator implicit conversions
Remove remaining `ilist_iterator` implicit conversions from
LLVMScalarOpts.

This change exposed some scary behaviour in
lib/Transforms/Scalar/SCCP.cpp around line 1770.  This patch changes a
call from `Function::begin()` to `&Function::front()`, since the return
was immediately being passed into another function that takes a
`Function*`.  `Function::front()` started to assert, since the function
was empty.  Note that `Function::end()` does not point at a legal
`Function*` -- it points at an `ilist_half_node` -- so the other
function was getting garbage before.  (I added the missing check for
`Function::isDeclaration()`.)

Otherwise, no functionality change intended.

llvm-svn: 250211
2015-10-13 19:26:58 +00:00
Hal Finkel ea244fcb84 [ELF2] Drop unnecessary lld flags from test/elf2/ppc64-toc-restore.s
As Rafael pointed out in his review of r250110, -dynamic-linker, -rpath and
--export-dynamic are unnecessary.

llvm-svn: 250210
2015-10-13 19:16:56 +00:00
Hal Finkel 9abc2a50b3 [ELF2] Only call getPPC64SectionRank for EM_PPC64 files
Suggested by Rafael in his review of r250100. As Rafael points out, this may
grow into a switch in the future, but regardless, calling this on files for
other architectures is unnecessary.

llvm-svn: 250209
2015-10-13 19:07:29 +00:00
Rui Ueyama deac4909c7 Update README.
llvm-svn: 250208
2015-10-13 18:55:59 +00:00
Akira Hatanaka 5a4e4f8d8a [AArch64] Check the size of the vector before accessing its elements.
This fixes an assert in AArch64AsmParser::MatchAndEmitInstruction.

rdar://problem/23081753

llvm-svn: 250207
2015-10-13 18:55:34 +00:00
Hal Finkel 08be61407b [ELF2] Fixup comment about section sorting requirements
As Rafael pointed out in his review of r250100, the NOBITS check is no longer
the last requirement.

llvm-svn: 250206
2015-10-13 18:55:01 +00:00
Hal Finkel d962ef0bf8 Revert: "Re: [lld] r249752 - Revert: r249728 - Roll back r249726 and r249723 because they broke buildbots."
This has turned out to be unnecessary, and while some ability to set VAStart
will be needed at some point, this is not clearly the right direction.

llvm-svn: 250205
2015-10-13 18:50:28 +00:00
Cong Hou 7ab123a5cf Update the branch weight metadata in JumpThreading pass.
Currently in JumpThreading pass, the branch weight metadata is not updated after CFG modification. Consider the jump threading on PredBB, BB, and SuccBB. After jump threading, the weight on BB->SuccBB should be adjusted as some of it is contributed by the edge PredBB->BB, which doesn't exist anymore. This patch tries to update the edge weight in metadata on BB->SuccBB by scaling it by 1 - Freq(PredBB->BB) / Freq(BB->SuccBB).

Differential revision: http://reviews.llvm.org/D10979

llvm-svn: 250204
2015-10-13 18:43:10 +00:00
Eric Christopher e45972719e Move the adc-builtins test to the pattern of the other builtins
tests by predefining _MM_MALLOC_H rather than use -ffreestanding.

llvm-svn: 250203
2015-10-13 18:40:21 +00:00
Eric Christopher 525334cf6c Add subtarget feature support for 3dnowa to the 3dnowa intrinsics.
llvm-svn: 250202
2015-10-13 18:40:17 +00:00
Xinliang David Li f556a7e3c3 [PGO]: Eliminate calls to __llvm_profile_register_function for Linux.
On Linux, the profile runtime can use __start_SECTNAME and __stop_SECTNAME
symbols defined by the linker to locate the start and end location of
a named section (with C name). This eliminates the need for instrumented
binary to call __llvm_profile_register_function during start-up time.

llvm-svn: 250200
2015-10-13 18:40:00 +00:00
Xinliang David Li 3dd8817d84 [PGO]: Eliminate calls to __llvm_profile_register_function for Linux.
On Linux, the profile runtime can use __start_SECTNAME and __stop_SECTNAME
symbols defined by the linker to locate the start and end location of
a named section (with C name). This eliminates the need for instrumented
binary to call __llvm_profile_register_function during start-up time.

llvm-svn: 250199
2015-10-13 18:39:48 +00:00
Jonathan Peyton 33d1d283f6 Detect final task in GOMP interface.
llvm-svn: 250198
2015-10-13 18:36:22 +00:00
Duncan P. N. Exon Smith 3a9c9e3dcd Scalar: Remove some implicit ilist iterator conversions, NFC
Remove some of the implicit ilist iterator conversions in
LLVMScalarOpts.  More to go.

llvm-svn: 250197
2015-10-13 18:26:00 +00:00
Chris Bieneman 4977f4261e [CMake] When building clang as an external project we should pass through all variables that start with COMPILER_RT
llvm-svn: 250196
2015-10-13 18:17:30 +00:00
Zachary Turner f8b22f8fea Fix ref counting of Python objects.
PythonObjects were being incorrectly ref-counted. This problem was
pervasive throughout the codebase, leading to an unknown number of memory
leaks and potentially use-after-free.

The issue stems from the fact that Python native methods can either return
"borrowed" references or "owned" references. For the former category, you
*must* incref it prior to decrefing it. And for the latter category, you
should not incref it before decrefing it. This is mostly an issue when a
Python C API method returns a `PyObject` to you, but it can also happen with
a method accepts a `PyObject`. Notably, this happens in `PyList_SetItem`,
which is documented to "steal" the reference that you give it. So if you
pass something to `PyList_SetItem`, you cannot hold onto it unless you
incref it first. But since this is one of only two exceptions in the
entire API, it's confusing and difficult to remember.

Our `PythonObject` class was indiscriminantely increfing every object it
received, which means that if you passed it an owned reference, you now
have a dangling reference since owned references should not be increfed.
We were doing this in quite a few places.

There was also a fair amount of manual increfing and decrefing prevalent
throughout the codebase, which is easy to get wrong.

This patch solves the problem by making any construction of a
`PythonObject` from a `PyObject` take a flag which indicates whether it is
an owned reference or a borrowed reference. There is no way to construct a
`PythonObject` without this flag, and it does not offer a default value,
forcing the user to make an explicit decision every time.

All manual uses of `PyObject` have been cleaned up throughout the codebase
and replaced with `PythonObject` in order to make RAII the predominant
pattern when dealing with native Python objects.

Differential Revision: http://reviews.llvm.org/D13617
Reviewed By: Greg Clayton

llvm-svn: 250195
2015-10-13 18:16:15 +00:00
Aaron Ballman af0159bafb Updating the documentation for the readability-inconsistent-declaration-parameter-name checker.
Patch by Piotr Dziwinski.

llvm-svn: 250194
2015-10-13 18:13:10 +00:00
Duncan P. N. Exon Smith 4ead920ce5 ExecutionEngine: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250193
2015-10-13 18:11:02 +00:00
Duncan P. N. Exon Smith 1275bffa96 OrcJIT: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250192
2015-10-13 18:10:59 +00:00
Rui Ueyama 93bfee5f70 ELF2: Avoid using "finalize" as a function name.
"finalize" does not give a hint about what that function is actually
going to do. This patch make it more specific by renaming scanShlibUndefined.
Also add a comment that we basically ignore undefined symbols in DSOs except
this function.

llvm-svn: 250191
2015-10-13 18:10:33 +00:00
Hal Finkel 0d7e83bbc4 [ELF2] Ensure strict weak ordering in section sorting (v2)
The fix in r250109 to ensure a strict weak ordering in the section sorting was
a bit overzealous. We only use the NOBITS comparison if either A or B is a
NOBITS section. Otherwise, we fall through to the target-specific ranking
function. Failure to do this causes the sorting to fail in cases where, for
example, a .dynamic section happens to end up in between .got and .toc, etc. in
the initial ordering (.dynamic has a type SHT_DYNAMIC, compared to SHT_PROGBITS
or SHT_NOBITS).

llvm-svn: 250190
2015-10-13 17:57:46 +00:00
Adrian McCarthy ed2146d235 Xfail a watchpoint test on Windows, until Windows implements watchpoints.
llvm-svn: 250189
2015-10-13 17:55:58 +00:00
Adrian McCarthy 1d34f74470 Fix TestTargetAPI.py test for users who use Swig 3.0.5 or greater.
DifferentialRevision: http://reviews.llvm.org/D13679
llvm-svn: 250188
2015-10-13 17:54:15 +00:00
Duncan P. N. Exon Smith 1732340bfa IPO: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250187
2015-10-13 17:51:03 +00:00
Duncan P. N. Exon Smith e82c286fba Instrumentation: Remove ilist iterator implicit conversions, NFC
llvm-svn: 250186
2015-10-13 17:39:10 +00:00
Duncan P. N. Exon Smith c8f02e7540 Interpreter: Remove implicit ilist iterator conversions, NFC
llvm-svn: 250185
2015-10-13 17:33:41 +00:00
Kevin Enderby d1c66ddf00 The issue with the malformed-machos 00000031.a test is that it needed ‘-arch x86_64’
flag as it was a Mach-O universal file.

The default as to which architecture slice that is dumped without an -arch flag
depends on the host architecture and the contents of the universal file.  The
malformed archive 00000031.a file has both an x86_64 and i386 slice.  So for
for x86_64 hosts only that slice is dumped, for non-x86_64 hosts, which is many
of the bots both slices are dumped.

The test is intended to only check that the malformation of the x86_64 which
has a non-decimal characters in the size field of the archive header so it no
longer crashes.

The problem turned out that the i388 slice of the malformed archive had a
different malformation which was causing the non-x86_64 bots to get this error:

llvm-objdump -macho -disassemble -arch i386 00000031.a 
Archive : .00000031.a
00000031.a(c_start.o):
LLVM ERROR: Symbol name entry points before beginning or past end of file.

and causing the test as it was written to fail.  So by adding ‘-arch x86_64’ it
should correct the test and the malformation on the i388 slice will not be
dumped.

Also the removal of the malformed-machos mem-crup-0261.macho was not causing
the issue so that is put back in.

Sorry for the churn on these tests, Kev

llvm-svn: 250184
2015-10-13 17:06:34 +00:00
Duncan P. N. Exon Smith 9f8aaf21ba InstCombine: Remove ilist iterator implicit conversions, NFC
Stop relying on implicit conversions of ilist iterators in
LLVMInstCombine.  No functionality change intended.

llvm-svn: 250183
2015-10-13 16:59:33 +00:00
Rui Ueyama c58656c7c0 Revert r250169: "This patch implements basic variant of lazy loading for x86_x64 and for X86 targets."
With this patch LLD is not able to self-host on x86-64 Linux.

llvm-svn: 250182
2015-10-13 16:59:30 +00:00
Duncan P. N. Exon Smith fb1743a32e BitcodeReader: Remove ilist iterator implicit conversions, NFC
Get LLVMBitReader building without relying on `ilist_iterator` implicit
conversions.

llvm-svn: 250181
2015-10-13 16:48:55 +00:00
Tamas Berghammer 1fa5c4b944 Fix cast in arm watchpoint handling code
We had an incorrect sign extension when castion from a pointer to an
lldb::addr_t what broke the watchpoint hit detection on arm.

llvm-svn: 250180
2015-10-13 16:48:04 +00:00
Joseph Tremoulet 1e2f062ec5 [WinEH] Iterate state changes instead of invokes
Summary:
Add an iterator that can walk across blocks and which visits the state
transitions rather than state ranges, with explicit transitions to -1
indicating the presence of top-level calls that may throw and cause the
current function to unwind to caller.  This will simplify code that needs
to identify nested try regions.

Refactor SEH and C++EH table generation to use the new
InvokeStateChangeIterator, and remove the InvokeLabelIterator they were
using.


Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13623

llvm-svn: 250179
2015-10-13 16:44:30 +00:00
Rui Ueyama c2c22f44bf Remove extra semicolons for -Wpedantic.
llvm-svn: 250178
2015-10-13 16:44:13 +00:00
Xinliang David Li c758387e9b Fix a couple of comments; NFC
llvm-svn: 250177
2015-10-13 16:35:59 +00:00