platform/upstream/llvm.git
8 years agoMachineInstr: Fix comment typo, further refine comment; NFC
Matthias Braun [Mon, 26 Sep 2016 18:38:05 +0000 (18:38 +0000)]
MachineInstr: Fix comment typo, further refine comment; NFC

llvm-svn: 282424

8 years ago[AArch64] Fix test triplet
Evandro Menezes [Mon, 26 Sep 2016 18:09:21 +0000 (18:09 +0000)]
[AArch64] Fix test triplet

Specify proper target triplet to pass under Windows too.

llvm-svn: 282423

8 years ago[llvm-cov] Silence a warning from the MSVC runtime (NFC)
Vedant Kumar [Mon, 26 Sep 2016 17:57:13 +0000 (17:57 +0000)]
[llvm-cov] Silence a warning from the MSVC runtime (NFC)

Rework getLongestCommonPrefixLen() so that it doesn't access string null
terminators. The old version with std::mismatch would do this:

                        |
                        v
    Strings[0] = ['a', nil]

    Strings[1] = ['a', 'a', nil]
                        ^
                        |

This should silence a warning from the MSVC runtime (PR30515). As
before, I tested this out by preparing a coverage report for FileCheck.
Thanks to Yaron Keren for the report!

llvm-svn: 282422

8 years agoUpdate MemorySSA unittest to account for non-pruned SSA form
Daniel Berlin [Mon, 26 Sep 2016 17:44:31 +0000 (17:44 +0000)]
Update MemorySSA unittest to account for non-pruned SSA form

llvm-svn: 282421

8 years agoAMDGPU/SI: Don't crash on anonymous GlobalValues
Tom Stellard [Mon, 26 Sep 2016 17:29:25 +0000 (17:29 +0000)]
AMDGPU/SI: Don't crash on anonymous GlobalValues

Summary:
We need to call AsmPrinter::getNameWithPrefix() in order to handle
anonymous GlobalValues (e.g. @0, @1).

Reviewers: arsenm, b-sumner

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 282420

8 years agoRemove pruning of phi nodes in MemorySSA - it makes updating harder
Daniel Berlin [Mon, 26 Sep 2016 17:22:54 +0000 (17:22 +0000)]
Remove pruning of phi nodes in MemorySSA - it makes updating harder

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 282419

8 years ago[LV] Scalarize instructions marked scalar after vectorization
Matthew Simpson [Mon, 26 Sep 2016 17:08:37 +0000 (17:08 +0000)]
[LV] Scalarize instructions marked scalar after vectorization

This patch ensures that we actually scalarize instructions marked scalar after
vectorization. Previously, such instructions may have been vectorized instead.

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

llvm-svn: 282418

8 years agoComplete support for the cxxCtorInitializer() AST matcher so that it can be used...
Aaron Ballman [Mon, 26 Sep 2016 17:04:27 +0000 (17:04 +0000)]
Complete support for the cxxCtorInitializer() AST matcher so that it can be used as a top-level matcher.

llvm-svn: 282417

