platform/upstream/llvm.git
9 years agoExtend format specifier checking to include field function pointers in addition to...
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

9 years agoDiagnose variadic main() as an extension; addresses PR17905.
Aaron Ballman [Thu, 23 Apr 2015 16:12:42 +0000 (16:12 +0000)]
Diagnose variadic main() as an extension; addresses PR17905.

llvm-svn: 235605

9 years agouse update_llc_test_checks.py to tighten checking; remove unnecessary CPU param
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

9 years ago[Hexagon] Shrink-wrap stack frame (Hexagon-specific)
Krzysztof Parzyszek [Thu, 23 Apr 2015 16:05:39 +0000 (16:05 +0000)]
[Hexagon] Shrink-wrap stack frame (Hexagon-specific)

llvm-svn: 235603

9 years ago[Hexagon] Add testcases for stack alignment and variable-sized objects
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

9 years ago[mips] [IAS] Move NOP emission after pseudo-instruction expansion. NFC.
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

9 years agoclang-format: Properly detect variable declarations with ObjC.
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

9 years agoReplace use of %zu with PRIu64 in DYDL logging message.
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

9 years agoRevert r235560; this commit was causing several failed assertions in Debug builds...
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

9 years agoBe more strict about the operand for the array type in BitcodeReader
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

9 years agoVerify sizes when trying to read a BitcodeAbbrevOp
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

9 years ago[asan] debug_mapping.cc should also pass when the leading digit of SHADOW_SCALE is...
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

9 years ago[Sanitizer coverage] Print out the error number if OpenFile fails
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

9 years agoclang-format: Allow splitting "= default" and "= delete".
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

9 years ago[ASan/Win] Initialize sandbox-related stuff when asked to
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

9 years ago[ASan/Win] Don't forget to set *last_error if OpenFile fails
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

9 years agoMI fix allowing multiple logging instances of lldb-mi to run simultaneously.
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

9 years agoJScoP Import/Export: Ensure parameters have the same isl_id
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

9 years agoUpdate cpsr register in BLX instruction emulation
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

9 years agoFix test expectation in TestNoreturnUnwind
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

9 years agoclang-format: Don't add unwanted space when creating new arrays.
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

9 years agoclang-format: [Proto] Don't linewrap top-level options.
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

9 years agotsan: support setuid call
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

9 years agoclang-format: Support nested block formatting with ColumnLimit=0.
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

9 years ago[NativeProcessLinux] Fix race condition during inferior thread creation
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

9 years ago[DAGCombiner] Remove extra bitcasts surrounding vector shuffles
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

9 years agoMove common loop utility function isInductionPHI into LoopUtils.cpp
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

9 years ago[OPENMP] Fix for failed tests for 'omp atomic write' construct.
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

9 years ago[MS ABI] Add support for mangling VLA types
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

9 years ago[LLDB][MIPS] Add MIPS32 and MIPS64 core revisions
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

9 years ago[OPENMP] Codegen for 'atomic capture'.
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

