platform/upstream/llvm.git
8 years agouse range-based for loops; NFCI
Sanjay Patel [Wed, 9 Dec 2015 22:45:45 +0000 (22:45 +0000)]
use range-based for loops; NFCI

llvm-svn: 255171

8 years ago[CMake] Provide options for toggling on and off various runtime libraries.
Chris Bieneman [Wed, 9 Dec 2015 22:45:03 +0000 (22:45 +0000)]
[CMake] Provide options for toggling on and off various runtime libraries.

Summary:
Rather than having to add new "experimental" options each time someone wants to work on bringing a sanitizer to a new platform, this patch makes options for all of them.

The default values for the options are set by the platform checks that would have enabled them, but they can be overridden on or off.

Reviewers: kubabrecka, samsonov

Subscribers: llvm-commits

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

llvm-svn: 255170

8 years agoSynchronize the logic for deciding to link a gv.
Rafael Espindola [Wed, 9 Dec 2015 22:44:00 +0000 (22:44 +0000)]
Synchronize the logic for deciding to link a gv.

We were deciding to not link an available_externally gv over a
declaration, but then copying over the body anyway.

llvm-svn: 255169

8 years ago[tsan] Move emptyset/oldset to ThreadSignalContext.
Yabin Cui [Wed, 9 Dec 2015 22:40:31 +0000 (22:40 +0000)]
[tsan] Move emptyset/oldset to ThreadSignalContext.

Summary:
Android doesn't support __thread keyword. So move emptyset/oldset
from THREADLOCAL to ThreadSignalContext.

Reviewers: kcc, eugenis, dvyukov

Subscribers: llvm-commits, tberghammer, danalbert

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

llvm-svn: 255168

8 years ago[tsan] Use REAL(malloc) instead of __libc_malloc for Android.
Yabin Cui [Wed, 9 Dec 2015 22:32:38 +0000 (22:32 +0000)]
[tsan] Use REAL(malloc) instead of __libc_malloc for Android.

Summary:
Android doesn't have __libc_malloc and related allocation
functions. As its dynamic linker doesn't use malloc, so
we can use REAL(malloc) to replace __libc_malloc safely.

Reviewers: kcc, eugenis, dvyukov

Subscribers: llvm-commits, tberghammer, danalbert, srhines

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

llvm-svn: 255167

8 years agoAdd 3 more missing inline/visibility attributes.
Evgeniy Stepanov [Wed, 9 Dec 2015 22:32:36 +0000 (22:32 +0000)]
Add 3 more missing inline/visibility attributes.

These are the cases when an out-of-class definition of a method is
marked _LIBCPP_INLINE_VISIBILITY, but the in-class declaration is
not. This will start failing when (or if) we switch to
attribute((internal_linkage)).

llvm-svn: 255166

8 years agoFix the target specific "-msse3" flag check in CMake. NFC
Sumanth Gundapaneni [Wed, 9 Dec 2015 22:26:38 +0000 (22:26 +0000)]
Fix the target specific "-msse3" flag check in CMake. NFC

msse3 is a target dependent flag and must be guarded as check_cxx_compiler_flag()
checks only for compiler error messages and ignores warnings. Earlier COMPILER_RT_HAS_MSSE3_FLAG
is set to "TRUE" for all targets as clang emits warnings and the compilation spits unnecessary
warnings for non-X86 targets. This issue is fixed by coupling the flag with "-Werror"

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

llvm-svn: 255165

8 years ago[tsan] Disable interceptors not supported in Android.
Yabin Cui [Wed, 9 Dec 2015 22:23:47 +0000 (22:23 +0000)]
[tsan] Disable interceptors not supported in Android.

Reviewers: kcc, eugenis, dvyukov

Subscribers: llvm-commits, tberghammer, danalbert, srhines

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

llvm-svn: 255164

8 years agofix typos; NFC
Sanjay Patel [Wed, 9 Dec 2015 22:16:07 +0000 (22:16 +0000)]
fix typos; NFC

llvm-svn: 255163

8 years agoUse __make_integer_seq builtin for std::make_integer_sequence. Patch by K-ballo.
Eric Fiselier [Wed, 9 Dec 2015 22:03:06 +0000 (22:03 +0000)]
Use __make_integer_seq builtin for std::make_integer_sequence. Patch by K-ballo.

llvm-svn: 255162

8 years agoenable timeout/exceptional exit support for xUnit formatter
Todd Fiala [Wed, 9 Dec 2015 22:02:31 +0000 (22:02 +0000)]
enable timeout/exceptional exit support for xUnit formatter

Also adds enable.py/disable.py script to simplify turning on and off
the issue_verification tests helpful for testing a results formatter.

llvm-svn: 255161

8 years agoasan_win_dynamic_runtime_thunk.cc: declare atexit
Hans Wennborg [Wed, 9 Dec 2015 21:43:03 +0000 (21:43 +0000)]
asan_win_dynamic_runtime_thunk.cc: declare atexit

MSVC apparently makes atexit available even without including stdlib.h,
but clang-cl does not. This makes the file build also with clang-cl.

llvm-svn: 255160

8 years agoPut progress.py back, apparently this can't be deleted.
Zachary Turner [Wed, 9 Dec 2015 21:32:28 +0000 (21:32 +0000)]
Put progress.py back, apparently this can't be deleted.

llvm-svn: 255159