8 years ago[ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.
Haojian Wu [Mon, 26 Sep 2016 16:01:52 +0000 (16:01 +0000)]
[ASTMatcher] Add isStaticStorageClass matcher for varDecl and functionDecl.

Reviewers: klimek

Subscribers: cfe-commits, klimek

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

llvm-svn: 282415

8 years ago[Coroutines] Part14: Handle coroutines with no suspend points.
Gor Nishanov [Mon, 26 Sep 2016 15:49:28 +0000 (15:49 +0000)]
[Coroutines] Part14: Handle coroutines with no suspend points.

Summary:
If coroutine has no suspend points, remove heap allocation and turn a coroutine into a normal function.

Also, if a pattern is detected that coroutine resumes or destroys itself prior to coro.suspend call, turn the suspend point into a simple jump to resume or cleanup label. This pattern occurs when coroutines are used to propagate errors in functions that return expected<T>.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 282414

8 years ago[AArch64] Improve add/sub/cmp isel of uxtw forms.
Geoff Berry [Mon, 26 Sep 2016 15:34:47 +0000 (15:34 +0000)]
[AArch64] Improve add/sub/cmp isel of uxtw forms.

Don't match the UXTW extended reg forms of ADD/ADDS/SUB/SUBS if the
32-bit to 64-bit zero-extend can be done for free by taking advantage
of the 32-bit defining instruction zeroing the upper 32-bits of the X
register destination.  This enables better instruction selection in a
few cases, such as:

  sub x0, xzr, x8
  instead of:
  mov x8, xzr
  sub x0, x8, w9, uxtw

  madd x0, x1, x1, x8
  instead of:
  mul x9, x1, x1
  add x0, x9, w8, uxtw

  cmp x2, x8
  instead of:
  sub x8, x2, w8, uxtw
  cmp x8, #0

  add x0, x8, x1, lsl #3
  instead of:
  lsl x9, x1, #3
  add x0, x9, w8, uxtw

Reviewers: t.p.northover, jmolloy

Subscribers: mcrosier, aemerson, llvm-commits, rengolin

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

llvm-svn: 282413

8 years agoAdd support to optionally limit the size of jump tables.
Evandro Menezes [Mon, 26 Sep 2016 15:32:33 +0000 (15:32 +0000)]
Add support to optionally limit the size of jump tables.

Many high-performance processors have a dedicated branch predictor for
indirect branches, commonly used with jump tables.  As sophisticated as such
branch predictors are, they tend to have well defined limits beyond which
their effectiveness is hampered or even nullified.  One such limit is the
number of possible destinations for a given indirect branches that such
branch predictors can handle.

This patch considers a limit that a target may set to the number of
destination addresses in a jump table.

Patch by: Evandro Menezes <e.menezes@samsung.com>, Aditya Kumar
<aditya.k7@samsung.com>, Sebastian Pop <s.pop@samsung.com>.

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

llvm-svn: 282412

8 years ago[analyzer] Improve CastToStruct checker so it can also detect widening casts of struc...
Daniel Marjamaki [Mon, 26 Sep 2016 15:17:18 +0000 (15:17 +0000)]
[analyzer] Improve CastToStruct checker so it can also detect widening casts of struct data

Example:

struct AB {
  int A;
  int B;
};

struct ABC {
  int A;
  int B;
  int C;
};

void f() {
  struct AB Data;
  struct ABC *P = (struct ABC *)&Data;
}

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

llvm-svn: 282411

8 years agoclang-format: Only special-case top-level */& in multivar-declstmts.
Daniel Jasper [Mon, 26 Sep 2016 15:14:24 +0000 (15:14 +0000)]
clang-format: Only special-case top-level */& in multivar-declstmts.

Before (even with PointerAlignment: Left):
  vector<int *> a, b;

After:
  vector<int*> a, b;

llvm-svn: 282410

8 years agoSilence a false positive with the cert-err58-cpp check; now allows objects with stati...
Aaron Ballman [Mon, 26 Sep 2016 15:00:45 +0000 (15:00 +0000)]
Silence a false positive with the cert-err58-cpp check; now allows objects with static or thread storage duration at function block scope.

Patch by Malcolm Parsons

llvm-svn: 282409

8 years agoRemove ancient icc decorators
Pavel Labath [Mon, 26 Sep 2016 14:34:02 +0000 (14:34 +0000)]
Remove ancient icc decorators

Nobody is running the test suite with icc, so we have no idea if they pass. But
the bug they link to has definitely been fixed.

llvm-svn: 282408

8 years agotsan: relaxed check in CheckShadowMapping
Dmitry Vyukov [Mon, 26 Sep 2016 14:23:34 +0000 (14:23 +0000)]
tsan: relaxed check in CheckShadowMapping

Some platforms use strange addresses in shadow mapping.
E.g. aarch64/42vma:
  static const uptr kHiAppMemEnd   = 0x3ffffffffffull;
instead of 0x40000000000ull (the range is half-open).
This caused bot failures after r282405:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12242/steps/ninja%20check%201/logs/FAIL%3A%20SanitizerCommon-tsan-aarch64-Linux%3A%3Aclock_gettime.c
Relaxed the new check in CheckShadowMapping to not expect round addresses.

llvm-svn: 282407

8 years agoRemove an ancient XFAIL from TestBuiltinTrap
Pavel Labath [Mon, 26 Sep 2016 13:50:06 +0000 (13:50 +0000)]
Remove an ancient XFAIL from TestBuiltinTrap

in refers to gcc-4.6. Hopefully noone is using that anymore, and I think there is
a good chance it was fixed anyway.

llvm-svn: 282406

8 years agotsan: make shadow mapping linear within a single user region
Dmitry Vyukov [Mon, 26 Sep 2016 13:41:33 +0000 (13:41 +0000)]
tsan: make shadow mapping linear within a single user region

This is a follow up to r282152.
A more extensive testing on real apps revealed a subtle bug in r282152.
The revision made shadow mapping non-linear even within a single
user region. But there are lots of code in runtime that processes
memory ranges and assumes that mapping is linear. For example,
region memory access handling simply increments shadow address
to advance to the next shadow cell group. Similarly, DontNeedShadowFor,
java memory mover, search of heap memory block header, etc
make similar assumptions.
To trigger the bug user range would need to cross 0x008000000000 boundary.
This was observed for a module data section.

Make shadow mapping linear within a single user range again.
Add a startup CHECK for linearity.

llvm-svn: 282405

8 years agotsan: remove kMidShadowOff mapping parameter
Dmitry Vyukov [Mon, 26 Sep 2016 13:27:07 +0000 (13:27 +0000)]
tsan: remove kMidShadowOff mapping parameter

kMidShadowOff is trivially computable from other parameters.
Remove it.

llvm-svn: 282404

8 years agotsan: simplify meta mapping
Dmitry Vyukov [Mon, 26 Sep 2016 13:24:48 +0000 (13:24 +0000)]
tsan: simplify meta mapping

Don't xor user address with kAppMemXor in meta mapping.
The only purpose of kAppMemXor is to raise shadow for ~0 user addresses,
so that they don't map to ~0 (which would cause overlap between
user memory and shadow).
For meta mapping we explicitly add kMetaShadowBeg offset,
so we don't need to additionally raise meta shadow.