9 years ago[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args
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

9 years agoAdd support to interchange loops with reductions.
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

9 years ago[modules] Actually allocate the extra space we use for the tail-allocated array
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

9 years ago[UBSan] Unify the way we report overflow in increment/decrement operator.
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

9 years agoUnify the way we report overflow in increment/decrement operator.
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

9 years ago[UBSan] Make sure proper error summary is printed for -fsanitize=float-cast-overflow.
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

9 years ago[WinEH] Removing seh-filter.ll until I can determine its validity
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

9 years agoInstrProf: Fix a shadowing error that would break length of profile names
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

9 years agoMissed one piece when committing r235538.
Jim Ingham [Thu, 23 Apr 2015 00:28:25 +0000 (00:28 +0000)]
Missed one piece when committing r235538.

llvm-svn: 235564

9 years ago[WinEH] Don't skip landing pads that end with an unreachable instruction.
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

9 years ago[WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatch
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

9 years agoSwitch lowering: extract jump tables and bit tests before building binary tree (PR22262)
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

9 years agoUse the debugginess of the python interpreter when symlinking _lldb.pyd.
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

9 years ago[InstCombine] Use a more targeted fix instead of r235544
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

9 years ago[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works
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

9 years agoUnxfail passing test on Hexagon
Krzysztof Parzyszek [Wed, 22 Apr 2015 21:41:24 +0000 (21:41 +0000)]
Unxfail passing test on Hexagon

llvm-svn: 235556

9 years agoFix another test broken by r235537
Reid Kleckner [Wed, 22 Apr 2015 21:39:55 +0000 (21:39 +0000)]
Fix another test broken by r235537

llvm-svn: 235555

9 years ago[RuntimeDyld][COFF] Add external symbol resolution support to RuntimeDyldCOFF.
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

9 years agoRevert "Revert r234581, it might have caused a few miscompiles in Chromium."
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

9 years ago[Hexagon] Some cleanup of instruction selection code
Krzysztof Parzyszek [Wed, 22 Apr 2015 21:17:00 +0000 (21:17 +0000)]
[Hexagon] Some cleanup of instruction selection code

llvm-svn: 235552

9 years agoFix test failure caused by r235537. It does not run on Windows due to REQUIRES: shell
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

9 years ago[WinEH] Demote values and phis live across exception handlers up front
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

9 years ago[InstCombine] Clear out nsw/nuw if we modify computation in the chain
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

9 years ago[Kaleidoscope] Fix incorrect use of reinterpret_cast.
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

9 years ago[Allocator] Remove memory poisoning before deallocation
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

9 years ago[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
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

9 years ago[ASan] Print global registration site in init-order-checker reports.
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

9 years ago[ASan] Refactor functions searching/describing globals. NFC.
Alexey Samsonov [Wed, 22 Apr 2015 20:30:15 +0000 (20:30 +0000)]
[ASan] Refactor functions searching/describing globals. NFC.

llvm-svn: 235539

9 years agoThis is some groundwork for filtering the language Exception
Jim Ingham [Wed, 22 Apr 2015 19:42:18 +0000 (19:42 +0000)]
This is some groundwork for filtering the language Exception
breakpoints, for instance on the class of the thrown object.

This change doesn't actually make that work, the part where we
extract the thrown object type from the throw site isn't done yet.

This provides a general programmatic "precondition" that you can add
to breakpoints to give them the ability to do filtering on the LLDB
side before we pass the stop on to the user-provided conditions &
callbacks.

llvm-svn: 235538

9 years agoSet normal LLVM function attributes on global initializer functions
Reid Kleckner [Wed, 22 Apr 2015 19:37:32 +0000 (19:37 +0000)]
Set normal LLVM function attributes on global initializer functions

Otherwise -fno-omit-frame-pointer and other flags like it aren't
applied.

Basic idea taken from Gao's patch, thanks!

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

llvm-svn: 235537

9 years agoAnother test to exercise APInt divide step D6.
Yaron Keren [Wed, 22 Apr 2015 18:49:59 +0000 (18:49 +0000)]
Another test to exercise APInt divide step D6.

This is divrem_big7 since divrem_big6 is used in Pawel upcoming patch.

llvm-svn: 235536

9 years ago[Hexagon] Use A2_tfrsi for constant pool and jump table addresses
Krzysztof Parzyszek [Wed, 22 Apr 2015 18:25:53 +0000 (18:25 +0000)]
[Hexagon] Use A2_tfrsi for constant pool and jump table addresses

llvm-svn: 235535

9 years agoRevert "[opaque pointer type] Avoid using PointerType::getElementType for a few cases...
David Blaikie [Wed, 22 Apr 2015 18:16:49 +0000 (18:16 +0000)]
Revert "[opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst"

This reverts commit r235458.

It looks like this might be breaking something LTO-ish. Looking into it
& will recommit with a fix/test case/etc once I've got more to go on.

llvm-svn: 235533

9 years ago[AArch64] Use MachineRegisterInfo instead of LiveIntervals to calculate liveness...
Pete Cooper [Wed, 22 Apr 2015 18:05:13 +0000 (18:05 +0000)]
[AArch64] Use MachineRegisterInfo instead of LiveIntervals to calculate liveness.  NFC.

The CondOpt pass currently uses LiveIntervals to set the dead flag on a def.  This patch uses MachineRegisterInfo::use_empty instead as that is equivalent to the def being dead.

This removes an instance of LiveIntervals in the pass manager pipeline and saves 3.8% of compile time on llc conpiled for AArch64.

Reviewed by Chad Rosier and Zhaoshi.

llvm-svn: 235532

9 years agodon't repeat function names in comments; NFC
Sanjay Patel [Wed, 22 Apr 2015 18:04:46 +0000 (18:04 +0000)]
don't repeat function names in comments; NFC

llvm-svn: 235531

9 years agoFix correctness check for test_vec_fpextend_double
Pirama Arumuga Nainar [Wed, 22 Apr 2015 18:04:12 +0000 (18:04 +0000)]
Fix correctness check for test_vec_fpextend_double

Summary:
Remove the CHECK-DAG calls introduced in r235341, and add a comment that
this test may break due to scheduling variations.

This patch completes the fix discussed in http://reviews.llvm.org/D8804

Reviewers: dsanders, srhines

Subscribers: llvm-commits

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

llvm-svn: 235530

9 years ago[Hexagon] Consider constant-extended offsets to be valid
Krzysztof Parzyszek [Wed, 22 Apr 2015 17:51:26 +0000 (17:51 +0000)]
[Hexagon] Consider constant-extended offsets to be valid

llvm-svn: 235529

9 years agoChange MachineOperand::OpKind from unsigned char to a bitfield. NFC.
Pete Cooper [Wed, 22 Apr 2015 17:48:26 +0000 (17:48 +0000)]
Change MachineOperand::OpKind from unsigned char to a bitfield.  NFC.

This causes OpKind and all the bitfields after it to use 32-bit load/stores instead of i24's for the existing bitfields.

Bugs will be filed to track whether clang and llvm could have generated the 32-bit operations in the front-end or optimizer.

Reviewed by Rafael.

llvm-svn: 235528

9 years agoFormatting fix.
Jim Ingham [Wed, 22 Apr 2015 17:48:24 +0000 (17:48 +0000)]
Formatting fix.

llvm-svn: 235527

9 years agoTest commit: fix typo in comment.
Luqman Aden [Wed, 22 Apr 2015 17:42:37 +0000 (17:42 +0000)]
Test commit: fix typo in comment.

llvm-svn: 235526

9 years agoFix Windows build break: use LLVM_FUNCTION_NAME instead of __func__.
Krzysztof Parzyszek [Wed, 22 Apr 2015 17:19:44 +0000 (17:19 +0000)]
Fix Windows build break: use LLVM_FUNCTION_NAME instead of __func__.

llvm-svn: 235525

9 years agoR600: Fix always inline pass breaking noinline functions
Matt Arsenault [Wed, 22 Apr 2015 17:10:44 +0000 (17:10 +0000)]
R600: Fix always inline pass breaking noinline functions

No test since calls are not actually supported yet.

llvm-svn: 235524

9 years agoAdd decorator for signal test failing on FreeBSD
Ed Maste [Wed, 22 Apr 2015 17:06:48 +0000 (17:06 +0000)]
Add decorator for signal test failing on FreeBSD

llvm.org/pr23318

llvm-svn: 235523

9 years agoRecommit r235219, it's need for out-of-tree users of AlignOf.h.
Yaron Keren [Wed, 22 Apr 2015 16:43:56 +0000 (16:43 +0000)]
Recommit r235219, it's need for out-of-tree users of AlignOf.h.

llvm-svn: 235522

9 years ago[Hexagon] Overhaul of stack object allocation
Krzysztof Parzyszek [Wed, 22 Apr 2015 16:43:53 +0000 (16:43 +0000)]
[Hexagon] Overhaul of stack object allocation

- Use static allocation for aligned stack objects.
- Simplify dynamic stack object allocation.
- Simplify elimination of frame-indices.

llvm-svn: 235521

9 years ago[opaque pointer type] Use pointee type retrieved from asm, rather than accessing...
David Blaikie [Wed, 22 Apr 2015 16:37:35 +0000 (16:37 +0000)]
[opaque pointer type] Use pointee type retrieved from asm, rather than accessing it via the pointer type

llvm-svn: 235520

9 years ago[cmake] Quote the path to the target exports file, fixes PR23313
Reid Kleckner [Wed, 22 Apr 2015 16:23:00 +0000 (16:23 +0000)]
[cmake] Quote the path to the target exports file, fixes PR23313

llvm-svn: 235519

9 years ago[ubsan] Stop cast-overflow.cpp test leaking undefined behaviour into the exit code.
Daniel Sanders [Wed, 22 Apr 2015 16:14:01 +0000 (16:14 +0000)]
[ubsan] Stop cast-overflow.cpp test leaking undefined behaviour into the exit code.

Summary:
ubsan was correctly catching the undefined behaviour but lit's shell was
failing the test anyway because the exit code was non-zero as a result of the
undefined behaviour.

This fixes the test on a mips-linux-gnu target.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits, rsmith, sagar

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

llvm-svn: 235518

9 years ago[x86] Add store-folded memop patterns for vcvtps2ph
Sanjay Patel [Wed, 22 Apr 2015 16:11:19 +0000 (16:11 +0000)]
[x86] Add store-folded memop patterns for vcvtps2ph

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

llvm-svn: 235517

9 years ago[Hexagon] Treat CFI as solo instructions
Krzysztof Parzyszek [Wed, 22 Apr 2015 15:47:35 +0000 (15:47 +0000)]
[Hexagon] Treat CFI as solo instructions

llvm-svn: 235516

9 years agoMI Refactor CMIUtilSystemWindows::GetExecutablesPath()
Ilia K [Wed, 22 Apr 2015 15:43:43 +0000 (15:43 +0000)]
MI Refactor CMIUtilSystemWindows::GetExecutablesPath()

Summary:
My understanding of the Windows API call GetLastError() is that it should only be checked when ::GetModuleFileName()  returns 0 on error.
Otherwise GetExecutablesPath() could return an error despite nLen being valid if GetLastError() was inconsistent.
Patch updates function to only call GetOSLastError() when nLen == 0

Patch from ewan@codeplay.com

Reviewers: EwanCrawford

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 235515

9 years ago[Hexagon] Implement HexagonInstPrinter::printRegName
Krzysztof Parzyszek [Wed, 22 Apr 2015 15:38:17 +0000 (15:38 +0000)]
[Hexagon] Implement HexagonInstPrinter::printRegName

llvm-svn: 235514

9 years agoSupport arm32 R_ARM_V4BX relocation format
Adhemerval Zanella [Wed, 22 Apr 2015 15:26:43 +0000 (15:26 +0000)]
Support arm32 R_ARM_V4BX relocation format

ARM32 ELF R_ARM_V4BX relocation format is a special relocation type
that records the location of an ARMv4t BX instruction to enable a
static linker to generate ARMv4 compatible instructions.  This
relocation does not contain a reference symbol.

This patch enabled its creation by removing the requeriment of a
relocation symbol target in ELFState<ELFT>::writeSectionContent.

llvm-svn: 235513

9 years agoSilencing a -Wunused-variable warning; NFC.
Aaron Ballman [Wed, 22 Apr 2015 15:25:05 +0000 (15:25 +0000)]
Silencing a -Wunused-variable warning; NFC.

llvm-svn: 235512

9 years agoFix a type mismatch assert in SCEV division
Brendon Cahoon [Wed, 22 Apr 2015 15:06:40 +0000 (15:06 +0000)]
Fix a type mismatch assert in SCEV division

An assert was triggered when attempting to create a new SCEV
with operands of different types in the visitAddRecExpr. In this
test case, the operand types of the numerator and denominator
are different. The SCEV division code should generate a
conservative answer when this happens.

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

llvm-svn: 235511

9 years agoSkip additional lldb-mi tests that failed on FreeBSD
Ed Maste [Wed, 22 Apr 2015 14:55:34 +0000 (14:55 +0000)]
Skip additional lldb-mi tests that failed on FreeBSD

llvm-svn: 235510

9 years ago[X86][AVX] Fix failure due to a missing ISel pattern to select VBROADCAST nodes ...
Andrea Di Biagio [Wed, 22 Apr 2015 14:53:39 +0000 (14:53 +0000)]
[X86][AVX] Fix failure due to a missing ISel pattern to select VBROADCAST nodes (PR23259).

This fixes a regression introduced at revision 218263.

On AVX, if we optimize for size, a splat build_vector of a load
is lowered into a VBROADCAST node. This is done even if the value type of the
splat build_vector node is v2i64.

Since AVX doesn't support v2f64/v2i64 broadcasts, revision 218263 added two
extra tablegen patterns to allow selecting a VMOVDDUPrm from an X86VBroadcast
where the scalar element comes from a loadi64/loadf64.

However, revision 218263 forgot to add an extra fallback pattern for the case
where we have a X86VBroadcast of a loadi64 with multiple uses.

This patch adds the missing tablegen pattern in X86InstrSSE.td.
This patch also adds an extra test to 'splat-for-size.ll' to verify that ISel
doesn't crash with a 'fatal error in the backend' due to a missing AVX pattern
to select v2i64 X86ISD::BROADCAST nodes.

llvm-svn: 235509

9 years agoFixed logic to enable complex FMA formation.
Olivier Sallenave [Wed, 22 Apr 2015 14:07:26 +0000 (14:07 +0000)]
Fixed logic to enable complex FMA formation.

llvm-svn: 235508

9 years ago[OPENMP] Codegen for 'if' clause in 'task' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:57:31 +0000 (13:57 +0000)]
[OPENMP] Codegen for 'if' clause in 'task' directive.

If condition evaluates to true, the code executes task by calling @__kmpc_omp_task() runtime function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

call void @__kmpc_omp_task_begin_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
proxy_task_entry(<gtid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
call void @__kmpc_omp_task_complete_if0(<loc>, <threadid>, <task_t_ptr, returned by @__kmpc_omp_task_alloc()>);
Also it checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D9143

llvm-svn: 235507

9 years ago[OPENMP] Codegen for 'reduction' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 13:43:03 +0000 (13:43 +0000)]
[OPENMP] Codegen for 'reduction' clause in 'for' directive.

Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
    *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]);
      ...
        *(Type<n>-1*)lhs[<n>-1] =
          ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
            *(Type<n>-1*)rhs[<n>-1]);
}

 ...
  void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
   switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
      case 1:
        <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]);
          ...
            <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]);
             __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
              break;
               case 2:
                 Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]));
                   ...
                     Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]));
                      break;
                       default:;
                        }
                        Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