8 years ago[PGO] Rename the profdata filename to avoid the conflict b/w tests.
Rong Xu [Wed, 9 Dec 2015 21:27:59 +0000 (21:27 +0000)]
[PGO] Rename the profdata filename to avoid the conflict b/w tests.

Two tests diag_mismatch.ll and diag_no_funcprofdata.ll generates the same
profdata filename which can conflict in current test runs. This patch
renames them to have different names.

llvm-svn: 255158

8 years agoIR: Make ConstantDataArray::getFP actually return a ConstantDataArray
Justin Bogner [Wed, 9 Dec 2015 21:21:07 +0000 (21:21 +0000)]
IR: Make ConstantDataArray::getFP actually return a ConstantDataArray

The ConstantDataArray::getFP(LLVMContext &, ArrayRef<uint16_t>)
overload has had a typo in it since it was written, where it will
create a Vector instead of an Array. This obviously doesn't work at
all, but it turns out that until r254991 there weren't actually any
callers of this overload. Fix the typo and add some test coverage.

llvm-svn: 255157

8 years ago[ThinLTO] Release files read when creating combined index in gold plugin
Teresa Johnson [Wed, 9 Dec 2015 21:11:42 +0000 (21:11 +0000)]
[ThinLTO] Release files read when creating combined index in gold plugin

This wasn't causing an issue since at HEAD we exit the linker completely
after creating the combined index.

llvm-svn: 255156

8 years ago[Float2Int] Don't operate on vector instructions
Reid Kleckner [Wed, 9 Dec 2015 21:08:18 +0000 (21:08 +0000)]
[Float2Int] Don't operate on vector instructions

This fixes a crash bug. It's also not clear if we'd want to do this
transform for vectors.

llvm-svn: 255155

8 years ago[llvm-dwp] Sink debug_types.dwo emission into the code parsing the type signatures...
David Blaikie [Wed, 9 Dec 2015 21:02:33 +0000 (21:02 +0000)]
[llvm-dwp] Sink debug_types.dwo emission into the code parsing the type signatures (NFC)

This is a preliminary change towards deduplicating type units based on
their signatures. Next change will skip emission of types when their
signature has already been seen.

llvm-svn: 255154

8 years agoRemove the -P option from dotest.py
Zachary Turner [Wed, 9 Dec 2015 20:48:59 +0000 (20:48 +0000)]
Remove the -P option from dotest.py

This was an option to display a graphical progress bar.  Nobody
is using this, and it doesn't work correctly anyway with the new
result formatter.

llvm-svn: 255153

8 years agoDelete the -n command line option from dotest.py.
Zachary Turner [Wed, 9 Dec 2015 20:48:42 +0000 (20:48 +0000)]
Delete the -n command line option from dotest.py.

This removes the option to not print some one time version and
diagnostic information when running the test suite.

llvm-svn: 255152

8 years agoRemove the -i command line option from dotest.py.
Zachary Turner [Wed, 9 Dec 2015 20:48:31 +0000 (20:48 +0000)]
Remove the -i command line option from dotest.py.

This is part of a larger effort to remove unused command line
options from dotest.py.

llvm-svn: 255151

8 years agoDelete the -F command line option from dotest.py.
Zachary Turner [Wed, 9 Dec 2015 20:48:19 +0000 (20:48 +0000)]
Delete the -F command line option from dotest.py.

This removes the failfast command line option as part of an effort
to simplify dotest and remove unused command line options.  You can
still Ctrl+C any time you want to exit early.

llvm-svn: 255150

8 years agoDon't assign a temporary string to a StringRef.
Rafael Espindola [Wed, 9 Dec 2015 20:41:10 +0000 (20:41 +0000)]
Don't assign a temporary string to a StringRef.

Should fix the windows debug and asan bots.

llvm-svn: 255149

8 years agoUse WeakVH to keep track of calls with operand bundles in CloneCodeInfo
Sanjoy Das [Wed, 9 Dec 2015 20:33:52 +0000 (20:33 +0000)]
Use WeakVH to keep track of calls with operand bundles in CloneCodeInfo

`CloneAndPruneIntoFromInst` can DCE instructions after cloning them into
the new function, and so an AssertingVH is too strong.  This change
switches CloneCodeInfo to use a std::vector<WeakVH>.

llvm-svn: 255148

8 years agoDelete trailing whitespace; NFC
Sanjoy Das [Wed, 9 Dec 2015 20:33:45 +0000 (20:33 +0000)]
Delete trailing whitespace; NFC

llvm-svn: 255147

8 years agoDelay context construction to when/if it is needed in gold plugin (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:49:40 +0000 (19:49 +0000)]
Delay context construction to when/if it is needed in gold plugin (NFC)

llvm-svn: 255146

8 years agoclang-format order of gold-plugin includes (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:45:55 +0000 (19:45 +0000)]
clang-format order of gold-plugin includes (NFC)

llvm-svn: 255144

8 years agoRemove -k command line option from dotest.py.
Zachary Turner [Wed, 9 Dec 2015 19:45:51 +0000 (19:45 +0000)]
Remove -k command line option from dotest.py.

This is part of an effort to remove unused command line options.

llvm-svn: 255143

8 years agoRemove -e option from dotest.py.
Zachary Turner [Wed, 9 Dec 2015 19:45:36 +0000 (19:45 +0000)]
Remove -e option from dotest.py.

This is part of an effort to clean up dotest command line options
that are no longer used.

llvm-svn: 255142

