platform/upstream/llvm.git
7 years agoTaking StringRef in Driver.h APIs instead of raw pointers (NFC)
Mehdi Amini [Thu, 6 Oct 2016 05:11:48 +0000 (05:11 +0000)]
Taking StringRef in Driver.h APIs instead of raw pointers (NFC)

llvm-svn: 283417

7 years agoUse llvm::raw_string_ostream instead of std::stringstream (NFC)
Mehdi Amini [Thu, 6 Oct 2016 04:26:16 +0000 (04:26 +0000)]
Use llvm::raw_string_ostream instead of std::stringstream (NFC)

As a side effect, this avoid having to call .data() on the StringRef.

llvm-svn: 283416

7 years ago[AMDGPU] Promote uniform i16 bitreverse intrinsic to i32
Konstantin Zhuravlyov [Thu, 6 Oct 2016 02:20:46 +0000 (02:20 +0000)]
[AMDGPU] Promote uniform i16 bitreverse intrinsic to i32

Differential Revision: https://reviews.llvm.org/D25121

llvm-svn: 283415

7 years agoFix build error on Android again.
Zachary Turner [Wed, 5 Oct 2016 23:51:13 +0000 (23:51 +0000)]
Fix build error on Android again.

This one was my fault since I can't compile Android.

llvm-svn: 283414

7 years agoConvert some Args index-based iteration to range-style iteration.
Zachary Turner [Wed, 5 Oct 2016 23:40:23 +0000 (23:40 +0000)]
Convert some Args index-based iteration to range-style iteration.

This is better for a number of reasons.  Mostly style, but also:

1) Signed-unsigned comparison warnings disappear since there is
   no loop index.
2) Iterating with the range-for style gives you back an entry
   that has more than just a const char*, so it's more efficient
   and more useful.
3) Makes code safter since the type system enforces that it's
   impossible to index out of bounds.

llvm-svn: 283413

7 years ago[libFuzzer] when re-running for lsan, don't look at the coverage
Kostya Serebryany [Wed, 5 Oct 2016 23:31:01 +0000 (23:31 +0000)]
[libFuzzer] when re-running for lsan, don't look at the coverage

llvm-svn: 283411

7 years ago[DAG] add tests to show missing checks for SDNode FMF
Sanjay Patel [Wed, 5 Oct 2016 23:20:32 +0000 (23:20 +0000)]
[DAG] add tests to show missing checks for SDNode FMF

The AVX attribute is added to remove noise caused by SSE's destructive insts.

llvm-svn: 283410

7 years ago[libFuzzer] refactoring to make -shrink=1 work for value profile, added a test.
Kostya Serebryany [Wed, 5 Oct 2016 22:56:21 +0000 (22:56 +0000)]
[libFuzzer] refactoring to make -shrink=1 work for value profile, added a test.

llvm-svn: 283409

7 years agoFix strict-aliasing violation in typeinfo::hash_code()
Eric Fiselier [Wed, 5 Oct 2016 22:55:10 +0000 (22:55 +0000)]
Fix strict-aliasing violation in typeinfo::hash_code()

Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.

Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

Differential Revision: https://reviews.llvm.org/D24012

llvm-svn: 283408

7 years agoFix tests for Windows
Hal Finkel [Wed, 5 Oct 2016 22:48:13 +0000 (22:48 +0000)]
Fix tests for Windows

We need to match file names with both forward and backward slashes.

llvm-svn: 283407

7 years agoPR22924, PR22845, some of CWG1464: When checking the initializer for an array
Richard Smith [Wed, 5 Oct 2016 22:41:02 +0000 (22:41 +0000)]
PR22924, PR22845, some of CWG1464: When checking the initializer for an array
new expression, distinguish between the case of a constant and non-constant
initializer. In the former case, if the bound is erroneous (too many
initializer elements, bound is negative, or allocated size overflows), reject,
and take the bound into account when determining whether we need to
default-construct any elements. In the remanining cases, move the logic to
check for default-constructibility of trailing elements into the initialization
code rather than inventing a bogus array bound, to cope with cases where the
number of initialized elements is not the same as the number of initializer
list elements (this can happen due to string literal initialization or brace
elision).

This also fixes rejects-valid and crash-on-valid errors when initializing a
new'd array of character type from a braced string literal.

llvm-svn: 283406

7 years agoAdd missing #include from r283039. Found by modules build.
Richard Smith [Wed, 5 Oct 2016 22:40:54 +0000 (22:40 +0000)]
Add missing #include from r283039. Found by modules build.

llvm-svn: 283405

7 years agoAdd i386/x86_64 tests of the eh_frame augmentation code in the x86
Jason Molenda [Wed, 5 Oct 2016 22:37:01 +0000 (22:37 +0000)]
Add i386/x86_64 tests of the eh_frame augmentation code in the x86
insturction profiling.  Add a test that verifies that we reject a
32-bit only instruction in 64-bit (long) mode.

This wraps up all the testing I want to add for
x86AssemblyInspectionEngine.

llvm-svn: 283404

7 years ago[codeview] Truncate records to maximum record size near 64KB
Reid Kleckner [Wed, 5 Oct 2016 22:36:07 +0000 (22:36 +0000)]
[codeview] Truncate records to maximum record size near 64KB

If we don't truncate, LLVM asserts when the label difference doesn't fit
in a 16 bit field. This patch truncates two kinds of data: trailing null
terminated names in symbol records, and inline line tables. The inline
line table test that I have is too large (many MB), so I'm not checking
it in.