Differential Revision: http://reviews.llvm.org/D9139

llvm-svn: 235506

9 years ago[mips][microMIPSr6] Implement mips32 to microMIPSr6 mapping support
Zoran Jovanovic [Wed, 22 Apr 2015 13:27:34 +0000 (13:27 +0000)]
[mips][microMIPSr6] Implement mips32 to microMIPSr6 mapping support
Differential Revision: http://reviews.llvm.org/D8661

llvm-svn: 235505

9 years agoXFAILing a single test in TestConcurrentEvents
Pavel Labath [Wed, 22 Apr 2015 13:20:03 +0000 (13:20 +0000)]
XFAILing a single test in TestConcurrentEvents

apparently, TestConcurrentEvents is still not fixed. One test has failed on Linux i386 build.
Will disable the failing test on i386 for now, and see how it goes..

llvm-svn: 235504

9 years ago[OPENMP] Codegen for 'private' clause in 'for' directive.
Alexey Bataev [Wed, 22 Apr 2015 12:24:45 +0000 (12:24 +0000)]
[OPENMP] Codegen for 'private' clause in 'for' directive.

This patch generates helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'for' directive. These generated variables are initialized by default (with the default constructor, if any). In OpenMP region references to original variables are replaced by the references to these private helper variables.
Differential Revision: http://reviews.llvm.org/D9106