8 years agoRemove -libcxx option from dotest.py
Zachary Turner [Wed, 9 Dec 2015 19:45:16 +0000 (19:45 +0000)]
Remove -libcxx option from dotest.py

Nobody was using this, and plus it can be achieved just as well
by using -E to set an environment variable.

llvm-svn: 255141

8 years ago[ThinLTO] FunctionImport pass can take a const index pointer (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:39:47 +0000 (19:39 +0000)]
[ThinLTO] FunctionImport pass can take a const index pointer (NFC)

llvm-svn: 255140

8 years agoMove XunitFormatter into its own xunit_formatter.py file.
Todd Fiala [Wed, 9 Dec 2015 19:32:14 +0000 (19:32 +0000)]
Move XunitFormatter into its own xunit_formatter.py file.

llvm-svn: 255139

8 years agoFix new summary to include exceptional exit count in determining exit value
Todd Fiala [Wed, 9 Dec 2015 19:05:44 +0000 (19:05 +0000)]
Fix new summary to include exceptional exit count in determining exit value

The main dotest.py should exit with a system return code of 1 on any
issue.  This change fixes a place where I omitted counting the
exceptional exit value to determine if we should return 1 when using the
new summary results.

This change also puts a banner around the Issue Details section that comes
before the Test Result Summary.

llvm-svn: 255138

8 years ago[InstCombine] fold bitcasts around an extractelement (2nd try)
Sanjay Patel [Wed, 9 Dec 2015 18:57:16 +0000 (18:57 +0000)]
[InstCombine] fold bitcasts around an extractelement (2nd try)

This is a redo of r255124 (reverted at r255126) with an added check for a
scalar destination type and an added test for the failure seen in Clang's
test/CodeGen/vector.c. The extra test shows a different missing optimization.

Original commit message:

Example:
  bitcast (extractelement (bitcast <2 x float> %X to <2 x i32>), 1) to float
    --->
  extractelement <2 x float> %X, i32 1

This is part of fixing PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

The next step will be to generalize this fold:
trunc ( lshr ( bitcast X) ) -> extractelement (X)

Ie, I'm hoping to replace the existing transform of:
bitcast ( trunc ( lshr ( bitcast X)))
added by:
http://reviews.llvm.org/rL112232

with 2 less specific transforms to catch the case in the bug report.

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

llvm-svn: 255137

8 years ago[TSan] Try harder to avoid compiler-generated memset calls.
Alexey Samsonov [Wed, 9 Dec 2015 18:48:10 +0000 (18:48 +0000)]
[TSan] Try harder to avoid compiler-generated memset calls.

check_memcpy test added in r254959 fails on some configurations due to
memset() calls inserted by Clang. Try harder to avoid them:
* Explicitly use internal_memset() instead of empty braced-initializer.
* Replace "new T()" with "new T", as the former generates zero-initialization
  for structs in C++11.

llvm-svn: 255136

8 years ago[tsan] Define sigaction_t for Android.
Yabin Cui [Wed, 9 Dec 2015 18:37:27 +0000 (18:37 +0000)]
[tsan] Define sigaction_t for Android.

Reviewers: kcc, eugenis, dvyukov

Subscribers: llvm-commits, tberghammer, danalbert, srhines

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

llvm-svn: 255135

8 years agoDisable the issue verification tests.
Todd Fiala [Wed, 9 Dec 2015 18:24:47 +0000 (18:24 +0000)]
Disable the issue verification tests.

llvm-svn: 255134

8 years agoRevert "Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when...
Michael Zolotukhin [Wed, 9 Dec 2015 18:20:28 +0000 (18:20 +0000)]
Revert "Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when possible.""

The bug in IndVarSimplify was fixed in r254976, r254977, so I'm
reapplying the original patch for avoiding redundant LCSSA recomputation.

This reverts commit ffe3b434e505e403146aff00be0c177bb6d13466.

llvm-svn: 255133

8 years ago[PGO] Resubmit "MST based PGO instrumentation infrastructure" (r254021)
Rong Xu [Wed, 9 Dec 2015 18:08:16 +0000 (18:08 +0000)]
[PGO] Resubmit "MST based PGO instrumentation infrastructure" (r254021)

This new patch fixes a few bugs that exposed in last submit. It also improves
the test cases.
--Original Commit Message--
This patch implements a minimum spanning tree (MST) based instrumentation for
PGO. The use of MST guarantees minimum number of CFG edges getting
instrumented. An addition optimization is to instrument the less executed
edges to further reduce the instrumentation overhead. The patch contains both the
instrumentation and the use of the profile to set the branch weights.

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

llvm-svn: 255132

8 years agocreate 3 issues for testbots: FAIL, ERROR (exceptional), and TIMEOUT
Todd Fiala [Wed, 9 Dec 2015 18:01:19 +0000 (18:01 +0000)]
create 3 issues for testbots: FAIL, ERROR (exceptional), and TIMEOUT

This change is a trial balloon to verify that the default test summary
output sends the right output for the buildbot issue detection script.

The effect of this change will be reverted after verifying the testbot
behavior.  This change will not stay in as is and will knowingly create
noise, see this thread:

http://lists.llvm.org/pipermail/lldb-dev/2015-December/009048.html

llvm-svn: 255131

8 years agoTurn on new test summary results by default.
Todd Fiala [Wed, 9 Dec 2015 18:01:14 +0000 (18:01 +0000)]
Turn on new test summary results by default.

llvm-svn: 255130

