Chaoren Lin [Thu, 23 Apr 2015 22:19:29 +0000 (22:19 +0000)]
Fix build.
llvm-svn: 235653
Reid Kleckner [Thu, 23 Apr 2015 21:36:32 +0000 (21:36 +0000)]
Remove trivial assert to fix NDEBUG Werror builds
llvm-svn: 235652
David Blaikie [Thu, 23 Apr 2015 21:36:23 +0000 (21:36 +0000)]
Recommit r235458: [opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst
(reverted in r235533)
Original commit message:
"Calls to llvm::Value::mutateType are becoming extra-sensitive now that
instructions have extra type information that will not be derived from
operands or result type (alloca, gep, load, call/invoke, etc... ). The
special-handling for mutateType will get more complicated as this work
continues - it might be worth making mutateType virtual & pushing the
complexity down into the classes that need special handling. But with
only two significant uses of mutateType (vectorization and linking) this
seems OK for now.
Totally open to ideas/suggestions/improvements, of course.
With this, and a bunch of exceptions, we can roundtrip an indirect call
site through bitcode and IR. (a direct call site is actually trickier...
I haven't figured out how to deal with the IR deserializer's lazy
construction of Function/GlobalVariable decl's based on the type of the
entity which means looking through the "pointer to T" type referring to
the global)"
The remapping done in ValueMapper for LTO was insufficient as the types
weren't correctly mapped (though I was using the post-mapped operands,
some of those operands might not have been mapped yet so the type
wouldn't be post-mapped yet). Instead use the pre-mapped type and
explicitly map all the types.
llvm-svn: 235651
Sergey Matveev [Thu, 23 Apr 2015 21:29:37 +0000 (21:29 +0000)]
Fix clang docs build.
llvm-svn: 235650
Reid Kleckner [Thu, 23 Apr 2015 21:22:30 +0000 (21:22 +0000)]
[WinEH] Replace more lpad value uses with undef
We were asserting on code like this:
extern "C" unsigned long _exception_code();
void might_crash(unsigned long);
void foo() {
__try {
might_crash(0);
} __except(1) {
might_crash(_exception_code());
}
}
Gtest and many other libraries get the exception code from the __except
block. What's supposed to happen here is that EAX is live into the
__except block, and it contains the exception code. Eventually we'll
represent that as a use of the landingpad ehptr value, but for now we
can replace it with undef.
llvm-svn: 235649
Richard Smith [Thu, 23 Apr 2015 21:20:19 +0000 (21:20 +0000)]
[modules] Remove the now-redundant import of all pending macros at the end of building a module.
Since we now track module macros separately from their visibility state, this
is no longer necessary.
llvm-svn: 235648
Quentin Colombet [Thu, 23 Apr 2015 21:17:39 +0000 (21:17 +0000)]
[MachineCopyPropagation] Handle undef flags conservatively so that we do not
remove copies that are useful after breaking some hardware dependencies.
In other words, handle this kind of situations conservatively by assuming reg2
is redefined by the undef flag.
reg1 = copy reg2
= inst reg2<undef>
reg2 = copy reg1
Copy propagation used to remove the last copy.
This is incorrect because the undef flag on reg2 in inst, allows next
passes to put whatever trashed value in reg2 that may help.
In practice we end up with this code:
reg1 = copy reg2
reg2 = 0
= inst reg2<undef>
reg2 = copy reg1
This fixes PR21743.
llvm-svn: 235647
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:57:39 +0000 (20:57 +0000)]
Unbreak build
llvm-svn: 235646
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:42:20 +0000 (20:42 +0000)]
[Hexagon] Minor cleanup in HexagonFrameLowering
llvm-svn: 235645
Richard Smith [Thu, 23 Apr 2015 20:40:50 +0000 (20:40 +0000)]
[modules] Store a ModuleMacro* on an imported macro directive rather than duplicating the info within it.
llvm-svn: 235644
Sergey Matveev [Thu, 23 Apr 2015 20:40:04 +0000 (20:40 +0000)]
Add clang/docs/SanitizerCoverage.rst
Moved from https://code.google.com/p/address-sanitizer/wiki/AsanCoverage
llvm-svn: 235643
Richard Smith [Thu, 23 Apr 2015 20:38:48 +0000 (20:38 +0000)]
Fix clang-tools-extra build after clang r235614.
llvm-svn: 235642
Tom Stellard [Thu, 23 Apr 2015 20:32:01 +0000 (20:32 +0000)]
R600/SI: Fix indirect addressing with a negative constant offset
When the base register index of the vector plus the constant offset
was less than zero, we were passing the wrong base register to the indirect
addressing instruction.
In this case, we need to set the base register to v0 and then add
the computed (negative) index to m0.
llvm-svn: 235641
Peter Collingbourne [Thu, 23 Apr 2015 20:31:35 +0000 (20:31 +0000)]
Thumb2: When applying branch optimizations, visit branches in reverse order.
The order in which branches appear in ImmBranches is approximately their
order within the function body. By visiting later branches first, we reduce
the distance between earlier forward branches and their targets, making it
more likely that the cbn?z optimization, which can only apply to forward
branches, will succeed for those earlier branches.
Differential Revision: http://reviews.llvm.org/D9185
llvm-svn: 235640
Peter Collingbourne [Thu, 23 Apr 2015 20:31:32 +0000 (20:31 +0000)]
ARM: When re-creating a branch via InsertBranch, preserve CPSR flags.
In particular, this preserves the kill flag, which allows the Thumb2 cbn?z
optimization to be applied in cases where a branch has been re-created after
the live variables analysis pass, e.g. by the machine block placement pass.
This appears to be low risk; a number of other targets seem to already be
doing something similar, e.g. AArch64, PowerPC.
Differential Revision: http://reviews.llvm.org/D9184
llvm-svn: 235639
Peter Collingbourne [Thu, 23 Apr 2015 20:31:30 +0000 (20:31 +0000)]
Thumb2: When optimizing for size, do not if-convert branches involving comparisons with zero.
This allows the constant island pass to lower these branches to cbn?z
instructions, resulting in a shorter instruction sequence.
Differential Revision: http://reviews.llvm.org/D9183
llvm-svn: 235638
Peter Collingbourne [Thu, 23 Apr 2015 20:31:26 +0000 (20:31 +0000)]
ARM: When spilling extra registers for alignment, prefer low registers on all Thumb targets.
This makes it more likely that we can use the 16-bit push and pop instructions
on Thumb-2, saving around 4 bytes per function.
Differential Revision: http://reviews.llvm.org/D9165
llvm-svn: 235637
Peter Collingbourne [Thu, 23 Apr 2015 20:31:22 +0000 (20:31 +0000)]
ARM: Only enforce 4-byte alignment on Thumb-2 functions with constant pools.
This appears to have been introduced back in r76698 as part of an unrelated
change. I can find no official ARM documentation stating that Thumb-2 functions
require 4-byte alignment; in fact, ARM documentation appears to contradict
this (see, e.g., ARM Architecture Reference Manual Thumb-2 Supplement,
section 2.6.1: "Thumb-2 enforces 16-bit alignment on all instructions.").
Also remove code that sets alignment for ARM functions, which is redundant
with code in the MachineFunction constructor, and remove the hidden
-arm-align-constant-islands flag, which has been enabled by default since
r146739 (Dec 2011) and has probably received sufficient testing by now.
Differential Revision: http://reviews.llvm.org/D9138
llvm-svn: 235636
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:26:21 +0000 (20:26 +0000)]
[Hexagon] Fix compiler warnings in release build
Patch by Aditya Nandakumar.
llvm-svn: 235635
Adam Nemet [Thu, 23 Apr 2015 20:09:20 +0000 (20:09 +0000)]
[getUnderlyingOjbects] Analyze loop PHIs further to remove false positives
Specifically, if a pointer accesses different underlying objects in each
iteration, don't look through the phi node defining the pointer.
The motivating case is the underlyling-objects-2.ll testcase. Consider
the loop nest:
int **A;
for (i)
for (j)
A[i][j] = A[i-1][j] * B[j]
This loop is transformed by Load-PRE to stash away A[i] for the next
iteration of the outer loop:
Curr = A[0]; // Prev_0
for (i: 1..N) {
Prev = Curr; // Prev = PHI (Prev_0, Curr)
Curr = A[i];
for (j: 0..N)
Curr[j] = Prev[j] * B[j]
}
Since A[i] and A[i-1] are likely to be independent pointers,
getUnderlyingObjects should not assume that Curr and Prev share the same
underlying object in the inner loop.
If it did we would try to dependence-analyze Curr and Prev and the
analysis of the corresponding SCEVs would fail with non-constant
distance.
To fix this, the getUnderlyingObjects API is extended with an optional
LoopInfo parameter. This is effectively what controls whether we want
the above behavior or the original. Currently, I only changed to use
this approach for LoopAccessAnalysis.
The other testcase is to guard the opposite case where we do want to
look through the loop PHI. If we step through an array by incrementing
a pointer, the underlying object is the incoming value of the phi as the
loop is entered.
Fixes rdar://problem/
19566729
llvm-svn: 235634
Adrian McCarthy [Thu, 23 Apr 2015 20:00:25 +0000 (20:00 +0000)]
Factor resolution of abbreviations and aliases so that they can be tested directly. reviews.llvm.org/D9033
llvm-svn: 235633
Jingyue Wu [Thu, 23 Apr 2015 20:00:04 +0000 (20:00 +0000)]
[NVPTX] run SeparateConstOffsetFromGEP before SLSR
Summary:
We pick this order because SeparateConstOffsetFromGEP may create more
opportunities for SLSR.
Test Plan:
reassociate-geps-and-slsr.ll
no performance regression on internal benchmarks
Reviewers: meheff
Subscribers: llvm-commits, jholewinski
Differential Revision: http://reviews.llvm.org/D9230
llvm-svn: 235632
Richard Smith [Thu, 23 Apr 2015 19:36:34 +0000 (19:36 +0000)]
Fix build of lldb after clang r235614.
llvm-svn: 235631
Tom Stellard [Thu, 23 Apr 2015 19:33:55 +0000 (19:33 +0000)]
R600/SI: Add missing -mcpu=SI to assembler test
llvm-svn: 235630
Tom Stellard [Thu, 23 Apr 2015 19:33:54 +0000 (19:33 +0000)]
R600/SI: Add assembler support for all CI and VI VOP1 instructions
llvm-svn: 235629
Tom Stellard [Thu, 23 Apr 2015 19:33:52 +0000 (19:33 +0000)]
R600/SI: v_mov_fed_b32 does not exist on VI
llvm-svn: 235628
Tom Stellard [Thu, 23 Apr 2015 19:33:51 +0000 (19:33 +0000)]
R600/SI: Use a better error message for unsupported instructions in the assembler
llvm-svn: 235627
Tom Stellard [Thu, 23 Apr 2015 19:33:48 +0000 (19:33 +0000)]
R600/SI: Improve AsmParser support for forced e64 encoding
We can now force e64 encoding even when the operands would be legal
for e32 encoding.
llvm-svn: 235626
Tom Stellard [Thu, 23 Apr 2015 18:50:14 +0000 (18:50 +0000)]
Implement fract builtin
This implementation was ported from the AMD builtin library
and has been tested with piglit, OpenCV, and the ocl conformance tests.
llvm-svn: 235620
Alexey Samsonov [Thu, 23 Apr 2015 18:43:08 +0000 (18:43 +0000)]
[ASan] Relax test modified in r235540 to pacify ARM buildbots.
llvm-svn: 235619
Andrew Kaylor [Thu, 23 Apr 2015 18:37:39 +0000 (18:37 +0000)]
[WinEH] Handle stubs for outlined functions that have only unreached terminators.
llvm-svn: 235618
Reid Kleckner [Thu, 23 Apr 2015 18:34:01 +0000 (18:34 +0000)]
Revert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works"
We still have some "uses remain after removal" issues in -O0 builds.
This reverts commit r235557.
llvm-svn: 235617
Hal Finkel [Thu, 23 Apr 2015 18:30:38 +0000 (18:30 +0000)]
[PowerPC] Enable printing instructions using aliases
TableGen had been nicely generating code to print a number of instructions using
shorter aliases (and PowerPC has plenty of short mnemonics), but we were not
calling it. For some of the aliases we support in the parser, TableGen can't
infer the "inverse" alias relationship, so there is still more to do.
Thus, after some hours of updating test cases...
llvm-svn: 235616
Chaoren Lin [Thu, 23 Apr 2015 18:28:04 +0000 (18:28 +0000)]
Fix TestFdLeak on Linux.
Summary:
LLGS leaks pipes (when launched by lldb), sockets (when launched by platform),
and/or log file to the inferior. This should prevent all possible leaks.
Reviewers: vharron, clayborg
Reviewed By: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9211
llvm-svn: 235615
Richard Smith [Thu, 23 Apr 2015 18:18:26 +0000 (18:18 +0000)]
[modules] Determine the set of macros exported by a submodule at the end of that submodule.
Previously we'd defer this determination until writing the AST, which doesn't
allow us to use this information when building other submodules of the same
module. This change also allows us to use a uniform mechanism for writing
module macro records, independent of whether they are local or imported.
llvm-svn: 235614
Reid Kleckner [Thu, 23 Apr 2015 18:07:13 +0000 (18:07 +0000)]
Don't emit lifetime markers when msan is enabled
In r235553, Clang started emitting lifetime markers more often. This
caused false negative in MSan, because MSan only poisons all allocas
once at function entry. Eventually, MSan should poison allocas at
lifetime start and probably also lifetime end, but until then, let's not
emit markers that aren't going to be useful.
llvm-svn: 235613
Zachary Turner [Thu, 23 Apr 2015 17:37:47 +0000 (17:37 +0000)]
Move DIContext.h to common DebugInfo location.
This will enable us to create a PDBContext so as to expose some
amount of debug info functionality through a common interace.
Differential Revision: http://reviews.llvm.org/D9205
Reviewed by: Alexey Samsonov
llvm-svn: 235612
Philip Reames [Thu, 23 Apr 2015 17:36:48 +0000 (17:36 +0000)]
Move Value.isDereferenceablePointer to ValueTracking [NFC]
Move isDereferenceablePointer function to Analysis. This function recursively tracks dereferencability over a chain of values like other functions in ValueTracking.
This refactoring is motivated by further changes to support dereferenceable_or_null attribute (http://reviews.llvm.org/D8650). isDereferenceablePointer will be extended to perform context-sensitive analysis and IR is not a good place to have such functionality.
Patch by: Artur Pilipenko <apilipenko@azulsystems.com>
Differential Revision: reviews.llvm.org/D9075
llvm-svn: 235611
Pirama Arumuga Nainar [Thu, 23 Apr 2015 17:32:25 +0000 (17:32 +0000)]
[AArch64] Add nvcast patterns for v4f16 and v8f16
Summary:
Constant stores of f16 vectors can create NvCast nodes from various
operand types to v4f16 or v8f16 depending on patterns in the stored
constants. This patch adds nvcast rules with v4f16 and v8f16 values.
AArchISelLowering::LowerBUILD_VECTOR has the details on which constant
patterns generate the nvcast nodes.
Reviewers: jmolloy, srhines, ab
Subscribers: rengolin, aemerson, llvm-commits
Differential Revision: http://reviews.llvm.org/D9201
llvm-svn: 235610
Pirama Arumuga Nainar [Thu, 23 Apr 2015 17:16:27 +0000 (17:16 +0000)]
[AArch64] Handle vec4, vec8, vec16 *itofp for half
Summary:
Set operation action for SINT_TO_FP and UINT_TO_FP nodes with v4i32,
v8i8, v8i16 inputs to allow promotion of v4f16 results.
Add tests for sitofp and uitofp for vec4, vec8, vec16, and i8, i16, i32,
and i64 vectors. Only missing tests are for v16i8 and v16i16 as the
shift operations are too complicated to write a proper check sequence.
The conversions from v4i64 to v4f16 do not depend on this patch - v4i64
is split and the conversion gets handled while lowering v2i64. I am
adding a test here for completeness.
Reviewers: aemerson, rengolin, ab, jmolloy, srhines
Subscribers: rengolin, aemerson, llvm-commits
Differential Revision: http://reviews.llvm.org/D9166
llvm-svn: 235609
Hans Wennborg [Thu, 23 Apr 2015 16:45:24 +0000 (16:45 +0000)]
Re-commit r235560: Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)
Third time's the charm. The previous commit was reverted as a
reverse for-loop in SelectionDAGBuilder::lowerWorkItem did 'I--'
on an iterator at the beginning of a vector, causing asserts
when using debugging iterators. This commit fixes that.
llvm-svn: 235608
Marshall Clow [Thu, 23 Apr 2015 16:45:08 +0000 (16:45 +0000)]
Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio
llvm-svn: 235607
Aaron Ballman [Thu, 23 Apr 2015 16:14:19 +0000 (16:14 +0000)]
Extend format specifier checking to include field function pointers in addition to variable function pointers. Addresses PR21082.
llvm-svn: 235606
Aaron Ballman [Thu, 23 Apr 2015 16:12:42 +0000 (16:12 +0000)]
Diagnose variadic main() as an extension; addresses PR17905.
llvm-svn: 235605
Sanjay Patel [Thu, 23 Apr 2015 16:07:50 +0000 (16:07 +0000)]
use update_llc_test_checks.py to tighten checking; remove unnecessary CPU param
llvm-svn: 235604
Krzysztof Parzyszek [Thu, 23 Apr 2015 16:05:39 +0000 (16:05 +0000)]
[Hexagon] Shrink-wrap stack frame (Hexagon-specific)
llvm-svn: 235603
Krzysztof Parzyszek [Thu, 23 Apr 2015 15:12:49 +0000 (15:12 +0000)]
[Hexagon] Add testcases for stack alignment and variable-sized objects
llvm-svn: 235602
Toma Tabacu [Thu, 23 Apr 2015 14:48:38 +0000 (14:48 +0000)]
[mips] [IAS] Move NOP emission after pseudo-instruction expansion. NFC.
As suggested in the review for http://reviews.llvm.org/D8537.
llvm-svn: 235601
Daniel Jasper [Thu, 23 Apr 2015 13:58:40 +0000 (13:58 +0000)]
clang-format: Properly detect variable declarations with ObjC.
Before:
LoooooooooooooooooooooooooooooooooooooooongType
LoooooooooooooooooooooooooooooooooooooongVariable([A a]);
After:
LoooooooooooooooooooooooooooooooooooooooongType
LoooooooooooooooooooooooooooooooooooooongVariable([A a]);
llvm-svn: 235599
Aidan Dodds [Thu, 23 Apr 2015 13:57:30 +0000 (13:57 +0000)]
Replace use of %zu with PRIu64 in DYDL logging message.
llvm-svn: 235598
Aaron Ballman [Thu, 23 Apr 2015 13:41:59 +0000 (13:41 +0000)]
Revert r235560; this commit was causing several failed assertions in Debug builds using MSVC's STL. The iterator is being used outside of its valid range.
llvm-svn: 235597
Filipe Cabecinhas [Thu, 23 Apr 2015 13:38:21 +0000 (13:38 +0000)]
Be more strict about the operand for the array type in BitcodeReader
Summary: Bug found with AFL fuzz.
Reviewers: rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9016
llvm-svn: 235596
Filipe Cabecinhas [Thu, 23 Apr 2015 13:25:35 +0000 (13:25 +0000)]
Verify sizes when trying to read a BitcodeAbbrevOp
Summary:
Make sure the abbrev operands are valid and that we can read/skip them
afterwards.
Bug found with AFL fuzz.
Reviewers: rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9030
llvm-svn: 235595
Daniel Sanders [Thu, 23 Apr 2015 13:23:21 +0000 (13:23 +0000)]
[asan] debug_mapping.cc should also pass when the leading digit of SHADOW_SCALE is hexadecimal.
Summary:
Previously the CHECK directive for SHADOW_SCALE only matched decimal digits
causing it to match '7' on x86_64 instead of the whole value.
This fixes a failure on mips-linux-gnu targets where the leading digit is 'a'.
Reviewers: kcc, sagar, timurrrr
Reviewed By: timurrrr
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9199
llvm-svn: 235594
Timur Iskhodzhanov [Thu, 23 Apr 2015 13:18:50 +0000 (13:18 +0000)]
[Sanitizer coverage] Print out the error number if OpenFile fails
llvm-svn: 235593
Daniel Jasper [Thu, 23 Apr 2015 12:59:09 +0000 (12:59 +0000)]
clang-format: Allow splitting "= default" and "= delete".
Otherwise, this can violate the column limit.
llvm-svn: 235592
Timur Iskhodzhanov [Thu, 23 Apr 2015 12:58:11 +0000 (12:58 +0000)]
[ASan/Win] Initialize sandbox-related stuff when asked to
llvm-svn: 235591
Timur Iskhodzhanov [Thu, 23 Apr 2015 12:57:29 +0000 (12:57 +0000)]
[ASan/Win] Don't forget to set *last_error if OpenFile fails
llvm-svn: 235590
Ilia K [Thu, 23 Apr 2015 12:48:42 +0000 (12:48 +0000)]
MI fix allowing multiple logging instances of lldb-mi to run simultaneously.
Summary:
Currently if two instances of lldb-mi are running with logging enabled using '--log' the log file conflicts. This produces the following error
MI: Error: File Handler. Error Permission denied opening 'C:\Users\Ewan\LLVM\build\Debug\bin\lldb-mi-log.txt'
Fixed in this patch by renaming lldb-mi-log.txt based on the date, e.g. lldb-mi-log.txt-
20150316163631.log, and moving the file into the temp directory by using the --log-dir option.
Regrading previous review comments the P_tmpdir macro is defined in Windows but always points to "\", which doesn't help much. Also when using the Windows API for GetTempPath() dynamic memory seems much more messy.
Patch from ewan@codeplay.com
Reviewers: abidh, EwanCrawford
Subscribers: zturner, lldb-commits, deepak2427
Differential Revision: http://reviews.llvm.org/D9054
llvm-svn: 235589
Tobias Grosser [Thu, 23 Apr 2015 12:23:56 +0000 (12:23 +0000)]
JScoP Import/Export: Ensure parameters have the same isl_id
When reading parameters from a JSON file parameters with identical names
may be related to different isl_ids, which then causes isl to treat them
as differnet objects. This does not cause issues at the moment, but has
shown problematic in subsequent schedule tree changes.
This commit will be tested by the following changes.
llvm-svn: 235588
Tamas Berghammer [Thu, 23 Apr 2015 10:56:51 +0000 (10:56 +0000)]
Update cpsr register in BLX instruction emulation
Write the new cpsr value into the cpsr register if the BL or the BLX
instruction change the instruction set on arm.
Differential revision: http://reviews.llvm.org/D9188
llvm-svn: 235585
Tamas Berghammer [Thu, 23 Apr 2015 10:54:27 +0000 (10:54 +0000)]
Fix test expectation in TestNoreturnUnwind
The test case lookinhg for the abort function in the stack trace.
Previously it lookd for a function which ends with "abort" but on some
system there are multiple such functions (e.g.: on android abort calls
__libc_android_abort) what made the test fail. This CL change the
behaviour to look for the abort function based on a fix list of names.
llvm-svn: 235584
Daniel Jasper [Thu, 23 Apr 2015 10:23:53 +0000 (10:23 +0000)]
clang-format: Don't add unwanted space when creating new arrays.
Before:
char** newargv = new char* [argc];
After:
char** newargv = new char*[argc];
llvm-svn: 235583
Daniel Jasper [Thu, 23 Apr 2015 09:54:10 +0000 (09:54 +0000)]
clang-format: [Proto] Don't linewrap top-level options.
They are very similar to import statements.
llvm-svn: 235582
Dmitry Vyukov [Thu, 23 Apr 2015 09:33:27 +0000 (09:33 +0000)]
tsan: support setuid call
Currently the call hangs because the background thread
does not handle SIGSETXID signal.
llvm-svn: 235581
Daniel Jasper [Thu, 23 Apr 2015 09:23:17 +0000 (09:23 +0000)]
clang-format: Support nested block formatting with ColumnLimit=0.
llvm-svn: 235580
Pavel Labath [Thu, 23 Apr 2015 09:04:35 +0000 (09:04 +0000)]
[NativeProcessLinux] Fix race condition during inferior thread creation
The following situation occured if we were stopping a process (due to breakpoint, watchpoint, ...
hit) while a new thread was being created.
- process has two threads: A and B.
- thread A hits a breakpoint: we send a STOP signal to thread B and register a callback with
ThreadStateCoordinator to send a stop notification after the thread stops.
- thread B stops, but not due to the SIGSTOP, but on a thread creation event (of a new thread C).
We are unaware of our desire to stop, so we queue ThreadStopped and RequestResume operations
with TSC, so the thread can continue running.
- TSC receives the ThreadStopped event, sees that all threads are stopped and fires the delayed
stop notification.
- immediately after that TSC gets the RequestResume operation, so it resumes the thread.
At this point the state is inconsistent because LLDB thinks the process is stopped and will start
issuing commands to it, but one of the threads is in fact running. Things eventually break.
I address this problem by omitting the two TSC events altogether and Resuming the thread B
directly. This way the short stop is invisible to the TSC and the delayed notification will not
fire. We will fire the notification when we actually process the SIGSTOP on thread B.
When we get the initial SIGSTOP for thread C, we also resume the thread and send a
ThreadWasCreated message (is_stopped = false) to the TSC. This way, the TSC can stop the thread
on its own and handle the stop event later. This way the state of the new thread is correctly
handled as well (thanks Chaoren for the idea).
This patch also removes the synchronisation between the thread creation notifications on threads
B and C. The need for this synchronisation is unclear (the comments seem to hint that the new
thread is "fully created" only after we process both events, but I have noticed no regressions in
treating it as "created" even after just processing the initial C event), but it is a source for
many kinds of obscure races, since it introduces a new thread state "Launching" and the rest of
the code does not handle this state at all (what happens if we get a resume request from LLDB
while this thread is launching? what happens if we get a stop request? etc.).
This fixes the "spurious $O packet" problem in TestPrintStackTraces.py. However, the test remains
disabled on i386 due to the VDSO issue.
Test Plan:
TestPrintStackTraces works on x86_64. No regressions in the rest of the test suite.
Reviewers: vharron, chaoren
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9145
llvm-svn: 235579
Simon Pilgrim [Thu, 23 Apr 2015 08:43:13 +0000 (08:43 +0000)]
[DAGCombiner] Remove extra bitcasts surrounding vector shuffles
Patch to remove extra bitcasts from shuffles, this is often a legacy of XformToShuffleWithZero being used to combine bitmaskings (of float vectors bitcast to integer vectors) into shuffles: bitcast(shuffle(bitcast(s0),bitcast(s1))) -> shuffle(s0,s1)
Differential Revision: http://reviews.llvm.org/D9097
llvm-svn: 235578
Karthik Bhat [Thu, 23 Apr 2015 08:29:20 +0000 (08:29 +0000)]
Move common loop utility function isInductionPHI into LoopUtils.cpp
This patch refactors the definition of common utility function "isInductionPHI" to LoopUtils.cpp.
This fixes compilation error when configured with -DBUILD_SHARED_LIBS=ON
llvm-svn: 235577
Alexey Bataev [Thu, 23 Apr 2015 07:56:25 +0000 (07:56 +0000)]
[OPENMP] Fix for failed tests for 'omp atomic write' construct.
llvm-svn: 235576
David Majnemer [Thu, 23 Apr 2015 07:42:08 +0000 (07:42 +0000)]
[MS ABI] Add support for mangling VLA types
Treat a VLA type like an incomplete array type.
llvm-svn: 235575
Mohit K. Bhakkad [Thu, 23 Apr 2015 06:36:20 +0000 (06:36 +0000)]
[LLDB][MIPS] Add MIPS32 and MIPS64 core revisions
Patch by Jaydeep Patil
Added MIPS32 and MIPS64 core revisions. This would be followed by register context and emulate-instruction for MIPS32.
DYLDRendezvous.cpp:
On Linux link map struct does not contain extra load offset field.
Reviewers: clayborg
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9190
llvm-svn: 235574
Alexey Bataev [Thu, 23 Apr 2015 06:35:10 +0000 (06:35 +0000)]
[OPENMP] Codegen for 'atomic capture'.
Adds codegen for 'atomic capture' constructs with the following forms of expressions/statements:
v = x binop= expr;
v = x++;
v = ++x;
v = x--;
v = --x;
v = x = x binop expr;
v = x = expr binop x;
{v = x; x = binop= expr;}
{v = x; x++;}
{v = x; ++x;}
{v = x; x--;}
{v = x; --x;}
{x = x binop expr; v = x;}
{x binop= expr; v = x;}
{x++; v = x;}
{++x; v = x;}
{x--; v = x;}
{--x; v = x;}
{x = x binop expr; v = x;}
{x = expr binop x; v = x;}
{v = x; x = expr;}
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted.
Update of 'v' is not required to be be atomic with respect to the read or write of the 'x'.
bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
atomic store <old/new x>, <v>
...
Differential Revision: http://reviews.llvm.org/D9049
llvm-svn: 235573
David Majnemer [Thu, 23 Apr 2015 05:21:20 +0000 (05:21 +0000)]
[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args
Type backreferences for arguments use the DecayedType's original type.
Because of this, arguments with the same canonical type with the same
mangling would not backreference each other if one was a
ConstantArrayType while the other was an IncompleteArrayType. Solve
this by canonicalizing the ConstantArrayType to a suitable
IncompleteArrayType.
This fixes PR23325.
llvm-svn: 235572
Karthik Bhat [Thu, 23 Apr 2015 04:51:44 +0000 (04:51 +0000)]
Add support to interchange loops with reductions.
This patch enables interchanging of tightly nested loops with reductions.
Differential Revision: http://reviews.llvm.org/D8314
llvm-svn: 235571
Richard Smith [Thu, 23 Apr 2015 04:13:52 +0000 (04:13 +0000)]
[modules] Actually allocate the extra space we use for the tail-allocated array
in this class.
llvm-svn: 235570
Alexey Samsonov [Thu, 23 Apr 2015 01:50:56 +0000 (01:50 +0000)]
[UBSan] Unify the way we report overflow in increment/decrement operator.
llvm-svn: 235569
Alexey Samsonov [Thu, 23 Apr 2015 01:50:45 +0000 (01:50 +0000)]
Unify the way we report overflow in increment/decrement operator.
Summary:
Make sure signed overflow in "x--" is checked with
llvm.ssub.with.overflow intrinsic and is reported as:
"-
2147483648 - 1 cannot be represented in type 'int'"
instead of:
"-
2147483648 + -1 cannot be represented in type 'int'"
, like we do for unsigned overflow.
Test Plan: clang + compiler-rt regression test suite
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8236
llvm-svn: 235568
Alexey Samsonov [Thu, 23 Apr 2015 01:08:31 +0000 (01:08 +0000)]
[UBSan] Make sure proper error summary is printed for -fsanitize=float-cast-overflow.
float-cast-overflow handler doesn't have source location provided by the
compiler, but we still have *some* source location if we have a
symbolizer.
llvm-svn: 235567
Andrew Kaylor [Thu, 23 Apr 2015 00:38:22 +0000 (00:38 +0000)]
[WinEH] Removing seh-filter.ll until I can determine its validity
llvm-svn: 235566
Justin Bogner [Thu, 23 Apr 2015 00:31:16 +0000 (00:31 +0000)]
InstrProf: Fix a shadowing error that would break length of profile names
We try to use the member variable "FuncName" here, but we've also used
that name as a parameter. This ends with us getting the length of the
function name wrong when we generate the coverage data.
llvm-svn: 235565
Jim Ingham [Thu, 23 Apr 2015 00:28:25 +0000 (00:28 +0000)]
Missed one piece when committing r235538.
llvm-svn: 235564
Andrew Kaylor [Thu, 23 Apr 2015 00:20:44 +0000 (00:20 +0000)]
[WinEH] Don't skip landing pads that end with an unreachable instruction.
llvm-svn: 235563
Reid Kleckner [Wed, 22 Apr 2015 23:39:15 +0000 (23:39 +0000)]
[WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatch
These extra endcatch markers aren't helping identify regions to outline,
so let's get rid of them. LLVM outlines (more or less) from begincatch
to endcatch. Any unwind edge from an enclosed invoke is a transition to
a new exception handler, which has it's own outlining markers.
llvm-svn: 235562
Hans Wennborg [Wed, 22 Apr 2015 23:14:56 +0000 (23:14 +0000)]
Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)
This is a re-commit of r235101, which also fixes the problems with the previous patch:
- Switches with only a default case and non-fallthrough were handled incorrectly
- The previous patch tickled a bug in PowerPC Early-Return Creation which is fixed here.
> This is a major rewrite of the SelectionDAG switch lowering. The previous code
> would lower switches as a binary tre, discovering clusters of cases
> suitable for lowering by jump tables or bit tests as it went along. To increase
> the likelihood of finding jump tables, the binary tree pivot was selected to
> maximize case density on both sides of the pivot.
>
> By not selecting the pivot in the middle, the binary trees would not always
> be balanced, leading to performance problems in the generated code.
>
> This patch rewrites the lowering to search for clusters of cases
> suitable for jump tables or bit tests first, and then builds the binary
> tree around those clusters. This way, the binary tree will always be balanced.
>
> This has the added benefit of decoupling the different aspects of the lowering:
> tree building and jump table or bit tests finding are now easier to tweak
> separately.
>
> For example, this will enable us to balance the tree based on profile info
> in the future.
>
> The algorithm for finding jump tables is quadratic, whereas the previous algorithm
> was O(n log n) for common cases, and quadratic only in the worst-case. This
> doesn't seem to be major problem in practice, e.g. compiling a file consisting
> of a 10k-case switch was only 30% slower, and such large switches should be rare
> in practice. Compiling e.g. gcc.c showed no compile-time difference. If this
> does turn out to be a problem, we could limit the search space of the algorithm.
>
> This commit also disables all optimizations during switch lowering in -O0.
>
> Differential Revision: http://reviews.llvm.org/D8649
llvm-svn: 235560
Zachary Turner [Wed, 22 Apr 2015 22:53:18 +0000 (22:53 +0000)]
Use the debugginess of the python interpreter when symlinking _lldb.pyd.
Previously we would pass an argument to finishSwigWrapperClasses.py which
specified whether this was a debug or a release build. But sometimes
CMAKE_BUILD_TYPE would not be set to anything, causing this argument
to be empty when passed in. The only purpose of this argument was to
determine whether or not to append _d to the extension module when
creating the symlink. This is only necessary when doing a debug
build of LLDB on Windows, which implies a debug interpreter, so we
replace this with a check to see if the running interpreter is a debug
one, and append _d if so.
llvm-svn: 235559
David Majnemer [Wed, 22 Apr 2015 22:42:05 +0000 (22:42 +0000)]
[InstCombine] Use a more targeted fix instead of r235544
Only clear out the NSW/NUW flags if we are optimizing 'add'/'sub' while
taking advantage that the sign bit is not set. We do this optimization
to further shrink the mask but shrinking the mask isn't NSW/NUW
preserving in this case.
llvm-svn: 235558
Reid Kleckner [Wed, 22 Apr 2015 22:13:09 +0000 (22:13 +0000)]
[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works
This removes the -sehprepare flag and makes __C_specific_handler
functions always to use WinEHPrepare.
This was tested by building all of chromium_builder_tests and running a
few tests that use SEH, but if something breaks, we can revert this.
llvm-svn: 235557
Krzysztof Parzyszek [Wed, 22 Apr 2015 21:41:24 +0000 (21:41 +0000)]
Unxfail passing test on Hexagon
llvm-svn: 235556
Reid Kleckner [Wed, 22 Apr 2015 21:39:55 +0000 (21:39 +0000)]
Fix another test broken by r235537
llvm-svn: 235555
Lang Hames [Wed, 22 Apr 2015 21:38:37 +0000 (21:38 +0000)]
[RuntimeDyld][COFF] Add external symbol resolution support to RuntimeDyldCOFF.
Patch by Andy Ayers. Thanks Andy!
llvm-svn: 235554
David Majnemer [Wed, 22 Apr 2015 21:38:15 +0000 (21:38 +0000)]
Revert "Revert r234581, it might have caused a few miscompiles in Chromium."
This reverts commit r234700. It turns out that the lifetime markers
were not the cause of Chromium failing but a bug which was uncovered by
optimizations exposed by the markers.
llvm-svn: 235553
Krzysztof Parzyszek [Wed, 22 Apr 2015 21:17:00 +0000 (21:17 +0000)]
[Hexagon] Some cleanup of instruction selection code
llvm-svn: 235552
Reid Kleckner [Wed, 22 Apr 2015 21:14:25 +0000 (21:14 +0000)]
Fix test failure caused by r235537. It does not run on Windows due to REQUIRES: shell
llvm-svn: 235551
Reid Kleckner [Wed, 22 Apr 2015 21:05:21 +0000 (21:05 +0000)]
[WinEH] Demote values and phis live across exception handlers up front
In particular, this handles SSA values that are live *out* of a handler.
The existing code only handles values that are live *in* to a handler.
It also handles phi nodes in the block where normal control should
resume after the end of a catch handler. When EH return points have phi
nodes, we need to split the return edge. It is impossible for phi
elimination to emit copies in the previous block if that block gets
outlined. The indirectbr that we leave in the function is only notional,
and is eliminated from the MachineFunction CFG early on.
Reviewers: majnemer, andrew.w.kaylor
Differential Revision: http://reviews.llvm.org/D9158
llvm-svn: 235545
David Majnemer [Wed, 22 Apr 2015 20:59:28 +0000 (20:59 +0000)]
[InstCombine] Clear out nsw/nuw if we modify computation in the chain
An nsw/nuw operation relies on the values feeding into it to not
overflow if 'poison' is not to be produced. This means that
optimizations which make modifications to the bottom of a chain (like
SimplifyDemandedBits) must strip out nsw/nuw if they cannot ensure that
they will be preserved.
This fixes PR23309.
llvm-svn: 235544
Lang Hames [Wed, 22 Apr 2015 20:58:34 +0000 (20:58 +0000)]
[Kaleidoscope] Fix incorrect use of reinterpret_cast.
Thanks to Dave Blaikie for catching this.
llvm-svn: 235543
Reid Kleckner [Wed, 22 Apr 2015 20:56:42 +0000 (20:56 +0000)]
[Allocator] Remove memory poisoning before deallocation
I added the poisoning back in r76891 (2009) because of some bugs in
Unladen Swallow, and then Evan Cheng added the setRangeWritable() call
in r81308. Profiling a Release+Asserts build on Windows shows that this
memory protection call is actually very expensive. 4 seconds of a 70
second Clang compilation are spent in VirtualQuery. These days we have
more reliable tools like ASan to find these kinds of bugs, so we can go
ahead and retire these checks.
llvm-svn: 235542
Lang Hames [Wed, 22 Apr 2015 20:41:34 +0000 (20:41 +0000)]
[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
llvm-svn: 235541
Alexey Samsonov [Wed, 22 Apr 2015 20:30:19 +0000 (20:30 +0000)]
[ASan] Print global registration site in init-order-checker reports.
llvm-svn: 235540