llvm-svn: 235503

9 years agoEnable TestConcurrentEvents on Linux
Pavel Labath [Wed, 22 Apr 2015 12:21:06 +0000 (12:21 +0000)]
Enable TestConcurrentEvents on Linux

After the latest changes in NativeProcessLinux, these tests should be stable now. Please revert
(and let me know) if any issue crops up.

llvm-svn: 235502

9 years ago[OPENMP] Fixed test incompatibility for simd codegen.
Alexey Bataev [Wed, 22 Apr 2015 12:20:41 +0000 (12:20 +0000)]
[OPENMP] Fixed test incompatibility for simd codegen.

llvm-svn: 235501

9 years ago[OPENMP] Fix use of unsigned counters in loops with zero trip count.
Alexey Bataev [Wed, 22 Apr 2015 11:59:37 +0000 (11:59 +0000)]
[OPENMP] Fix use of unsigned counters in loops with zero trip count.

Patch fixes bugs in codegen for loops with unsigned counters and zero trip count. Previously preconditions for all loops were built using logic (Upper - Lower) > 0. But if the loop is a loop with zero trip count, then Upper - Lower is < 0 only for signed integer, for unsigned we're running into an underflow situation.
In this patch we're using original Lower<Upper condition to check that loop body can be executed at least once. Also this allows to skip code generation for loops, if it is known that preconditions for the loop are always false.
Differential Revision: http://reviews.llvm.org/D9103