llvm-svn: 282403

8 years agoIn the get started page, also explain how to start the testsuite
Sylvestre Ledru [Mon, 26 Sep 2016 13:22:34 +0000 (13:22 +0000)]
In the get started page, also explain how to start the testsuite

llvm-svn: 282402

8 years ago[InstCombine] Fixed bug introduced in r282237
Alexey Bataev [Mon, 26 Sep 2016 13:18:59 +0000 (13:18 +0000)]
[InstCombine] Fixed bug introduced in r282237

The index of the new insertelement instruction was evaluated in the
wrong way, it was considered as the index of the inserted value instead
of index of the position, where the value should be inserted.

llvm-svn: 282401

8 years agoupdate the link to the code coverage
Sylvestre Ledru [Mon, 26 Sep 2016 12:53:53 +0000 (12:53 +0000)]
update the link to the code coverage

llvm-svn: 282400

8 years agoFix typo in comment, NFC
Krzysztof Parzyszek [Mon, 26 Sep 2016 12:38:03 +0000 (12:38 +0000)]
Fix typo in comment, NFC

llvm-svn: 282399

8 years ago[InstCombine] Teach the udiv folding logic how to handle constant expressions.
Andrea Di Biagio [Mon, 26 Sep 2016 12:07:23 +0000 (12:07 +0000)]
[InstCombine] Teach the udiv folding logic how to handle constant expressions.

This patch fixes PR30366.

Function foldUDivShl() worked under the assumption that one of the values
in input to the function was always an instance of llvm::Instruction.
However, function visitUDivOperand() (the only user of foldUDivShl) was
clearly violating that precondition; internally, visitUDivOperand() uses pattern
matches to check the operands of a udiv. Pattern matchers for binary operators
know how to handle both Instruction and ConstantExpr values.

This patch fixes the problem in foldUDivShl(). Now we use pattern matchers
instead of explicit casts to Instruction. The reduced test case from PR30366
has been added to test file InstCombine/udiv-simplify.ll.

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

llvm-svn: 282398

8 years ago[AVR] Add AVRMCExpr
Dylan McKay [Mon, 26 Sep 2016 11:35:32 +0000 (11:35 +0000)]
[AVR] Add AVRMCExpr

Summary: This adds the AVRMCExpr headers and implementation.

Reviewers: arsenm, ruiu, grosbach, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, jtbandes, llvm-commits

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

llvm-svn: 282397

8 years agoRevert "[AMDGPU] Disassembler: print label names in branch instructions"
Sam Kolton [Mon, 26 Sep 2016 11:29:03 +0000 (11:29 +0000)]
Revert "[AMDGPU] Disassembler: print label names in branch instructions"

This reverts commit 6c6dbe625263ec9fcf8de0df27263cf147cde550.

llvm-svn: 282396

8 years ago[ELF] - Format. NFC.
George Rimar [Mon, 26 Sep 2016 11:00:48 +0000 (11:00 +0000)]
[ELF] - Format. NFC.

llvm-svn: 282395

8 years ago[AMDGPU] Disassembler: print label names in branch instructions
Sam Kolton [Mon, 26 Sep 2016 10:05:50 +0000 (10:05 +0000)]
[AMDGPU] Disassembler: print label names in branch instructions

Summary: Add AMDGPUSymbolizer for finding names for labels from ELF symbol table.

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 282394

8 years agoLinkerscript: don't crash when GC .debug_line
Eugene Leviant [Mon, 26 Sep 2016 09:04:16 +0000 (09:04 +0000)]
Linkerscript: don't crash when GC .debug_line

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

llvm-svn: 282393

8 years agoLinkerscript: do not GC non-allocated sections
Eugene Leviant [Mon, 26 Sep 2016 08:32:41 +0000 (08:32 +0000)]
Linkerscript: do not GC non-allocated sections

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

llvm-svn: 282391

8 years ago[msan] Fix second parameter in MsanReallocate from previous commit.
Maxim Ostapenko [Mon, 26 Sep 2016 08:26:23 +0000 (08:26 +0000)]
[msan] Fix second parameter in MsanReallocate from previous commit.

It's wrong to pass to MsanReallocate a pointer that MSan allocator doesn't own.
Use nullptr instead of ptr to prevent possible (still unlikely) failure.

llvm-svn: 282390

8 years ago[asan, msan] Fix reallocation logic when IsInDlsymAllocPool(ptr) is true.
Maxim Ostapenko [Mon, 26 Sep 2016 08:11:21 +0000 (08:11 +0000)]
[asan, msan] Fix reallocation logic when IsInDlsymAllocPool(ptr) is true.

llvm-svn: 282389

8 years ago[clang-rename] Use checktime when reloading vim buffer after applying clang-rename
Kirill Bobyrev [Mon, 26 Sep 2016 07:26:32 +0000 (07:26 +0000)]
[clang-rename] Use checktime when reloading vim buffer after applying clang-rename