Hopefully fixes PR28264.

llvm-svn: 283403

7 years ago[llvm-opt-report] Distinguish inlined contexts when optimizations differ
Hal Finkel [Wed, 5 Oct 2016 22:25:33 +0000 (22:25 +0000)]
[llvm-opt-report] Distinguish inlined contexts when optimizations differ

How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.

For example, this code:

  $ cat /tmp/q.cpp
  void bar();
  void foo(int n) {
    for (int i = 0; i < n; ++i)
      bar();
  }

  void quack() {
    foo(4);
  }

  void quack2() {
    foo(4);
  }

will now produce this report:

  < /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
   2         | void bar();
   3         | void foo(int n) {
   [[
    > foo(int):
   4         |   for (int i = 0; i < n; ++i)
    > quack(), quack2():
   4  U4     |   for (int i = 0; i < n; ++i)
   ]]
   5         |     bar();
   6         | }
   7         |
   8         | void quack() {
   9 I       |   foo(4);
  10         | }
  11         |
  12         | void quack2() {
  13 I       |   foo(4);
  14         | }
  15         |

Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.

llvm-svn: 283402

7 years agoVerifier: Reject any unknown named MD nodes in the llvm.dbg namespace.
Adrian Prantl [Wed, 5 Oct 2016 22:15:37 +0000 (22:15 +0000)]
Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace.

This came out of a discussion in https://reviews.llvm.org/D25285.

There used to be various other llvm.dbg.* nodes, but we don't support
upgrading them and we want to reserve the namespace for future uses.

This also removes an entirely obsolete and bitrotted testcase for PR7662.

Reapplies 283390 with a forgotten testcase.

llvm-svn: 283400

7 years agoRevert "Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace."
Adrian Prantl [Wed, 5 Oct 2016 22:15:34 +0000 (22:15 +0000)]
Revert "Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace."

Forgot to add a testcase in r283390.

llvm-svn: 283399

7 years agoAdd an llvm-opt-report tool to generate basic source-annotated optimization summaries
Hal Finkel [Wed, 5 Oct 2016 22:10:35 +0000 (22:10 +0000)]
Add an llvm-opt-report tool to generate basic source-annotated optimization summaries

LLVM now has the ability to record information from optimization remarks in a
machine-consumable YAML file for later analysis. This can be enabled in opt
(see r282539), and D25225 adds a Clang flag to do the same. This patch adds
llvm-opt-report, a tool to generate basic optimization "listing" files
(annotated sources with information about what optimizations were performed)
from one of these YAML inputs.

D19678 proposed to add this capability directly to Clang, but this more-general
YAML-based infrastructure was the direction we decided upon in that review
thread.