8 years agounique_ptrify some collections in FileManager
David Blaikie [Wed, 9 Dec 2015 17:23:13 +0000 (17:23 +0000)]
unique_ptrify some collections in FileManager

llvm-svn: 255129

8 years ago[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning...
Nathan Slingerland [Wed, 9 Dec 2015 17:11:28 +0000 (17:11 +0000)]
[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning overflow state

Summary:
Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow result.
This should make it clearer that the value is returned at callsites and reduces the size of the implementation.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

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

llvm-svn: 255128

8 years ago[Hexagon] Use integrated assembler by default
Krzysztof Parzyszek [Wed, 9 Dec 2015 16:34:24 +0000 (16:34 +0000)]
[Hexagon] Use integrated assembler by default

llvm-svn: 255127

8 years agoRevert "[InstCombine] fold bitcasts around an extractelement"
Mehdi Amini [Wed, 9 Dec 2015 16:31:39 +0000 (16:31 +0000)]
Revert "[InstCombine] fold bitcasts around an extractelement"

This reverts commit r255124.

Broke http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/4193/steps/test/logs/stdio

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255126

8 years ago[WebAssembly] Reintroduce ARGUMENT moving logic
Dan Gohman [Wed, 9 Dec 2015 16:23:59 +0000 (16:23 +0000)]
[WebAssembly] Reintroduce ARGUMENT moving logic

Reinteroduce the code for moving ARGUMENTS back to the top of the basic block.
While the ARGUMENTS physical register prevents sinking and scheduling from
moving them, it does not appear to be sufficient to prevent SelectionDAG from
moving them down in the initial schedule. This patch introduces a patch that
moves them back to the top immediately after SelectionDAG runs.

This is still hopefully a temporary solution. http://reviews.llvm.org/D14750 is
one alternative, though the review has not been favorable, and proposed
alternatives are longer-term and have other downsides.

This fixes the main outstanding -verify-machineinstrs failures, so it adds
-verify-machineinstrs to several tests.

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

llvm-svn: 255125

8 years ago[InstCombine] fold bitcasts around an extractelement
Sanjay Patel [Wed, 9 Dec 2015 16:17:20 +0000 (16:17 +0000)]
[InstCombine] fold bitcasts around an extractelement

Example:
  bitcast (extractelement (bitcast <2 x float> %X to <2 x i32>), 1) to float
    --->
  extractelement <2 x float> %X, i32 1

This is part of fixing PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

The next step will be to generalize this fold:
trunc ( lshr ( bitcast X) ) -> extractelement (X)

Ie, I'm hoping to replace the existing transform of:
bitcast ( trunc ( lshr ( bitcast X)))
added by:
http://reviews.llvm.org/rL112232

with 2 less specific transforms to catch the case in the bug report.

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

llvm-svn: 255124

8 years agoChange hasUniqueInitializer() to call isStrongDefinitionForLinker() instead of !isWea...
Mehdi Amini [Wed, 9 Dec 2015 16:17:07 +0000 (16:17 +0000)]
Change hasUniqueInitializer() to call isStrongDefinitionForLinker() instead of !isWeakForLinker()

Summary:
Available_externally global variable with initializer were considered "hasInitializer()",
while obviously it can't match the description:

    Whether the global variable has an initializer, and any changes made to the
    initializer will turn up in the final executable.

since modifying the initializer of an externally available variable does not make sense.

Reviewers: pcc, rafael

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255123

8 years agoRe-commit r255115, with the PredicatedScalarEvolution class moved to
Silviu Baranga [Wed, 9 Dec 2015 16:06:28 +0000 (16:06 +0000)]
Re-commit r255115, with the PredicatedScalarEvolution class moved to
ScalarEvolution.h, in order to avoid cyclic dependencies between the Transform
and Analysis modules:

[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions

Summary:
This change creates a layer over ScalarEvolution for LAA and LV, and centralizes the
usage of SCEV predicates. The SCEVPredicatedLayer takes the statically deduced knowledge
by ScalarEvolution and applies the knowledge from the SCEV predicates. The end goal is
that both LAA and LV should use this interface everywhere.

This also solves a problem involving the result of SCEV expression rewritting when
the predicate changes. Suppose we have the expression (sext {a,+,b}) and two predicates
  P1: {a,+,b} has nsw
  P2: b = 1.

Applying P1 and then P2 gives us {a,+,1}, while applying P2 and the P1 gives us
sext({a,+,1}) (the AddRec expression was changed by P2 so P1 no longer applies).
The SCEVPredicatedLayer maintains the order of transformations by feeding back
the results of previous transformations into new transformations, and therefore
avoiding this issue.

The SCEVPredicatedLayer maintains a cache to remember the results of previous
SCEV rewritting results. This also has the benefit of reducing the overall number
of expression rewrites.

Reviewers: mzolotukhin, anemet

Subscribers: jmolloy, sanjoy, llvm-commits

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

llvm-svn: 255122

8 years ago[RenderScript] Add hook for destroyed allocations
Ewan Crawford [Wed, 9 Dec 2015 16:01:58 +0000 (16:01 +0000)]
[RenderScript] Add hook for destroyed allocations

New hook for rsdAllocationDestroy() which is called when allocations are deleted.
LLDB should be aware of this so we can remove the allocation from our internal list.

llvm-svn: 255121

8 years agoARM: don't use a deleted node as the BaseReg in complex pattern.
Tim Northover [Wed, 9 Dec 2015 15:54:50 +0000 (15:54 +0000)]
ARM: don't use a deleted node as the BaseReg in complex pattern.

We mutated the DAG, which invalidated the node we were trying to use
as a base register. Sometimes we got away with it, but other times the
node really did get deleted before it was finished with.

Should fix PR25733

llvm-svn: 255120

8 years agoWebAssembly: add missing failure to the list.
JF Bastien [Wed, 9 Dec 2015 15:52:57 +0000 (15:52 +0000)]
WebAssembly: add missing failure to the list.

llvm-svn: 255119

8 years agoCorrectly XFAIL TestReturnValue
Pavel Labath [Wed, 9 Dec 2015 15:49:40 +0000 (15:49 +0000)]
Correctly XFAIL TestReturnValue

android is not an "os", use the target triple to match it.

llvm-svn: 255118

8 years agoRevert r255115 until we figure out how to fix the bot failures.
Silviu Baranga [Wed, 9 Dec 2015 15:25:28 +0000 (15:25 +0000)]
Revert r255115 until we figure out how to fix the bot failures.

llvm-svn: 255117

8 years agoAvoid extended mnemonic 'mfvrsave' in assembly code
Bill Schmidt [Wed, 9 Dec 2015 15:18:30 +0000 (15:18 +0000)]
Avoid extended mnemonic 'mfvrsave' in assembly code

llvm-svn: 255116

8 years ago[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions
Silviu Baranga [Wed, 9 Dec 2015 15:03:52 +0000 (15:03 +0000)]
[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions

Summary:
This change creates a layer over ScalarEvolution for LAA and LV, and centralizes the
usage of SCEV predicates. The SCEVPredicatedLayer takes the statically deduced knowledge
by ScalarEvolution and applies the knowledge from the SCEV predicates. The end goal is
that both LAA and LV should use this interface everywhere.

This also solves a problem involving the result of SCEV expression rewritting when
the predicate changes. Suppose we have the expression (sext {a,+,b}) and two predicates
  P1: {a,+,b} has nsw
  P2: b = 1.

Applying P1 and then P2 gives us {a,+,1}, while applying P2 and the P1 gives us
sext({a,+,1}) (the AddRec expression was changed by P2 so P1 no longer applies).
The SCEVPredicatedLayer maintains the order of transformations by feeding back
the results of previous transformations into new transformations, and therefore
avoiding this issue.

The SCEVPredicatedLayer maintains a cache to remember the results of previous
SCEV rewritting results. This also has the benefit of reducing the overall number
of expression rewrites.

Reviewers: mzolotukhin, anemet

Subscribers: jmolloy, sanjoy, llvm-commits

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

llvm-svn: 255115

8 years agoFix cycle in selection DAG introduced by extractelement legalization
Robert Lougher [Wed, 9 Dec 2015 14:34:10 +0000 (14:34 +0000)]
Fix cycle in selection DAG introduced by extractelement legalization

During selection DAG legalization, extractelement is replaced with a load
instruction.  To do this, a temporary store to the stack is used unless an
existing store is found that can be re-used.

If re-using a store, the chain going out of the store must be replaced by
the one going out of the new load (this ensures that any stores that must
take place after the store happens after the load, else the value might
be overwritten before it is loaded).

The problem is, if the extractelement index is dependent on the store
replacing the chain will introduce a cycle in the selection DAG (the load
uses the index, and by replacing the chain we will make the index dependent
on the load).

To fix this, if the index is dependent on the store, the store is skipped.
This is conservative as we may end up creating an unnecessary extra store
to the stack.  However, the situation is not expected to occur very often.

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

llvm-svn: 255114

8 years ago[AArch64] Fix FP16 vector instructions that should only accept low registers
Oliver Stannard [Wed, 9 Dec 2015 14:32:11 +0000 (14:32 +0000)]
[AArch64] Fix FP16 vector instructions that should only accept low registers

llvm-svn: 255113

8 years ago[mips][ias] Range check uimm10 operands
Daniel Sanders [Wed, 9 Dec 2015 13:48:05 +0000 (13:48 +0000)]
[mips][ias] Range check uimm10 operands

Summary:

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

llvm-svn: 255112

8 years agoWebAssembly: add known failures
JF Bastien [Wed, 9 Dec 2015 13:29:32 +0000 (13:29 +0000)]
WebAssembly: add known failures

The bots are now running the torture tests properly. Bin all failures from the GCC C torture tests so that we can tackle failures and make the tree go red on regressions.

llvm-svn: 255111

8 years ago[mips] Use multiclass patterns for f32/f64 comparisons and i32 selects.
Vasileios Kalintiris [Wed, 9 Dec 2015 13:24:22 +0000 (13:24 +0000)]
[mips] Use multiclass patterns for f32/f64 comparisons and i32 selects.

Summary:
Although the multiclass for i32 selects might seem redundant as it has
only one instantiation, we will use it to replace the correspondent
patterns in Mips64r6InstrInfo.td in follow-up commits.

Reviewers: dsanders

Subscribers: llvm-commits, dsanders

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

llvm-svn: 255110

8 years agoRevert r254897 "[mips][microMIPS] Implement LH, LHE, LHU and LHUE instructions"
Zlatko Buljan [Wed, 9 Dec 2015 13:07:45 +0000 (13:07 +0000)]
Revert r254897 "[mips][microMIPS] Implement LH, LHE, LHU and LHUE instructions"

Commited patch was intended to implement LH, LHE, LHU and LHUE instructions.
After commit test-suite failed with error message in the form of:
fatal error: error in backend: Cannot select: t124: i32,ch = load<LD2[%d](tbaa=<0x94acc48>), sext from i16> t0, t2, undef:i32
For that reason I decided to revert commit r254897 and make new patch which besides implementation and standard regression tests will also have dedicated tests (CodeGen) for the above error.

llvm-svn: 255109

8 years ago[LLDB][MIPS] Adding call to IsMSAAvailable() while creating RegisterInfoInterface
Sagar Thakur [Wed, 9 Dec 2015 12:31:01 +0000 (12:31 +0000)]
[LLDB][MIPS] Adding call to IsMSAAvailable() while creating RegisterInfoInterface

This patch will fix the test case test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_llgs_* of TestLldbGdbServer.py on mips. The test fails because we were sending RegisterInfo for msa registers to client even when msa registers are not available. With this commit server will send E45(end of resigters) response if msa registers are not available.

llvm-svn: 255108

8 years agoexecuteScopConditionally: Introduce special exiting block
Tobias Grosser [Wed, 9 Dec 2015 11:38:22 +0000 (11:38 +0000)]
executeScopConditionally: Introduce special exiting block

When introducing separate control flow for the original and optimized code we
introduce now a special 'ExitingBlock':

      \   /
    EnteringBB
        |
    SplitBlock---------\
   _____|_____         |
  /  EntryBB  \    StartBlock
  |  (region) |        |
  \_ExitingBB_/   ExitingBlock
        |              |
    MergeBlock---------/
        |
      ExitBB
      /    \

This 'ExitingBlock' contains code such as the final_reloads for scalars, which
previously were just added to whichever statement/loop_exit/branch-merge block
had been generated last. Having an explicit basic block makes it easier to
find these constructs when looking at the CFG.

llvm-svn: 255107

8 years agotest: Fix misspelled test line
Tobias Grosser [Wed, 9 Dec 2015 11:38:08 +0000 (11:38 +0000)]
test: Fix misspelled test line

llvm-svn: 255106

8 years agoXFAIL TestReturnValue for remote Windows->Android tests
Pavel Labath [Wed, 9 Dec 2015 10:54:18 +0000 (10:54 +0000)]
XFAIL TestReturnValue for remote Windows->Android tests

this also adds the ability to match the host platform to the expectedFailureAll decorator.

llvm-svn: 255105

8 years agoFix a cleanup error in TestPlatformProcessConnect.py
Tamas Berghammer [Wed, 9 Dec 2015 10:16:05 +0000 (10:16 +0000)]
Fix a cleanup error in TestPlatformProcessConnect.py

llvm-svn: 255104

8 years ago[ELF] - Implement the TLS relocation optimization for 32-bit x86.
George Rimar [Wed, 9 Dec 2015 09:55:54 +0000 (09:55 +0000)]
[ELF] - Implement the TLS relocation optimization for 32-bit x86.

Implement the TLS relocation optimization for 32-bit x86 that is described in
"ELF Handling For Thread-Local Storage" by Ulrich Drepper, chapter 5,
"IA-32 Linker Optimizations". Specifically, this patch implements these
optimizations: LD->LE, GD->IE, GD->LD, and IE->LE.

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

llvm-svn: 255103

8 years agoEarlyCSE: fix typo from rL255054.
JF Bastien [Wed, 9 Dec 2015 09:05:42 +0000 (09:05 +0000)]
EarlyCSE: fix typo from rL255054.

llvm-svn: 255102

8 years agoRevert "Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VAL...
Mehdi Amini [Wed, 9 Dec 2015 08:17:42 +0000 (08:17 +0000)]
Revert "Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs at each basic block and insert them. Reviewed and accepted at: reviews.llvm.org/D11933"

This reverts commit r255096.

Break the bots: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/16378/

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255101

8 years agoThe current importing scheme is processing one function at a time,
Mehdi Amini [Wed, 9 Dec 2015 08:17:35 +0000 (08:17 +0000)]
The current importing scheme is processing one function at a time,
loading the source Module, linking the function in the destination
module, and destroying the source Module before repeating with the
next function to import (potentially from the same Module).

Ideally we would keep the source Module alive and import the next
Function needed from this Module. Unfortunately this is not possible
because the linker does not leave it in a usable state.

However we can do better by first computing the list of all candidates
per Module, and only then load the source Module and import all the
function we need for it.

The trick to process callees is to materialize function in the source
module when building the list of function to import, and inspect them
in their source module, collecting the list of callees for each
callee.

When we move the the actual import, we will import from each source
module exactly once. Each source module is loaded exactly once.
The only drawback it that it requires to have all the lazy-loaded
source Module in memory at the same time.

Currently this patch already improves considerably the link time,
a multithreaded link of llvm-dis on my laptop was:

  real  1m12.175s  user  6m32.430s sys  0m10.529s

and is now:

  real  0m40.697s  user  2m10.237s sys  0m4.375s

Note: this is the full link time (linker+Import+Optimizer+CodeGen)

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255100

8 years agoclang-format: Improve documentation of AlignOperands.
Daniel Jasper [Wed, 9 Dec 2015 07:56:52 +0000 (07:56 +0000)]
clang-format: Improve documentation of AlignOperands.

llvm-svn: 255099

8 years agoReformat linefeeds.
NAKAMURA Takumi [Wed, 9 Dec 2015 07:52:46 +0000 (07:52 +0000)]
Reformat linefeeds.

llvm-svn: 255098

8 years agowire timeouts and exceptional inferior process exits through the test event system
Todd Fiala [Wed, 9 Dec 2015 06:45:43 +0000 (06:45 +0000)]
wire timeouts and exceptional inferior process exits through the test event system

The results formatter system is now fed timeouts and exceptional process
exits (i.e. inferior dotest.py process that exited by signal on POSIX
systems).

If a timeout or exceptional exit happens while a test method is running
on the worker queue, the timeout or exceptional exit is charged and
reported against that test method.  Otherwise, if no test method was
running at the time of the timeout or exceptional exit, only the test
filename will be reported as the TIMEOUT or ERROR.

Implements:
https://llvm.org/bugs/show_bug.cgi?id=24830
https://llvm.org/bugs/show_bug.cgi?id=25703

In support of:
https://llvm.org/bugs/show_bug.cgi?id=25450

llvm-svn: 255097

8 years agoImplement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs...
Vikram TV [Wed, 9 Dec 2015 05:49:14 +0000 (05:49 +0000)]
Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs at each basic block and insert them. Reviewed and accepted at: reviews.llvm.org/D11933

llvm-svn: 255096

8 years agoTest commit access - Fix few missing '.' in comments of LoopInterchange code.
Vikram TV [Wed, 9 Dec 2015 05:16:24 +0000 (05:16 +0000)]
Test commit access - Fix few missing '.' in comments of LoopInterchange code.

llvm-svn: 255095

8 years agoRevert r255001, "Add parse and sema for OpenMP distribute directive and all its claus...
NAKAMURA Takumi [Wed, 9 Dec 2015 04:35:57 +0000 (04:35 +0000)]
Revert r255001, "Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule."

It causes memory leak. Some tests in test/OpenMP would fail.

llvm-svn: 255094

8 years agoAdd some additional safety checks to the StructuredData access
Jason Molenda [Wed, 9 Dec 2015 04:15:47 +0000 (04:15 +0000)]
Add some additional safety checks to the StructuredData access
methods - lldb can still crash pretty easily on corrupt JSON text,
and these will help eliminate a bunch of cases where that would
result in a crash.  Some of the methods would check that e.g.
GetItemAtIndex would actually return an item before dereferencing it,
some would not, that kind of thing.

<rdar://problem/23768693>

llvm-svn: 255093

8 years agoFix the order of destructors in LibLTOCodeGenerator
Steven Wu [Wed, 9 Dec 2015 03:37:51 +0000 (03:37 +0000)]
Fix the order of destructors in LibLTOCodeGenerator

Summary:
The order of destructors in LTOCodeGenerator gets changed in r254696.
It is possible for LTOCodeGenerator to have a MergedModule created in
the OwnedContext, in which case the module must be destructed before
the context.

Reviewers: rafael, dexonsmith

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 255092

8 years ago[Basic] Rangify two for loops. NFC.
Vedant Kumar [Wed, 9 Dec 2015 01:44:02 +0000 (01:44 +0000)]
[Basic] Rangify two for loops. NFC.

llvm-svn: 255091

8 years agoWhen printing warnings, the repeat_key should be
Sean Callanan [Wed, 9 Dec 2015 01:25:01 +0000 (01:25 +0000)]
When printing warnings, the repeat_key should be
const void * because the data is never accessed,
the pointer is the only useful piece of data.

llvm-svn: 255090

8 years ago[AArch64][ARM] Don't base interleaved op legality on type alloc size.
Ahmed Bougacha [Wed, 9 Dec 2015 01:19:50 +0000 (01:19 +0000)]
[AArch64][ARM] Don't base interleaved op legality on type alloc size.

Otherwise, we think that most types that look like they'd fit in a
legal vector type are legal (so, basically, *any* vector type with a
size between 33 and 128 bits, I think, since we use pow2 alignment;
e.g., v2i25, v3f32, ...).

DataLayout::getTypeAllocSize rounds up based on alignment.
When checking for target intrinsic legality, that's not what we want:
if rounding makes a difference, the type isn't legal, and the
target intrinsics shouldn't be used, as they are always assumed legal.

One could make the argument that alloc size is ultimately the most
relevant here, since we're dealing with LD/ST intrinsics. That's only
true if we did legalize them though; that's a problem for another day.

Use DataLayout::getTypeSizeInBits instead of getTypeAllocSizeInBits.
Type::getSizeInBits can't be used because that'd gratuitously break
pointer vector support.

Some of these uses are currently fine, because we only hit them when
the type is already known legal (e.g., r114454). Update them for
consistency. It's faster to avoid the rounding anyway!

llvm-svn: 255089

8 years agoDon't drop attributes when inlining through "deopt" operand bundles
Sanjoy Das [Wed, 9 Dec 2015 01:01:28 +0000 (01:01 +0000)]
Don't drop attributes when inlining through "deopt" operand bundles

Test case attached (test case also checks that we don't drop the calling
convention, but that functionality was correct before this patch).

llvm-svn: 255088

8 years agoSimplify testMergedProgram.
Rafael Espindola [Wed, 9 Dec 2015 00:55:05 +0000 (00:55 +0000)]
Simplify testMergedProgram.

It now receives and returns std::unique_ptr.

llvm-svn: 255087

8 years agoSimplify memory management. NFC.
Rafael Espindola [Wed, 9 Dec 2015 00:51:06 +0000 (00:51 +0000)]
Simplify memory management. NFC.

This passes std::unique_ptr to predicates that are expected to delete
their argument.

llvm-svn: 255086

8 years agoDon't bypass the GOT for delta32toGOT references.
Pete Cooper [Wed, 9 Dec 2015 00:46:02 +0000 (00:46 +0000)]
Don't bypass the GOT for delta32toGOT references.

The gcc_except_tab was generating these references to point to the typeinfo in the data section.

gcc_except_tab also had the DW_EH_PE_indirect flag set which means that at runtime we are going
to dereference this entry as if it is in the GOT.

Reviewed by Nick Kledzik in http://reviews.llvm.org/D15360.

llvm-svn: 255085

8 years agoReturn std::unique_ptr from SplitFunctionsOutOfModule. NFC.
Rafael Espindola [Wed, 9 Dec 2015 00:34:10 +0000 (00:34 +0000)]
Return std::unique_ptr from SplitFunctionsOutOfModule. NFC.

llvm-svn: 255084

8 years agoFix DoReadMemory for Windows mini dumps.
Adrian McCarthy [Wed, 9 Dec 2015 00:29:38 +0000 (00:29 +0000)]
Fix DoReadMemory for Windows mini dumps.

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

llvm-svn: 255083

8 years agoSimplify memory management. NFC.
Rafael Espindola [Wed, 9 Dec 2015 00:18:41 +0000 (00:18 +0000)]
Simplify memory management. NFC.

llvm-svn: 255082

8 years ago[UBSan] Clarify the way we disable de-duplication of reports from unrecoverable handlers.
Alexey Samsonov [Wed, 9 Dec 2015 00:12:57 +0000 (00:12 +0000)]
[UBSan] Clarify the way we disable de-duplication of reports from unrecoverable handlers.

Let unrecoverable handlers be responsbile for killing the
program with Die(), and let functions which print the error
report know if it's going to happen. Re-write the comments to
describe the situation.

llvm-svn: 255081

8 years agoX86-FMA3: Defined the ExeDomain property for Scalar FMA3 opcodes.
Vyacheslav Klochkov [Wed, 9 Dec 2015 00:12:13 +0000 (00:12 +0000)]
X86-FMA3: Defined the ExeDomain property for Scalar FMA3 opcodes.

Reviewer: Simon Pilgrim.
Differential Revision: http://reviews.llvm.org/D15317

llvm-svn: 255080

8 years agoSimplify memory management a bit. NFC.
Rafael Espindola [Wed, 9 Dec 2015 00:08:22 +0000 (00:08 +0000)]
Simplify memory management a bit. NFC.

llvm-svn: 255079

8 years agoReturn a std::unique_ptr from CloneModule. NFC.
Rafael Espindola [Tue, 8 Dec 2015 23:57:17 +0000 (23:57 +0000)]
Return a std::unique_ptr from CloneModule. NFC.

llvm-svn: 255078

8 years ago[IndVars] Use any_of and foreach instead of explicit for loops; NFC
Sanjoy Das [Tue, 8 Dec 2015 23:52:58 +0000 (23:52 +0000)]
[IndVars] Use any_of and foreach instead of explicit for loops; NFC

llvm-svn: 255077

8 years agoAdjust line numbers to account for new XFAIL comments
Reid Kleckner [Tue, 8 Dec 2015 23:36:35 +0000 (23:36 +0000)]
Adjust line numbers to account for new XFAIL comments

llvm-svn: 255076

8 years ago[UBSan] Remove "-fsanitize=" prefix from ubsan_checks.inc. NFC.
Alexey Samsonov [Tue, 8 Dec 2015 23:29:36 +0000 (23:29 +0000)]
[UBSan] Remove "-fsanitize=" prefix from ubsan_checks.inc. NFC.

llvm-svn: 255075

8 years ago[UBSan] Always calculate ErrorType (kind of UB) before printing a report.
Alexey Samsonov [Tue, 8 Dec 2015 23:29:33 +0000 (23:29 +0000)]
[UBSan] Always calculate ErrorType (kind of UB) before printing a report.

Currently, this is an NFC. However, knowing out the kind of error
report before we bring up all the reporting machinery (implemented in
ScopedReport class) is important once we teach UBSan runtime
suppressions.

llvm-svn: 255074

8 years ago[OperandBundles] Have PruneEH work correct with operand bundles.
Sanjoy Das [Tue, 8 Dec 2015 23:16:52 +0000 (23:16 +0000)]
[OperandBundles] Have PruneEH work correct with operand bundles.

For an invoke with operand bundles, the [op_begin(), op_end()-3] range
can contain things other than invoke arguments.  This change teaches
PruneEH to use arg_begin() and arg_end() explicitly.

llvm-svn: 255073

8 years agoDefine selection for v4f16, v8f16 scalar_to_vector
Pirama Arumuga Nainar [Tue, 8 Dec 2015 23:07:06 +0000 (23:07 +0000)]
Define selection for v4f16, v8f16 scalar_to_vector

Summary:
This fixes failure when trying to select
    insertelement <4 x half> undef, half %a, i64 0
which gets transformed to a scalar_to_vector node.

The accompanying v4 and v8 tests fail instruction selection without this
patch.

Reviewers: ab, jmolloy

Subscribers: srhines, llvm-commits

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

llvm-svn: 255072

8 years agoFix/Improve Debug print in FunctionImport pass
Mehdi Amini [Tue, 8 Dec 2015 23:04:19 +0000 (23:04 +0000)]
Fix/Improve Debug print in FunctionImport pass

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255071