After applying `clang-rename` to a vim buffer (using `clang-rename.py` as part
of the vim integration) the buffer gets reloaded using `bufdo`. This solution is
suboptimal, since syntax highlighting is turned off for performance reasons and
never turned on, after all changes to the source file have been applied.

A better solution to this is using `checktime`. It is exactly designed for this
kind of task and doesn't have the syntax highlighting issue.

Patch by Kai Wolf!

Reviewers: omtcyfz

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

llvm-svn: 282388

8 years ago[ARM] Promote small global constants to constant pools
James Molloy [Mon, 26 Sep 2016 07:26:24 +0000 (07:26 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

This recommit contains fixes for a nasty bug related to fast-isel fallback - because
fast-isel doesn't know about this optimization, if it runs and emits references to
a string that we inline (because fast-isel fell back to SDAG) we will end up
with an inlined string and also an out-of-line string, and we won't emit the
out-of-line string, causing backend failures.

It also contains fixes for emitting .text relocations which made the sanitizer
bots unhappy.

llvm-svn: 282387

8 years ago[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions
Kirill Bobyrev [Mon, 26 Sep 2016 07:22:37 +0000 (07:22 +0000)]
[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions

This patch extends clang-tidy's readability-redundant-smartptr-get to produce
warnings for previously unsupported cases:

```
std::unique_ptr<void> ptr;
if (ptr.get())
if (ptr.get() == NULL)
if (ptr.get() != NULL)
```

This is intended to fix https://llvm.org/bugs/show_bug.cgi?id=25804, a bug
report opened by @Eugene.Zelenko.

However, there still are cases not detected by the check. They can be found in
`void Negative()` function defined in
test/clang-tidy/readability-redundant-smartptr-get.cpp.

Reviewers: alexfh

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

llvm-svn: 282386

8 years ago[X86] Optimization for replacing LEA with MOV at frame index elimination time
Zvi Rackover [Mon, 26 Sep 2016 06:42:07 +0000 (06:42 +0000)]
[X86] Optimization for replacing LEA with MOV at frame index elimination time

Summary:
Replace a LEA instruction of the form 'lea (%esp), %ebx' --> 'mov %esp, %ebx'

MOV is preferable over LEA because usually there are more issue-slots available to execute MOVs than LEAs. Latest processors also support zero-latency MOVs.

Fixes pr29022.

Reviewers: hfinkel, delena, igorb, myatsina, mkuper

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

llvm-svn: 282385

8 years agoRevert r282382; it had no reference to Revision.
Kirill Bobyrev [Mon, 26 Sep 2016 06:33:58 +0000 (06:33 +0000)]
Revert r282382; it had no reference to Revision.

llvm-svn: 282384

8 years ago[PM] Refactor this unittest a bit to remove duplicated code. This was
Chandler Carruth [Mon, 26 Sep 2016 06:29:21 +0000 (06:29 +0000)]
[PM] Refactor this unittest a bit to remove duplicated code. This was
suggested at one point during code review and I deferred it to
a follow-up commit.

llvm-svn: 282383

8 years ago[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions
Kirill Bobyrev [Mon, 26 Sep 2016 06:22:54 +0000 (06:22 +0000)]
[clang-tidy] make readability-redundant-smartptr-get report get() usage in conditions

This patch extends clang-tidy's readability-redundant-smartptr-get to produce
warnings for previously unsupported cases:

```
std::unique_ptr<void> ptr;
if (ptr.get())
if (ptr.get() == NULL)
if (ptr.get() != NULL)
```

This is intended to fix https://llvm.org/bugs/show_bug.cgi?id=25804, a bug
report opened by @Eugene.Zelenko.

However, there still are cases not detected by the check. They can be found in
`void Negative()` function defined in
test/clang-tidy/readability-redundant-smartptr-get.cpp.

llvm-svn: 282382

8 years ago[X86][avx512] Fix bug in masked compress store.
Ayman Musa [Mon, 26 Sep 2016 06:22:08 +0000 (06:22 +0000)]
[X86][avx512] Fix bug in masked compress store.

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

llvm-svn: 282381

8 years ago[SCEV] Fix the order of members in the initializer list.
Chandler Carruth [Mon, 26 Sep 2016 04:49:58 +0000 (04:49 +0000)]
[SCEV] Fix the order of members in the initializer list.

Noticed due to the warning on this line. Sanjoy is on
a less-than-awesome internet connection, so committing on his behalf.

llvm-svn: 282380

8 years agoDriver: avoid failing in the backend
Saleem Abdulrasool [Mon, 26 Sep 2016 04:48:22 +0000 (04:48 +0000)]
Driver: avoid failing in the backend

Avoid failing in the backend when the rewrite map does not exist.  Rather check
that the map exists in the frontend before handing it off to the backend.  Add
the missing rewrite maps that the tests were referencing.

llvm-svn: 282379

8 years ago[PM] Add a unittest covering the invalidation of a Module analysis from
Chandler Carruth [Mon, 26 Sep 2016 04:17:12 +0000 (04:17 +0000)]
[PM] Add a unittest covering the invalidation of a Module analysis from
a function pass nested inside of a CGSCC pass manager.

This is very similar to the previous unittest but makes sure the
invalidation logic works across all the layers here.

llvm-svn: 282378

8 years ago[PM] Add a unittest for invalidating module analyses with an SCC pass.
Chandler Carruth [Mon, 26 Sep 2016 04:01:55 +0000 (04:01 +0000)]
[PM] Add a unittest for invalidating module analyses with an SCC pass.

This reinstates r280447. Original commit log:
This wasn't really well explicitly tested with a nice unittest before.
It seems good to have reasonably broken out unittests for this kind of
functionality as I'm workin go other invalidation features to make sure
none of the existing ones regress.

This still has too much duplicated code, I plan to factor that out in
a subsequent commit to use common helpers for repeated parts of this.

llvm-svn: 282377

8 years ago[SCEV] Assign LoopPropertiesCache in the move constructor
Sanjoy Das [Mon, 26 Sep 2016 02:44:10 +0000 (02:44 +0000)]
[SCEV] Assign LoopPropertiesCache in the move constructor

In a previous change I collapsed two different caches into one.  When
doing that I noticed that ScalarEvolution's move constructor was not
moving those caches.

To keep the previous change simple, I've moved that bugfix into this
separate change.

llvm-svn: 282376

8 years ago[SCEV] Combine two predicates into one; NFC
Sanjoy Das [Mon, 26 Sep 2016 02:44:07 +0000 (02:44 +0000)]
[SCEV] Combine two predicates into one; NFC

Both `loopHasNoSideEffects` and `loopHasNoAbnormalExits` involve walking
the loop and maintaining similar sorts of caches.  This commit changes
SCEV to compute both the predicates via a single walk, and maintain a
single cache instead of two.

llvm-svn: 282375

8 years ago[SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage
Sanjoy Das [Mon, 26 Sep 2016 01:10:27 +0000 (01:10 +0000)]
[SCEV] Make it obvious BackedgeTakenInfo's constructor steals storage

Specifically, it moves SCEVUnionPredicates from its input into its own
storage.  Make this obvious at the type level.

llvm-svn: 282374

8 years ago[SCEV] Further isolate incidental data structure; NFC
Sanjoy Das [Mon, 26 Sep 2016 01:10:25 +0000 (01:10 +0000)]
[SCEV] Further isolate incidental data structure; NFC

llvm-svn: 282373

8 years ago[SCEV] Simplify BackedgeTakenInfo::getMax; NFC
Sanjoy Das [Mon, 26 Sep 2016 01:10:22 +0000 (01:10 +0000)]
[SCEV] Simplify BackedgeTakenInfo::getMax; NFC

llvm-svn: 282372

8 years ago[AMDGPU] Expose flat work group size, register and wave control attributes
Konstantin Zhuravlyov [Mon, 26 Sep 2016 01:02:57 +0000 (01:02 +0000)]
[AMDGPU] Expose flat work group size, register and wave control attributes

__attribute__((amdgpu_flat_work_group_size(<min>, <max>))) - request minimum and maximum flat work group size
__attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) - request minimum and/or maximum waves per execution unit

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

llvm-svn: 282371

8 years agoAppease MSVC
Sanjoy Das [Mon, 26 Sep 2016 00:22:18 +0000 (00:22 +0000)]
Appease MSVC

... by not default move constructors and operator= s. Defaulting these
works in clang, but not in MSVC.

llvm-svn: 282370

8 years agoAttempt to appease MSVC
Sanjoy Das [Mon, 26 Sep 2016 00:00:51 +0000 (00:00 +0000)]
Attempt to appease MSVC

... by explicitly deleting the copy constructor.

llvm-svn: 282369

8 years ago[SCEV] Reserve space in SmallVector; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:08 +0000 (23:12 +0000)]
[SCEV] Reserve space in SmallVector; NFC

llvm-svn: 282368

8 years ago[SCEV] Document a gotcha; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:06 +0000 (23:12 +0000)]
[SCEV] Document a gotcha; NFC

We should re-consider the design decision that led to this gotcah, but
for now just document it.

llvm-svn: 282367

8 years ago[SCEV] Have ExitNotTakenInfo keep a pointer to its predicate; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:04 +0000 (23:12 +0000)]
[SCEV] Have ExitNotTakenInfo keep a pointer to its predicate; NFC

SCEVUnionPredicate is a "heavyweight" structure, so it is beneficial to
store the (optional) data out of line.

llvm-svn: 282366

8 years ago[SCEV] Simplify tracking ExitNotTakenInfo instances; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:12:00 +0000 (23:12 +0000)]
[SCEV] Simplify tracking ExitNotTakenInfo instances; NFC

This change simplifies a data structure optimization in the
`BackedgeTakenInfo` class for loops with exactly one computable exit.

I've sanity checked that this does not regress compile time performance,
using sqlite3's amalgamated build.

llvm-svn: 282365

8 years ago[SCEV] Rename a couple of fields; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:57 +0000 (23:11 +0000)]
[SCEV] Rename a couple of fields; NFC