For this optimization report, I focused on making the output as succinct as
possible while providing information on inlining and loop transformations. The
goal here is that the source code should still be easily readable in the
report. My primary inspiration here is the reports generated by Cray's tools
(http://docs.cray.com/books/S-2496-4101/html-S-2496-4101/z1112823641oswald.html).
These reports are highly regarded within the HPC community. Intel's compiler,
for example, also has an optimization-report capability
(https://software.intel.com/sites/default/files/managed/55/b1/new-compiler-optimization-reports.pdf).

  $ cat /tmp/v.c
  void bar();
  void foo() { bar(); }

  void Test(int *res, int *c, int *d, int *p, int n) {
    int i;

  #pragma clang loop vectorize(assume_safety)
    for (i = 0; i < 1600; i++) {
      res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
    }

    for (i = 0; i < 16; i++) {
      res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
    }

    foo();

    foo(); bar(); foo();
  }

D25225 adds -fsave-optimization-record (and
-fsave-optimization-record=filename), and this would be used as follows:

  $ clang -O3 -o /tmp/v.o -c /tmp/v.c -fsave-optimization-record
  $ llvm-opt-report /tmp/v.yaml > /tmp/v.lst
  $ cat /tmp/v.lst

  < /tmp/v.c
   2          | void bar();
   3          | void foo() { bar(); }
   4          |
   5          | void Test(int *res, int *c, int *d, int *p, int n) {
   6          |   int i;
   7          |
   8          | #pragma clang loop vectorize(assume_safety)
   9     V4,2 |   for (i = 0; i < 1600; i++) {
  10          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
  11          |   }
  12          |
  13  U16     |   for (i = 0; i < 16; i++) {
  14          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
  15          |   }
  16          |
  17 I        |   foo();
  18          |
  19          |   foo(); bar(); foo();
     I        |   ^
     I        |                 ^
  20          | }

Each source line gets a prefix giving the line number, and a few columns for
important optimizations: inlining, loop unrolling and loop vectorization. An
'I' is printed next to a line where a function was inlined, a 'U' next to an
unrolled loop, and 'V' next to a vectorized loop. These are printed on the
relevant code line when that seems unambiguous, or on subsequent lines when
multiple potential options exist (messages, both positive and negative, from
the same optimization with different column numbers are taken to indicate
potential ambiguity). When on subsequent lines, a '^' is output in the relevant
column.

Annotated source for all relevant input files are put into the listing file
(each starting with '<' and then the file name).

You can disable having the unrolling/vectorization factors appear by using the
-s flag.

Differential Revision: https://reviews.llvm.org/D25262

llvm-svn: 283398

7 years agoAdd exact number of streams for reserved stream #s.
Rui Ueyama [Wed, 5 Oct 2016 22:08:58 +0000 (22:08 +0000)]
Add exact number of streams for reserved stream #s.

llvm-svn: 283397

7 years agoFixes for libc++ std::unordered_map data formatter against trunk
Enrico Granata [Wed, 5 Oct 2016 22:04:43 +0000 (22:04 +0000)]
Fixes for libc++ std::unordered_map data formatter against trunk

Fixes rdar://28237467

llvm-svn: 283396

7 years agoRemove extra semicolon
Reid Kleckner [Wed, 5 Oct 2016 21:46:56 +0000 (21:46 +0000)]
Remove extra semicolon

llvm-svn: 283395

7 years agoFix the build with MSVC 2013, still cannot default move ctors yet
Reid Kleckner [Wed, 5 Oct 2016 21:44:46 +0000 (21:44 +0000)]
Fix the build with MSVC 2013, still cannot default move ctors yet

Ten days.

llvm-svn: 283394

7 years ago[DAG] change test to use 'unsafe' function attribute instead of global setting
Sanjay Patel [Wed, 5 Oct 2016 21:43:50 +0000 (21:43 +0000)]
[DAG] change test to use 'unsafe' function attribute instead of global setting

But we have node-level FMF, so the next step is to fix this at the instruction/node-level.

llvm-svn: 283393

7 years agoAdd an empty IPI stream.
Rui Ueyama [Wed, 5 Oct 2016 21:37:25 +0000 (21:37 +0000)]
Add an empty IPI stream.

With this, "llvm-pdbdump yaml -ipi-stream" prints out an IPI stream.
Previously it crashed because it can't handle the case where IPI
stream doesn't exist.

llvm-svn: 283392

7 years agoModify df_iterator to support post-order actions
David Callahan [Wed, 5 Oct 2016 21:36:16 +0000 (21:36 +0000)]
Modify df_iterator to support post-order actions

Summary: This makes a change to the state used to maintain visited information for depth first iterator. We know assume a method "completed(...)" which is called after all children of a node have been visited. In all existing cases, this method does nothing so this patch has no functional changes.  It will however allow a client to distinguish back from cross edges in a DFS tree.

Reviewers: nadav, mehdi_amini, dberlin

Subscribers: MatzeB, mzolotukhin, twoh, freik, llvm-commits

Differential Revision: https://reviews.llvm.org/D25191

llvm-svn: 283391

7 years agoVerifier: Reject any unknown named MD nodes in the llvm.dbg namespace.
Adrian Prantl [Wed, 5 Oct 2016 21:31:19 +0000 (21:31 +0000)]
Verifier: Reject any unknown named MD nodes in the llvm.dbg namespace.

This came out of a discussion in https://reviews.llvm.org/D25285.

There used to be various other llvm.dbg.* nodes, but we don't support
upgrading them and we want to reserve the namespace for future uses.

This also removes an entirely obsolete and bitrotted testcase for PR7662.

llvm-svn: 283390

7 years ago[WebAssembly] Add binary-encoding opcode values to instruction descriptions.
Dan Gohman [Wed, 5 Oct 2016 21:24:08 +0000 (21:24 +0000)]
[WebAssembly] Add binary-encoding opcode values to instruction descriptions.

llvm-svn: 283389

7 years ago[codeview] Translate bitpiece metadata to DEFRANGE_SUBFIELD* records
Reid Kleckner [Wed, 5 Oct 2016 21:21:33 +0000 (21:21 +0000)]
[codeview] Translate bitpiece metadata to DEFRANGE_SUBFIELD* records

This allows LLVM to describe locations of aggregate variables that have
been split by SROA.

Fixes PR29141

Reviewers: amccarth, majnemer

Differential Revision: https://reviews.llvm.org/D25253

llvm-svn: 283388

7 years ago[Object] Fix a crash in Archive::child_iterator's default constructor.
Lang Hames [Wed, 5 Oct 2016 21:20:00 +0000 (21:20 +0000)]
[Object] Fix a crash in Archive::child_iterator's default constructor.

To be default constructible, Archive::child_iterator needs to be able to
construct an Archive::Child with a null parent, however Archive::Child's
constructor always dereferenced its Parent argument to compute the remaining
archive size. This commit fixes Archive::Child's constructor to only do the
size calculation when the parent is non-null.

llvm-svn: 283387

7 years agoConvert some more aliasing and CI functions to StringRef.
Zachary Turner [Wed, 5 Oct 2016 21:14:56 +0000 (21:14 +0000)]
Convert some more aliasing and CI functions to StringRef.

llvm-svn: 283386

7 years agoUpdate some command aliasing functions to use StringRef.
Zachary Turner [Wed, 5 Oct 2016 21:14:49 +0000 (21:14 +0000)]
Update some command aliasing functions to use StringRef.

llvm-svn: 283385

7 years agoConvert CommandObject constructors to StringRef.
Zachary Turner [Wed, 5 Oct 2016 21:14:38 +0000 (21:14 +0000)]
Convert CommandObject constructors to StringRef.

llvm-svn: 283384

7 years ago[ARM] Use __rt_div functions for divrem on Windows
Martin Storsjo [Wed, 5 Oct 2016 21:08:02 +0000 (21:08 +0000)]
[ARM] Use __rt_div functions for divrem on Windows

This avoids falling back to calling out to the GCC rem functions
(__moddi3, __umoddi3) when targeting Windows.

The __rt_div functions have flipped the two arguments compared
to the __aeabi_divmod functions. To match MSVC, we emit a
check for division by zero before actually calling the library
function (even if the library function itself also might do
the same check).

Not all calls to __rt_div functions for division are currently
merged with calls to the same function with the same parameters
for the remainder. This is more wasteful than a div + mls as before,
but avoids calls to __moddi3.

Differential Revision: https://reviews.llvm.org/D24076

llvm-svn: 283383

7 years agoEarly continue. NFC.
Rui Ueyama [Wed, 5 Oct 2016 21:06:32 +0000 (21:06 +0000)]
Early continue. NFC.

llvm-svn: 283382

7 years ago[Sparc] Implement UMUL_LOHI and SMUL_LOHI instead of MULHS/MULHU/MUL.
James Y Knight [Wed, 5 Oct 2016 20:54:17 +0000 (20:54 +0000)]
[Sparc] Implement UMUL_LOHI and SMUL_LOHI instead of MULHS/MULHU/MUL.

This is what the instruction-set actually provides, and the default
expansions of the others into the lohi opcodes are good.

llvm-svn: 283381

7 years agoFixup the xfail situation on Windows.
Zachary Turner [Wed, 5 Oct 2016 20:47:17 +0000 (20:47 +0000)]
Fixup the xfail situation on Windows.

Xfails added and/or removed to reflect the current state of Windows.

llvm-svn: 283380

7 years ago[compiler-rt] Enable building iOS by default.
Anna Zaks [Wed, 5 Oct 2016 20:45:36 +0000 (20:45 +0000)]
[compiler-rt] Enable building iOS by default.

llvm-svn: 283379

7 years ago[asan] Fixup: Switch to using dynamic shadow offset on iOS
Anna Zaks [Wed, 5 Oct 2016 20:45:34 +0000 (20:45 +0000)]
[asan] Fixup: Switch to using dynamic shadow offset on iOS

Address lint comments.

llvm-svn: 283378

7 years ago[ADT] Add missing const_iterator DenseSet::find() const
Vitaly Buka [Wed, 5 Oct 2016 20:36:39 +0000 (20:36 +0000)]
[ADT] Add missing const_iterator DenseSet::find() const

Summary: Probably overlooked.

Reviewers: eugenis, dblaikie

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24689

llvm-svn: 283377

7 years ago[asan] Reapply: Switch to using dynamic shadow offset on iOS
Anna Zaks [Wed, 5 Oct 2016 20:34:13 +0000 (20:34 +0000)]
[asan] Reapply: Switch to using dynamic shadow offset on iOS

The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset.

This is the LLVM counterpart of https://reviews.llvm.org/D25218

Differential Revision: https://reviews.llvm.org/D25219

llvm-svn: 283376

7 years ago[asan] Reapply: Switch to using dynamic shadow offset on iOS
Anna Zaks [Wed, 5 Oct 2016 20:33:59 +0000 (20:33 +0000)]
[asan] Reapply: Switch to using dynamic shadow offset on iOS

The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset.

Differential Revision: https://reviews.llvm.org/D25218

llvm-svn: 283375

7 years agoImprove the debug-info test created in r274263.
Yunzhong Gao [Wed, 5 Oct 2016 20:26:29 +0000 (20:26 +0000)]
Improve the debug-info test created in r274263.

This patch is related to r274263 or Phabricator/D21818.
This patch aims to improve the test case added in the previous commit to verify
specifically that the stack protector pass is adding the debug line info as
intended. Before, the test only verified that the verifier pass does not crash.
The current approach is to generate the assembly output and then look for the
.loc directive.

Differential Revision: https://reviews.llvm.org/D25290

llvm-svn: 283374

7 years ago[LV] Pass profitability analysis in vectorizer constructor (NFC)
Matthew Simpson [Wed, 5 Oct 2016 20:23:46 +0000 (20:23 +0000)]
[LV] Pass profitability analysis in vectorizer constructor (NFC)

The vectorizer already holds a pointer to one cost model artifact in a member
variable (i.e., MinBWs). As we add more, it will be easier to communicate these
artifacts to the vectorizer if we simply pass a pointer to the cost model
instead.

llvm-svn: 283373

7 years agoRemove trailing whitespace.
Rui Ueyama [Wed, 5 Oct 2016 20:09:50 +0000 (20:09 +0000)]
Remove trailing whitespace.

llvm-svn: 283372

7 years ago[RDF] Fix live def propagation through basic block
Krzysztof Parzyszek [Wed, 5 Oct 2016 20:08:09 +0000 (20:08 +0000)]
[RDF] Fix live def propagation through basic block

llvm-svn: 283371

7 years agoConvert various CommandInterpreter functions to StringRef.
Zachary Turner [Wed, 5 Oct 2016 20:03:37 +0000 (20:03 +0000)]
Convert various CommandInterpreter functions to StringRef.

llvm-svn: 283370

7 years agoAMDGPU: Do not re-use tmpreg in spill/restore lowering
Matthias Braun [Wed, 5 Oct 2016 20:02:51 +0000 (20:02 +0000)]
AMDGPU: Do not re-use tmpreg in spill/restore lowering

The register scavenging code does not support multiple definitions of
the same vreg.

Differential Revision: https://reviews.llvm.org/D25220

llvm-svn: 283369

7 years ago[LV] Pass legality analysis in vectorizer constructor (NFC)
Matthew Simpson [Wed, 5 Oct 2016 19:53:20 +0000 (19:53 +0000)]
[LV] Pass legality analysis in vectorizer constructor (NFC)

The vectorizer already holds a pointer to the legality analysis in a member
variable, so it makes sense that we would pass it in the constructor.

llvm-svn: 283368

7 years agoStore the hash in SectionPiece.
Rafael Espindola [Wed, 5 Oct 2016 19:36:02 +0000 (19:36 +0000)]
Store the hash in SectionPiece.

This spreads out computing the hash and using it in a hash table. The
speedups are:

firefox
  master 6.811232891
  patch  6.559280249 1.03841162939x faster
chromium
  master 4.369323666
  patch  4.33171853 1.00868134338x faster
chromium fast
  master 1.856679971
  patch  1.850617741 1.00327578725x faster
the gold plugin
  master 0.32917962
  patch  0.325711944 1.01064645023x faster
clang
  master 0.558015452
  patch  0.550284165 1.01404962652x faster
llvm-as
  master 0.032563515
  patch  0.032152077 1.01279662275x faster
the gold plugin fsds
  master 0.356221362
  patch  0.352772162 1.00977741549x faster
clang fsds
  master 0.635096494
  patch  0.627249229 1.01251060127x faster
llvm-as fsds
  master 0.030183188
  patch  0.029889544 1.00982430511x faster
scylla
  master 3.071448906
  patch  2.938484138 1.04524944215x faster

This seems to be because we don't stall as much. When linking firefox
stalled-cycles-frontend goes from 57.56% to 55.55%.

With -O2 the difference is even more significant since we avoid
recomputing the hash. For firefox we go from 9.990295265 to
 9.149627521 seconds (1.09x faster).

llvm-svn: 283367

7 years agoFastISel: Remove unused/un-overridden entry points. NFCI.
Peter Collingbourne [Wed, 5 Oct 2016 19:25:20 +0000 (19:25 +0000)]
FastISel: Remove unused/un-overridden entry points. NFCI.

llvm-svn: 283366

7 years ago[LV] Remove obsolete comment (NFC)
Matthew Simpson [Wed, 5 Oct 2016 19:19:49 +0000 (19:19 +0000)]
[LV] Remove obsolete comment (NFC)

llvm-svn: 283365

7 years ago[LV] Use getScalarizationOverhead in memory instruction costs (NFC)
Matthew Simpson [Wed, 5 Oct 2016 19:11:54 +0000 (19:11 +0000)]
[LV] Use getScalarizationOverhead in memory instruction costs (NFC)

This patch refactors the cost estimation of scalarized loads and stores to
reuse getScalarizationOverhead for the cost of the extractelement and
insertelement instructions we might create. The existing code accounted for
this cost, but it was functionally equivalent to the helper function.

llvm-svn: 283364

7 years agoRemoving optimization from the RUN lines and adjusting the checks
Nemanja Ivanovic [Wed, 5 Oct 2016 19:11:36 +0000 (19:11 +0000)]
Removing optimization from the RUN lines and adjusting the checks
to not rely on optimization.

llvm-svn: 283363

7 years agoAdd the ability to set breakpoints on named RenderScript reductions
Luke Drummond [Wed, 5 Oct 2016 19:10:47 +0000 (19:10 +0000)]
Add the ability to set breakpoints on named RenderScript reductions

- Add new `lldb_private::lldb_renderscript::RSReduceBreakpointResolver`
class that can set breakpoints on kernels that are constituent
functions of named reduction groups. Also support debugging of subsets
of the the reduction group with the `-t, --function-role` flag which
takes a comma-separated list of reduction function types
outconverter,combiner,initializer,accumulator (defaults to all)

- Add 2 new helper methods to `RenderScriptRuntime`,
  1. `CreateReductionBreakpoint(name, types)`: instantiates a new
  RSReduceBreakpointResolver and inserts that resolver into the running
  process.
  2. `PlaceBreakpointOnReduction`: which is a public helper function.

- hook up the above functionality to the command-line with new
  `CommandObject*` classes that handle parsing of function roles and
  dispatch to the runtime. These are namespaced under the snappy
  `language renderscript reduction breakpoint ...` subcommand

- [incidental] Factor multiple common uses of
  `FindFirstSymbolWithNameAndType(ConstString(".rs.info")` into static
  `IsRenderScriptScriptModule(ModuleSP module)` function, and replace
  original uses.

llvm-svn: 283362

7 years agofix documentation comments; NFC
Sanjay Patel [Wed, 5 Oct 2016 18:51:12 +0000 (18:51 +0000)]
fix documentation comments; NFC

llvm-svn: 283361

7 years agoComment out failing test while I figure out who is at fault
Marshall Clow [Wed, 5 Oct 2016 18:47:18 +0000 (18:47 +0000)]
Comment out failing test while I figure out who is at fault

llvm-svn: 283360

7 years agoAllow the caller to pass in the hash.
Rafael Espindola [Wed, 5 Oct 2016 18:46:21 +0000 (18:46 +0000)]
Allow the caller to pass in the hash.

If the caller already has the hash we don't have to compute it. This
will be used in lld.

llvm-svn: 283359

7 years agoFix some test failures due to the recent Breakpoint patch.
Zachary Turner [Wed, 5 Oct 2016 18:40:51 +0000 (18:40 +0000)]
Fix some test failures due to the recent Breakpoint patch.

llvm-svn: 283358

7 years agoCompact SectionPiece.
Rafael Espindola [Wed, 5 Oct 2016 18:40:00 +0000 (18:40 +0000)]
Compact SectionPiece.

It is pretty easy to get the data from the InputSection, so we don't
have to store it.

This opens the way for storing the hash instead.

llvm-svn: 283357

7 years agoMark LWG#2679 as complete
Marshall Clow [Wed, 5 Oct 2016 18:36:24 +0000 (18:36 +0000)]
Mark LWG#2679 as complete

llvm-svn: 283356

7 years agoImprove DEBUG_VALUE assembly comments for spilled bitpieces
Reid Kleckner [Wed, 5 Oct 2016 18:36:02 +0000 (18:36 +0000)]
Improve DEBUG_VALUE assembly comments for spilled bitpieces

Previously we would give up when we saw the bitpiece DWARF expression
and print "[complex expression]" when actually we handled bitpiece
expressions outside the loop.

llvm-svn: 283355

7 years ago[LV] Add helper function for predicated block probability (NFC)
Matthew Simpson [Wed, 5 Oct 2016 18:30:36 +0000 (18:30 +0000)]
[LV] Add helper function for predicated block probability (NFC)

The cost model has to estimate the probability of executing predicated blocks.
However, we currently always assume predicated blocks have a 50% chance of
executing (this value is hardcoded in several places throughout the code).
Since we always use the same value, this patch adds a helper function for
getting this uniform probability. The function simplifies some comments and
makes our assumptions more clear. In the future, we may want to extend this
with actual block probability information if it's available.

llvm-svn: 283354

7 years ago[mips][ias] fix li macro when values are negated with ~
Simon Dardis [Wed, 5 Oct 2016 18:26:19 +0000 (18:26 +0000)]
[mips][ias] fix li macro when values are negated with ~

The integrated assembler evaluates the expressions such as ~0x80000000 to
0xffffffff7fffffff early in the parsing process. This patch adds compatibility
with gas so that li loads the expected value (0x7fffffff) in those cases. This
only occurs iff all the upper 32bits are set and maintains existing checks by
not truncating the result down to 32 bits if any of the the upper bits are not
set.

Reviewers: dsanders, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D23399

llvm-svn: 283353

7 years agoRemoving the new Minidump plugin
Dimitar Vlahovski [Wed, 5 Oct 2016 18:11:45 +0000 (18:11 +0000)]
Removing the new Minidump plugin

Tests are failing and build is failing on windows and darwin.
Will fix and commit it later
-------------------------------------------------------------

Revert "xfailing minidump tests again ... :("
This reverts commit 97eade002c9e43c1e0d11475a4888083a8965044.

Revert "Fixing new Minidump plugin tests"
This reverts commit 0dd93b3ab39c8288696001dd50b9a093b813b09c.

Revert "Add the new minidump files to the Xcode project."
This reverts commit 2f638a1d046b8a88e61e212220edc40aecd2ce44.

Revert "xfailing tests for Minidump plugin"
This reverts commit 99311c0b22338a83e6a00c4fbddfd3577914c003.

Revert "Adding a new Minidump post-mortem debugging plugin"
This reverts commit b09a7e4dae231663095a84dac4be3da00b03a021.

llvm-svn: 283352

7 years agoTry to fix Android build.
Zachary Turner [Wed, 5 Oct 2016 17:58:46 +0000 (17:58 +0000)]
Try to fix Android build.

Seems it doesn't like the implicit conversion from
StringRef[] to ArrayRef<StringRef>.

llvm-svn: 283351

7 years ago[LV] Add isScalarWithPredication helper function (NFC)
Matthew Simpson [Wed, 5 Oct 2016 17:52:34 +0000 (17:52 +0000)]
[LV] Add isScalarWithPredication helper function (NFC)

This patch adds a single helper function for checking if an instruction will be
scalarized with predication. Such instructions include conditional stores and
instructions that may divide by zero. Existing checks have been updated to use
the new function.

llvm-svn: 283350

7 years agoRevert "[asan] Switch to using dynamic shadow offset on iOS"
Anna Zaks [Wed, 5 Oct 2016 17:42:24 +0000 (17:42 +0000)]
Revert "[asan] Switch to using dynamic shadow offset on iOS"

This reverts commit b2af965b7924ad793b313996a96633bb72daf629.

Revert as these changes broke a Chromium buildbot.

llvm-svn: 283349

7 years agoRevert "[asan] LLVM: Switch to using dynamic shadow offset on iOS"
Anna Zaks [Wed, 5 Oct 2016 17:42:02 +0000 (17:42 +0000)]
Revert "[asan] LLVM: Switch to using dynamic shadow offset on iOS"

This reverts commit abe77a118615cd90b0d7f127e4797096afa2b394.

Revert as these changes broke a Chromium buildbot.

llvm-svn: 283348

7 years ago[DAG] Teach computeKnownBits and ComputeNumSignBits in SelectionDAG to look through...
Bjorn Pettersson [Wed, 5 Oct 2016 17:40:27 +0000 (17:40 +0000)]
[DAG] Teach computeKnownBits and ComputeNumSignBits in SelectionDAG to look through EXTRACT_VECTOR_ELT.

Summary: Both computeKnownBits and ComputeNumSignBits can now do a simple
look-through of EXTRACT_VECTOR_ELT. It will compute the result based
on the known bits (or known sign bits) for the vector that the element
is extracted from.

Reviewers: bogner, tstellarAMD, mkuper

Subscribers: wdng, RKSimon, jyknight, llvm-commits, nhaehnle

Differential Revision: https://reviews.llvm.org/D25007

llvm-svn: 283347

7 years agoTest commit permission. NFC
Bjorn Pettersson [Wed, 5 Oct 2016 17:22:11 +0000 (17:22 +0000)]
Test commit permission. NFC

llvm-svn: 283346

7 years agoConvert some breakpoint code to use StringRef.
Zachary Turner [Wed, 5 Oct 2016 17:07:47 +0000 (17:07 +0000)]
Convert some breakpoint code to use StringRef.

Differential revision: https://reviews.llvm.org/D25158

llvm-svn: 283345

7 years agoMake lldb -Werror clean on Windows.
Zachary Turner [Wed, 5 Oct 2016 17:07:34 +0000 (17:07 +0000)]
Make lldb -Werror clean on Windows.

Differential Revision: https://reviews.llvm.org/D25247

llvm-svn: 283344

7 years agoDisable warnings in LLDBWrapPython.cpp with -Werror.
Zachary Turner [Wed, 5 Oct 2016 17:07:16 +0000 (17:07 +0000)]
Disable warnings in LLDBWrapPython.cpp with -Werror.

When -Werror is used, we don't have control over the generated
code from SWIG, and it often has warnings.  Just disable them for
this file when -Werror is used, they are usually not important
anyway.

Differential revision: https://reviews.llvm.org/D25246

llvm-svn: 283343

7 years agoFix build due to comparison of std::pairs.
Zachary Turner [Wed, 5 Oct 2016 17:04:36 +0000 (17:04 +0000)]
Fix build due to comparison of std::pairs.

llvm-svn: 283342

7 years agoMark LWG#2358 as done
Marshall Clow [Wed, 5 Oct 2016 17:02:43 +0000 (17:02 +0000)]
Mark LWG#2358 as done

llvm-svn: 283341

7 years agoSimplify setting the Live bit in SectionPiece. NFC.
Rafael Espindola [Wed, 5 Oct 2016 17:02:09 +0000 (17:02 +0000)]
Simplify setting the Live bit in SectionPiece. NFC.

llvm-svn: 283340

7 years agoMake tests for is_empty better. No functional change.
Marshall Clow [Wed, 5 Oct 2016 17:01:16 +0000 (17:01 +0000)]
Make tests for is_empty better. No functional change.

llvm-svn: 283339

7 years ago[change-namespace] Pass Style to ChangeNamespaceTool.
Haojian Wu [Wed, 5 Oct 2016 17:00:40 +0000 (17:00 +0000)]
[change-namespace] Pass Style to ChangeNamespaceTool.

llvm-svn: 283338

7 years agoAdd llvm::enumerate() range adapter.
Zachary Turner [Wed, 5 Oct 2016 16:54:09 +0000 (16:54 +0000)]
Add llvm::enumerate() range adapter.

This allows you to enumerate over a range using a range-based
for while the return type contains the index of the enumeration.

Differential revision: https://reviews.llvm.org/D25124

llvm-svn: 283337

7 years agoDon't pass null to memcpy. Should fix the asan bots.
Rafael Espindola [Wed, 5 Oct 2016 16:33:03 +0000 (16:33 +0000)]
Don't pass null to memcpy. Should fix the asan bots.

llvm-svn: 283336

7 years ago[RenderScript] reflow/reword some comments and normalize names
Luke Drummond [Wed, 5 Oct 2016 16:27:48 +0000 (16:27 +0000)]
[RenderScript] reflow/reword some comments and normalize names

Pay more attention to comment alignement (Since _The Great Reformat_ (a015ff50)
comments are no longer properly aligned) and variable naming conventions.

- Manually reflow and cleanup comments and array literals
- Be more economical with our naming conventions
- Be internally consistent with regard to local variable/member function
  naming

llvm-svn: 283335

7 years agoRecommit: "[mips] Add rsqrt, recip for MIPS"
Simon Dardis [Wed, 5 Oct 2016 16:11:01 +0000 (16:11 +0000)]
Recommit: "[mips] Add rsqrt, recip for MIPS"

Add rsqrt.[ds], recip.[ds] for MIPS. Correct the microMIPS definitions for
architecture support and register usage.

Reviewers: vkalintiris, zoran.jovanoic

Differential Review: https://reviews.llvm.org/D24499

llvm-svn: 283334

7 years ago[change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.
Eric Liu [Wed, 5 Oct 2016 15:52:39 +0000 (15:52 +0000)]
[change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.

Reviewers: hokein

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25065

llvm-svn: 283333

7 years agoMake DeletedLines local variables in checkEmptyNamespace.
Eric Liu [Wed, 5 Oct 2016 15:49:01 +0000 (15:49 +0000)]
Make DeletedLines local variables in checkEmptyNamespace.

Summary: Patch by Sam McCall!

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D25162

llvm-svn: 283332

7 years agoAdd another append test for basic_string
Marshall Clow [Wed, 5 Oct 2016 15:47:13 +0000 (15:47 +0000)]
Add another append test for basic_string

llvm-svn: 283331

7 years ago[clang-format] append newline after code when inserting new headers at the end of...
Eric Liu [Wed, 5 Oct 2016 15:42:19 +0000 (15:42 +0000)]
[clang-format] append newline after code when inserting new headers at the end of the code which does not end with newline.

Summary:
append newline after code when inserting new headers at the end of the
code which does not end with newline.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D21026

llvm-svn: 283330

7 years agoRevert r282920 "X86: Allow conditional tail calls in Win64 "leaf" functions (PR26302)"
Hans Wennborg [Wed, 5 Oct 2016 15:39:27 +0000 (15:39 +0000)]
Revert r282920 "X86: Allow conditional tail calls in Win64 "leaf" functions (PR26302)"

This is suspected to cause a miscompile in Chromium. Reverting while
investigating.

llvm-svn: 283329

7 years agoRemove redundant check. NFC.
Rafael Espindola [Wed, 5 Oct 2016 15:35:18 +0000 (15:35 +0000)]
Remove redundant check. NFC.

llvm-svn: 283328

7 years agoRevert "[mips] Add rsqrt, recip for MIPS"
Simon Dardis [Wed, 5 Oct 2016 15:28:33 +0000 (15:28 +0000)]
Revert "[mips] Add rsqrt, recip for MIPS"

This reverts commit r282485 which contain two patches instead of
one.

llvm-svn: 283327

7 years ago[X86] Don't randomly encode %rip where illegal
Douglas Katzman [Wed, 5 Oct 2016 15:23:35 +0000 (15:23 +0000)]
[X86] Don't randomly encode %rip where illegal

Differential Revision: https://reviews.llvm.org/D25112

llvm-svn: 283326

7 years agoMark LWG issues 2221, 2556 and 2589 as complete
Marshall Clow [Wed, 5 Oct 2016 15:21:11 +0000 (15:21 +0000)]
Mark LWG issues 2221, 2556 and 2589 as complete

llvm-svn: 283325

7 years agoxfailing minidump tests again ... :(
Dimitar Vlahovski [Wed, 5 Oct 2016 15:00:29 +0000 (15:00 +0000)]
xfailing minidump tests again ... :(

llvm-svn: 283324

7 years ago[Thumb] Don't try and emit LDRH/LDRB from the constant pool
James Molloy [Wed, 5 Oct 2016 14:52:13 +0000 (14:52 +0000)]
[Thumb] Don't try and emit LDRH/LDRB from the constant pool

This is not a valid encoding - these instructions cannot do PC-relative addressing.

The underlying problem here is of whitelist in ARMISelDAGToDAG that unwraps ARMISD::Wrappers during addressing-mode selection. This didn't realise TargetConstantPool was actually possible, so didn't handle it.

llvm-svn: 283323

7 years ago[X86] Fix some tests that didn't assert anything
Douglas Katzman [Wed, 5 Oct 2016 14:46:14 +0000 (14:46 +0000)]
[X86] Fix some tests that didn't assert anything

llvm-svn: 283322

7 years agoFixing new Minidump plugin tests
Dimitar Vlahovski [Wed, 5 Oct 2016 14:35:30 +0000 (14:35 +0000)]
Fixing new Minidump plugin tests

llvm-svn: 283321

7 years agocleanup RSCoordinate handling and factor out coordinate parser
Luke Drummond [Wed, 5 Oct 2016 14:34:52 +0000 (14:34 +0000)]
cleanup RSCoordinate handling and factor out coordinate parser

- This change updates the signature of
`RenderScriptRuntime::PlaceBreakpointOnKernel` to take a default
RSCoordinate pointer of nullptr. We use this as the predicate value for
the breakpoint coordinate rather than trying to fit a sentinel `-1` into
a signed version.

```
- void
- PlaceBreakpointOnKernel(Stream &strm, const char *name, const std::array<int, 3> coords, Error &error,
- lldb::TargetSP target);
```

```
+ bool
+ PlaceBreakpointOnKernel(lldb::TargetSP target, Stream &messages, const char *name,
+ const lldb_renderscript::RSCoordinate *coords = nullptr);
```
The above change makes the API for setting breakpoints on kernels
cleaner as it returns a failure value rather than modify a sentinel in
the caller. The optional arguments are now last and have a default
(falsey) value.

- RSCoordinate objects are now comparable with operator== and have
  zero initializers which should make them easier to work on.
- Added a `FMT_COORD` macro for use in logging format strings which
  should make format strings a little less verbose.

llvm-svn: 283320

7 years agoTest commit permission
Oren Ben Simhon [Wed, 5 Oct 2016 14:12:41 +0000 (14:12 +0000)]
Test commit permission

llvm-svn: 283319

7 years agoTest commit permission
Oren Ben Simhon [Wed, 5 Oct 2016 13:48:33 +0000 (13:48 +0000)]
Test commit permission

llvm-svn: 283318

7 years ago[AVR] Don't select 'MOVW' instructions when they are not supported
Dylan McKay [Wed, 5 Oct 2016 13:38:29 +0000 (13:38 +0000)]
[AVR] Don't select 'MOVW' instructions when they are not supported

We have a subtarget feature which we were ignoring, which was causing us
to generate unsupported instructions for some older chips.

llvm-svn: 283317

7 years ago[AVR] Add AVRRegisterInfo::splitReg function
Dylan McKay [Wed, 5 Oct 2016 13:27:30 +0000 (13:27 +0000)]
[AVR] Add AVRRegisterInfo::splitReg function

No tests are included just yet - this is used from the pseudo
instruction expander pass, which hasn't been pulled in-tree yet.

llvm-svn: 283316