llvm-svn: 235500

9 years ago[ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')
Leny Kholodov [Wed, 22 Apr 2015 11:58:09 +0000 (11:58 +0000)]
[ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')

Command line options --arm-target1-rel and --arm-target1-abs have been renamed to be compatible with GNU linkers.
Two tests have been updated:
  test/elf/options/target-specific-args.test
  test/elf/ARM/rel-arm-target1.test

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

llvm-svn: 235499

9 years ago[ARM] Replace branches to undefined weak functions with NOP
Leny Kholodov [Wed, 22 Apr 2015 11:47:53 +0000 (11:47 +0000)]
[ARM] Replace branches to undefined weak functions with NOP

According to the code model (ARM, Thumb, Thumb2) this patch updates the b/bl/blx 0 instructions with NOP.
test/elf/ARM/weak-branch.test has been added with tests for all available NOP (A1, T1, T2 encodings).

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

llvm-svn: 235498

9 years ago[DAGCombine] Disable select(c, load,load) for indexed loads
Hal Finkel [Wed, 22 Apr 2015 11:32:25 +0000 (11:32 +0000)]
[DAGCombine] Disable select(c, load,load) for indexed loads

This turned up after r235333, but was a pre-existing bug. The optimization
which transforms select(c, load, load) into a load of a select of the addresses
does not handle indexed loads (pre/post inc/dec). However, it did not check for
them either, leading to a crash if it tried to transform one of them.

llvm-svn: 235497