llvm-svn: 282364

8 years ago[SCEV] Remove incidental data structure; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:55 +0000 (23:11 +0000)]
[SCEV] Remove incidental data structure; NFC

llvm-svn: 282363

8 years ago[SCEV] Clang format most of the SCEV header; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:51 +0000 (23:11 +0000)]
[SCEV] Clang format most of the SCEV header; NFC

The indentation for the declared classes was not as per LLVM coding
style.

llvm-svn: 282362

8 years ago[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).
Craig Topper [Sun, 25 Sep 2016 16:34:11 +0000 (16:34 +0000)]
[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).

llvm-svn: 282361

8 years ago[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowerin...
Craig Topper [Sun, 25 Sep 2016 16:34:09 +0000 (16:34 +0000)]
[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowering explicitly avoids creating this pattern.

llvm-svn: 282360

8 years ago[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchin...
Craig Topper [Sun, 25 Sep 2016 16:34:06 +0000 (16:34 +0000)]
[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchingSuperReg.

llvm-svn: 282359

8 years ago[AVX-512] Fix some patterns predicates to properly enforce priority for various versi...
Craig Topper [Sun, 25 Sep 2016 16:34:02 +0000 (16:34 +0000)]
[AVX-512] Fix some patterns predicates to properly enforce priority for various versions of CVTDQ2PD instruction.

llvm-svn: 282358

8 years ago[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.
Craig Topper [Sun, 25 Sep 2016 16:33:59 +0000 (16:33 +0000)]
[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.

llvm-svn: 282357

8 years ago[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRe...
Craig Topper [Sun, 25 Sep 2016 16:33:57 +0000 (16:33 +0000)]
[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRegUpdate.

llvm-svn: 282356

8 years ago[AVX-512] Remove duplicate instructions for converting integer to scalar floating...
Craig Topper [Sun, 25 Sep 2016 16:33:53 +0000 (16:33 +0000)]
[AVX-512] Remove duplicate instructions for converting integer to scalar floating point. We can use patterns to point to the other instructions instead.

llvm-svn: 282355

8 years agoUpdate -verify test to use new static assert message
Eric Fiselier [Sun, 25 Sep 2016 08:30:05 +0000 (08:30 +0000)]
Update -verify test to use new static assert message

llvm-svn: 282352

8 years agowww: add new code coverage link to Polly website
Tobias Grosser [Sun, 25 Sep 2016 08:03:38 +0000 (08:03 +0000)]
www: add new code coverage link to Polly website

llvm-svn: 282351

8 years agoAdd a comment on StringRef::contains(char)
Zachary Turner [Sun, 25 Sep 2016 04:06:39 +0000 (04:06 +0000)]
Add a comment on StringRef::contains(char)

llvm-svn: 282350

8 years agoFix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function
Eric Fiselier [Sun, 25 Sep 2016 04:05:46 +0000 (04:05 +0000)]
Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function

llvm-svn: 282349

8 years agoFix signed / unsigned comparison.
Zachary Turner [Sun, 25 Sep 2016 03:57:34 +0000 (03:57 +0000)]
Fix signed / unsigned comparison.

llvm-svn: 282348

8 years ago[libc++] Remove various C++03 feature test macros
Eric Fiselier [Sun, 25 Sep 2016 03:34:28 +0000 (03:34 +0000)]
[libc++] Remove various C++03 feature test macros

Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 282347

8 years agoAdd some predicated searching functions to StringRef.
Zachary Turner [Sun, 25 Sep 2016 03:27:29 +0000 (03:27 +0000)]
Add some predicated searching functions to StringRef.

This adds 4 new functions to StringRef, which can be used to
take or drop characters while a certain condition is met, or
until a certain condition is met.  They are:

take_while - Return characters until a condition is not met.
take_until - Return characters until a condition is met.
drop_while - Remove characters until a condition is not met.
drop_until - Remove characters until a condition is met.

Internally, all of these functions delegate to two additional
helper functions which can be used to search for the position
of a character meeting or not meeting a condition, which are:

find_if - Find the first character matching a predicate.
find_if_not - Find the first character not matching a predicate.

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

llvm-svn: 282346

8 years agoUse __attribute__((internal_linkage)) when available.
Eric Fiselier [Sun, 25 Sep 2016 03:14:13 +0000 (03:14 +0000)]
Use __attribute__((internal_linkage)) when available.

Summary:
This patch has been a long time coming (Thanks @eugenis). It changes `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` instead of `__attribute__((visibility("hidden"), always_inline))`.

The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from being exported from both the libc++ library and from user libraries. This helps libc++ better manage it's ABI.
Previously this was done by forcing inlining and modifying the symbols visibility. However inlining isn't guaranteed and symbol visibility only affects shared libraries making this an imperfect solution.  `internal_linkage` improves this situation by making all symbols local to the TU they are emitted in, regardless of inlining or visibility. IIRC the effect of applying `__attribute__((internal_linkage))` to an inline function is the same as applying `static`.

For more information about the attribute see: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html

Most of the work for this patch was done by @eugenis.

Reviewers: mclow.lists, eugenis

Subscribers: eugenis, cfe-commits

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

llvm-svn: 282345

8 years ago[AVX-512] Don't use two opcodes for INTR_TYPE_SCALAR_MASK_RM. The handling was such...
Craig Topper [Sun, 25 Sep 2016 01:03:10 +0000 (01:03 +0000)]
[AVX-512] Don't use two opcodes for INTR_TYPE_SCALAR_MASK_RM. The handling was such that if the second opcode was present the first was ingored, so we can just have one opcode.

llvm-svn: 282344

8 years agoFix a few static_asserts that need extra parens on -03
Marshall Clow [Sat, 24 Sep 2016 23:52:21 +0000 (23:52 +0000)]
Fix a few static_asserts that need extra parens on -03

llvm-svn: 282343

8 years agoImplement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would...
Marshall Clow [Sat, 24 Sep 2016 22:45:42 +0000 (22:45 +0000)]
Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest)

llvm-svn: 282342

8 years ago[X86] Teach combineShuffle to avoid creating floating point operations with integer...
Craig Topper [Sat, 24 Sep 2016 21:42:49 +0000 (21:42 +0000)]
[X86] Teach combineShuffle to avoid creating floating point operations with integer types and integer operations with floating point types. Seems isOperationLegal lies for mismatched types and operations.

Fixes PR30511.

llvm-svn: 282341

8 years ago[AVX-512] Split scalar version of X86ISD::SELECT into a separate opcode because isel...
Craig Topper [Sat, 24 Sep 2016 21:42:47 +0000 (21:42 +0000)]
[AVX-512] Split scalar version of X86ISD::SELECT into a separate opcode because isel is not robust with multiple type profiles for the same opcode.

llvm-svn: 282340

8 years ago[AVX-512] Remove the patterns for selecting scalar VCOMI/VUCOMI instructions with...
Craig Topper [Sat, 24 Sep 2016 21:42:43 +0000 (21:42 +0000)]
[AVX-512] Remove the patterns for selecting scalar VCOMI/VUCOMI instructions with SAE as there is no way to create the pattern.

llvm-svn: 282339

8 years agoObjCARC: Don't look at users of ConstantData
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 21:01:20 +0000 (21:01 +0000)]
ObjCARC: Don't look at users of ConstantData

Stop looking at users of UndefValue and ConstantPointerNull in the
objective C ARC optimizers.  The other users aren't actually
interesting, since they're not pointing at a particular object.  I
imagine these calls could be optimized through -instcombine... maybe
they already are?

These early returns will be required at some point in the future, with a
WIP patch that asserts when someone accesses a use-list on ConstantData.

llvm-svn: 282338

8 years agoAnalysis: Return early for UndefValue in computeKnownBits
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 20:42:02 +0000 (20:42 +0000)]
Analysis: Return early for UndefValue in computeKnownBits

There is no benefit in looking through assumptions on UndefValue to
guess known bits.  Return early to avoid walking their use-lists, and
assert that all instances of ConstantData are handled here for similar
reasons (UndefValue was the only integer/pointer holdout).

llvm-svn: 282337

8 years ago[x86] don't try to create a vector integer inst for an SSE1 target (PR30512)
Sanjay Patel [Sat, 24 Sep 2016 20:24:06 +0000 (20:24 +0000)]
[x86] don't try to create a vector integer inst for an SSE1 target (PR30512)

This bug was introduced with:
http://reviews.llvm.org/rL272511

We need to restrict the lowering to v4f32 comparisons because that's all SSE1 can handle.

This should fix:
https://llvm.org/bugs/show_bug.cgi?id=28044

llvm-svn: 282336

8 years ago[LTO] Add a test for invalid alias analysis pipelines.
Davide Italiano [Sat, 24 Sep 2016 20:05:52 +0000 (20:05 +0000)]
[LTO] Add a test for invalid alias analysis pipelines.

I found out this wasn't tested when looking at Vedant's coverage bot
numbers, so, thanks to him. While I'm here, switch the error message
to be lld-compliant (first letter lowercase).

llvm-svn: 282335

8 years agoScalar: Ignore ConstantData in processAssumption
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 20:00:38 +0000 (20:00 +0000)]
Scalar: Ignore ConstantData in processAssumption

Assumptions on UndefValue and ConstantPointerNull aren't relevant to
other users.  Ignore them entirely to avoid wasting cycles walking
through their (possibly extremely extensive (cross-module)) use-lists.

It wasn't clear how to add a specific test for this, and it'll be
covered anyway by an eventual patch that asserts when trying to access
the use-list of an instance of ConstantData.

llvm-svn: 282334

8 years agoAnalysis: Return early in isKnownNonNullAt for ConstantData
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 19:39:47 +0000 (19:39 +0000)]
Analysis: Return early in isKnownNonNullAt for ConstantData

Check and return early for ConstantPointerNull and UndefValue
specifically in isKnownNonNullAt, and assert that ConstantData never
make it to isKnownNonNullFromDominatingCondition.

This confirms that isKnownNonNullFromDominatingCondition never walks
through the use-list of an instance of ConstantData.  Given that such
use-lists cross module boundaries, it never really made sense to do so,
and was potentially very expensive.

llvm-svn: 282333

8 years agoFix incorrect include in is_error_code_enum.pass.cpp
Marshall Clow [Sat, 24 Sep 2016 18:16:53 +0000 (18:16 +0000)]
Fix incorrect include in is_error_code_enum.pass.cpp

llvm-svn: 282332

8 years agoImplement is_error_code_v and is_error_condition_v for c++17. Rework the tests for...
Marshall Clow [Sat, 24 Sep 2016 17:36:14 +0000 (17:36 +0000)]
Implement is_error_code_v and is_error_condition_v for c++17. Rework the tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these.

llvm-svn: 282331

8 years ago[clang-tidy] fix for NOLINT after macro expansion
Matthias Gehre [Sat, 24 Sep 2016 16:06:53 +0000 (16:06 +0000)]
[clang-tidy] fix for NOLINT after macro expansion

Summary:
When having
``` c++
    #define MACRO code-with-warning
    MACRO; // NOLINT
```
clang-tidy would still show the warning, because
it searched for "NOLINT" only in the first line,
not on the second.
This caused e.g. https://llvm.org/bugs/show_bug.cgi?id=29089
(where the macro was defined in a system header). See also
the added test cases.
Now clang-tidy looks at the line of macro invocation and every line
of macro definition for a NOLINT comment.

Reviewers: alexfh, aaron.ballman, hokein

Subscribers: cfe-commits

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

llvm-svn: 282330

8 years ago[AVR] Update signature of AVRTargetObjectFile::SelectSectionForGlobal
Dylan McKay [Sat, 24 Sep 2016 11:38:08 +0000 (11:38 +0000)]
[AVR] Update signature of AVRTargetObjectFile::SelectSectionForGlobal

It was changed recently, and was breaking compilation of the backend.

llvm-svn: 282329

8 years ago[libc++] Remove math_win32.h
Shoaib Meenai [Sat, 24 Sep 2016 06:27:28 +0000 (06:27 +0000)]
[libc++] Remove math_win32.h

Visual Studio 2013 and onward have all the required functions in their
CRT headers, and we don't support older versions anymore.

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

llvm-svn: 282328

8 years ago[RegisterBankInfo] Constify the member of the XXXMapping maps.
Quentin Colombet [Sat, 24 Sep 2016 04:54:03 +0000 (04:54 +0000)]
[RegisterBankInfo] Constify the member of the XXXMapping maps.

This makes it obvious that items in those maps behave like statically
created objects.

llvm-svn: 282327

8 years ago[RegisterBankInfo] Document the design choice for the BreakDown.
Quentin Colombet [Sat, 24 Sep 2016 04:53:58 +0000 (04:53 +0000)]
[RegisterBankInfo] Document the design choice for the BreakDown.

This adds a comment explaining why we will duplicate PartialMapping to
represent the breakdown for complex mappings (mappings with more than
one partial mapping), instead of using an array of pointer.

NFC

llvm-svn: 282326

8 years ago[RegisterBankInfo] Add statistics for dynamic value mappings.
Quentin Colombet [Sat, 24 Sep 2016 04:53:55 +0000 (04:53 +0000)]
[RegisterBankInfo] Add statistics for dynamic value mappings.

Like partial mappings, as we move toward TableGen'ed information, the
number should reach zero eventually.

llvm-svn: 282325

8 years ago[RegisterBankInfo] Uniquely generate ValueMapping.
Quentin Colombet [Sat, 24 Sep 2016 04:53:52 +0000 (04:53 +0000)]
[RegisterBankInfo] Uniquely generate ValueMapping.

This is a step toward statically allocate ValueMapping. Like the
previous few commits, the goal is to move toward a TableGen'ed like
structure with no dynamic allocation at all.

llvm-svn: 282324

8 years ago[RegisterBankInfo] Keep valid pointers for PartialMappings.
Quentin Colombet [Sat, 24 Sep 2016 04:53:48 +0000 (04:53 +0000)]
[RegisterBankInfo] Keep valid pointers for PartialMappings.

Previously we were using the address of the unique instance of a partial
mapping in the related map to access this instance. However, when the
map grows, the whole set of instances may be moved elsewhere and the
previous addresses are not valid anymore.

Instead, keep the address of the unique heap allocated instance of a
partial mapping.

Note: I did not see any actual bugs for that problem as the number of
partial mappings dynamically allocated is small (<= 4).

llvm-svn: 282323

8 years agoRemove excessive padding from RedeclarableResult
Alexander Shaposhnikov [Sat, 24 Sep 2016 04:21:53 +0000 (04:21 +0000)]
Remove excessive padding from RedeclarableResult

This diff reorders the fields of the class RedeclarableResult
to remove excessive padding.

Test plan: make -j8 check-clang

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

llvm-svn: 282322

8 years ago[libFuzzer] add a standalone build script
Kostya Serebryany [Sat, 24 Sep 2016 04:00:00 +0000 (04:00 +0000)]
[libFuzzer] add a standalone build script

llvm-svn: 282321