platform/upstream/llvm.git
6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 06:21:33 +0000 (06:21 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329521

6 years agoRevert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple...
Eric Fiselier [Sun, 8 Apr 2018 06:05:33 +0000 (06:05 +0000)]
Revert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases."

This reverts commit r329519. There are some unaddressed test failures.

llvm-svn: 329520

6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 05:50:01 +0000 (05:50 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329519

6 years ago[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI
Eric Fiselier [Sun, 8 Apr 2018 05:12:55 +0000 (05:12 +0000)]
[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI

Summary:
This patch cleans up a bunch of dead or unused code in BuildAnonymousStructUnionMemberReference.

The dead code was a branch that built a new CXXThisExpr when we weren't given a base object expression or base variable.
However, BuildAnonymousFoo has only two callers. One of which always builds a base object expression first, the second only calls when the IndirectFieldDecl is not a C++ class member. Even within C this branch seems entirely unused.

I tried diligently to write a test which hit it with no success.

This patch removes the branch and replaces it with an assertion that we were given either a base object expression or a base variable.

Reviewers: rsmith, aaron.ballman, majnemer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329518

6 years ago[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantia...
Eric Fiselier [Sun, 8 Apr 2018 05:11:59 +0000 (05:11 +0000)]
[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantiation.

Summary:
Currently Clang fails to propagate qualifiers from the `CXXThisExpr` to the rebuilt `FieldDecl` for IndirectFieldDecls. For example:

```
template <class T> struct Foo {
  struct { int x; };
  int y;
  void foo() const {
      static_assert(__is_same(int const&, decltype((y))));
      static_assert(__is_same(int const&, decltype((x)))); // assertion fails
  }
};
template struct Foo<int>;
```

The fix is to delegate rebuilding of the MemberExpr to `BuildFieldReferenceExpr` which correctly propagates the qualifiers.

Reviewers: rsmith, lebedev.ri, aaron.ballman, bkramer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 329517

6 years ago[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
Guozhi Wei [Sat, 7 Apr 2018 23:36:10 +0000 (23:36 +0000)]
[DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))

In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

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

llvm-svn: 329516

6 years ago[libclang] Add clang_File_tryGetRealPathName
Fangrui Song [Sat, 7 Apr 2018 20:50:35 +0000 (20:50 +0000)]
[libclang] Add clang_File_tryGetRealPathName

Summary:
clang_getFileName() may return a path relative to WorkingDir.
On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on
CXIdxIncludedIncludedFileInfo::file may return
"/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string",
for `#include <string>`.

I presume WorkingDir is somehow changed to /usr/lib or /usr/include and
clang_getFileName() returns a path relative to WorkingDir.

clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string"
which is more useful for the indexer in this case.

Subscribers: cfe-commits

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

llvm-svn: 329515

6 years agoRevert "Followup for r329293: Temporarily disable the breaking test on windows."
Philip Pfaffe [Sat, 7 Apr 2018 20:22:38 +0000 (20:22 +0000)]
Revert "Followup for r329293: Temporarily disable the breaking test on windows."

This reverts commit r329393 / b52ba35e7759cd4002221be1dbb63ec80fde21ec.

llvm-svn: 329514

6 years agoGeneralize the swiftcall API since being passed indirectly isn't
John McCall [Sat, 7 Apr 2018 20:16:47 +0000 (20:16 +0000)]
Generalize the swiftcall API since being passed indirectly isn't
C++-specific anymore.

llvm-svn: 329513

6 years ago[Driver] Update GCC libraries detection logic for Gentoo.
Manoj Gupta [Sat, 7 Apr 2018 19:59:58 +0000 (19:59 +0000)]
[Driver] Update GCC libraries detection logic for Gentoo.

Summary:
1. Find GCC's LDPATH from the actual GCC config file.
2. Avoid picking libraries from a similar named tuple if the exact
   tuple is installed.

Reviewers: mgorny, chandlerc, thakis, rnk

Reviewed By: mgorny, rnk

Subscribers: cfe-commits, mgorny

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

llvm-svn: 329512

6 years ago[X86] Regenerate atom pshufb test
Simon Pilgrim [Sat, 7 Apr 2018 19:50:09 +0000 (19:50 +0000)]
[X86] Regenerate atom pshufb test

llvm-svn: 329511

6 years ago[X86] Combine vXi64 multiplies to MULDQ/MULUDQ during DAG combine instead of lowering.
Craig Topper [Sat, 7 Apr 2018 19:09:52 +0000 (19:09 +0000)]
[X86] Combine vXi64 multiplies to MULDQ/MULUDQ during DAG combine instead of lowering.

Previously we used a custom lowering for this because of the AVX1 splitting requirement. But we can do the split during DAG combine if we check the types and subtarget

llvm-svn: 329510

6 years ago[DAGCombiner] Add a combine to turn a build vector of zero extends of extract vector...
Craig Topper [Sat, 7 Apr 2018 19:09:50 +0000 (19:09 +0000)]
[DAGCombiner] Add a combine to turn a build vector of zero extends of extract vector elts into a vector zero extend and possibly an extract subvector.

llvm-svn: 329509

6 years agoAllow equality comparisons between block pointers and
John McCall [Sat, 7 Apr 2018 17:42:06 +0000 (17:42 +0000)]
Allow equality comparisons between block pointers and
block-pointer-compatible ObjC object pointer types.

Patch by Dustin Howett!

llvm-svn: 329508

6 years ago[llgo] Move SetSubprogram
Robert Widmann [Sat, 7 Apr 2018 16:26:59 +0000 (16:26 +0000)]
[llgo] Move SetSubprogram

Summary: Fixes the bots - I moved LLVMSetSubprogram into the DIBuilder bindings, so the Go bindings need to move as well.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 329505

6 years ago[CostModel][X86] Regenerate vector reduction cost tests with update_analyze_test_chec...
Simon Pilgrim [Sat, 7 Apr 2018 14:20:10 +0000 (14:20 +0000)]
[CostModel][X86] Regenerate vector reduction cost tests with update_analyze_test_checks.py

NOTE: We're only really interested in the extractelement cost (which represents the entire reduction).
llvm-svn: 329504

6 years ago[InstCombine] simplify code that propagates FMF; NFC
Sanjay Patel [Sat, 7 Apr 2018 14:14:23 +0000 (14:14 +0000)]
[InstCombine] simplify code that propagates FMF; NFC

llvm-svn: 329503

6 years ago[CostModel][X86] Regenerate vector select cost tests with update_analyze_test_checks.py
Simon Pilgrim [Sat, 7 Apr 2018 14:09:54 +0000 (14:09 +0000)]
[CostModel][X86] Regenerate vector select cost tests with update_analyze_test_checks.py

llvm-svn: 329502

6 years ago[InstCombine] add/move tests for fsub folds; NFC
Sanjay Patel [Sat, 7 Apr 2018 14:07:58 +0000 (14:07 +0000)]
[InstCombine] add/move tests for fsub folds; NFC

There are a pair of folds that try to merge fneg into fsub
with an intervening cast, but as shown in the FIXME tests,
they can create extra instructions.

llvm-svn: 329501

6 years ago[CostModel][X86] Regenerate vector integer truncation cost tests with update_analyze_...
Simon Pilgrim [Sat, 7 Apr 2018 14:05:35 +0000 (14:05 +0000)]
[CostModel][X86] Regenerate vector integer truncation cost tests with update_analyze_test_checks.py

llvm-svn: 329500

6 years ago[CostModel][X86] Regenerate silvermont (and added goldmont) cost tests with update_an...
Simon Pilgrim [Sat, 7 Apr 2018 14:02:14 +0000 (14:02 +0000)]
[CostModel][X86] Regenerate silvermont (and added goldmont) cost tests with update_analyze_test_checks.py

llvm-svn: 329499

6 years ago[CostModel][X86] Fix v32i16/v64i8 SETCC costs on AVX512BW targets
Simon Pilgrim [Sat, 7 Apr 2018 13:24:33 +0000 (13:24 +0000)]
[CostModel][X86] Fix v32i16/v64i8 SETCC costs on AVX512BW targets

llvm-svn: 329498

6 years ago[CostModel][X86] Regenerate vector comparison cost tests with update_analyze_test_che...
Simon Pilgrim [Sat, 7 Apr 2018 12:47:35 +0000 (12:47 +0000)]
[CostModel][X86] Regenerate vector comparison cost tests with update_analyze_test_checks.py

llvm-svn: 329497

6 years ago[llvm-exegesis] Fix unused return value warning and add a useful error message for...
Simon Pilgrim [Sat, 7 Apr 2018 11:37:21 +0000 (11:37 +0000)]
[llvm-exegesis] Fix unused return value warning and add a useful error message for event counter reads.

llvm-svn: 329496

6 years ago[clang-tidy] Fix compilation for MSVS@PSP4 for ParentVirtualCallCheck.cpp
Zinovy Nis [Sat, 7 Apr 2018 11:22:01 +0000 (11:22 +0000)]
[clang-tidy] Fix compilation for MSVS@PSP4 for ParentVirtualCallCheck.cpp

There's an error for PSP4 platform only:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\algorithm(95):
error C2719: '_Pred': formal parameter with requested alignment of 8 won't be aligned

llvm-svn: 329495

6 years agoReapply ARM: Do not spill CSR to stack on entry to noreturn functions
Tim Northover [Sat, 7 Apr 2018 10:57:03 +0000 (10:57 +0000)]
Reapply ARM: Do not spill CSR to stack on entry to noreturn functions

Should fix UBSan bot by also checking there's no "uwtable" attribute
before skipping. Otherwise the unwind table will be useless since its
moves expect CSRs to actually be preserved.

A noreturn nounwind function can be expected to never return in any way, and by
never returning it will also never have to restore any callee-saved registers
for its caller. This makes it possible to skip spills of those registers during
function entry, saving some stack space and time in the process. This is rather
useful for embedded targets with limited stack space.

Should fix PR9970.

Patch mostly by myeisha (pmb).

llvm-svn: 329494

6 years ago[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assign...
Roman Lebedev [Sat, 7 Apr 2018 10:39:21 +0000 (10:39 +0000)]
[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)

Summary:
This has just bit me, so i though it would be nice to avoid that next time :)
Motivational case:
  https://godbolt.org/g/cq9UNk
Basically, it's likely to happen if you don't like shadowing issues,
and use `-Wshadow` and friends. And it won't be diagnosed by clang.

The reason is, these self-assign diagnostics only work for builtin assignment
operators. Which makes sense, one could have a very special operator=,
that does something unusual in case of self-assignment,
so it may make sense to not warn on that.

But while it may be intentional in some cases, it may be a bug in other cases,
so it would be really great to have some diagnostic about it...

Reviewers: aaron.ballman, rsmith, rtrieu, nikola, rjmccall, dblaikie

Reviewed By: rjmccall

Subscribers: EricWF, lebedev.ri, thakis, Quuxplusone, cfe-commits

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

llvm-svn: 329493

6 years ago[InstCombine] Get rid of select of bittest (PR36950 / PR17564)
Roman Lebedev [Sat, 7 Apr 2018 10:37:24 +0000 (10:37 +0000)]
[InstCombine] Get rid of select of bittest (PR36950 / PR17564)

Summary:
See [[ https://bugs.llvm.org/show_bug.cgi?id=36950 | PR36950 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=17564 | PR17564 ]], D45065, D45107
https://godbolt.org/g/iAYRup

Alive proof: https://rise4fun.com/Alive/uiH

Testing: `ninja check-llvm`

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 329492

6 years ago[unittests] ADT: silence -Wself-assign diagnostics
Roman Lebedev [Sat, 7 Apr 2018 10:37:18 +0000 (10:37 +0000)]
[unittests] ADT: silence -Wself-assign diagnostics

Summary:
D44883 extends -Wself-assign to also work on C++ classes.
In it's current state (as suggested by @rjmccall), it is not under it's own sub-group.
Since that diag is enabled by `-Wall`, stage2 testing showed that:
* It does not fire on any llvm code
* It does fire for these 3 unittests
* It does fire for libc++ tests

This diff simply silences those new warnings in llvm's unittests.
A similar diff will be needed for libcxx. (`libcxx/test/std/language.support/support.types/byteops/`, maybe something else)

Since i don't think we want to repeat rL322901, let's talk about it.
I've subscribed everyone who i think might be interested...

There are several ways forward:
* Not extend -Wself-assign, close D44883. Not very productive outcome i'd say.
* Keep D44883 in it's current state.
  Unless your custom overloaded operators do something unusual for when self-assigning,
  the warning is no less of a false-positive than the current -Wself-assign.
  Except for tests of course, there you'd want to silence it. The current suggestion is:
  ```
  S a;
  a = (S &)a;
  ```
* Split the diagnostic in two - `-Wself-assign-builtin` (i.e. what is `-Wself-assign` in trunk),
  and `-Wself-assign-overloaded` - the new part in D44883.
  Since, as i said, i'm not really sure why it would be less of a error than the current `-Wself-assign`,
  both would still be in `-Wall`. That way one could simply pass `-Wno-self-assign-overloaded` for all the tests.
  Pretty simple to do, and will surely work.
* Split the diagnostic in two - `-Wself-assign-trivial`, and `-Wself-assign-nontrivial`.
  The choice of which diag to emit would depend on trivial-ness of that particular operator.
  The current `-Wself-assign` would be `-Wself-assign-trivial`.
  https://godbolt.org/g/gwDASe - `A`, `B` and `C` case would be treated as trivial, and `D`, `E` and `F` as non-trivial.
  Will be the most complicated to implement.

Thoughts?

Reviewers: aaron.ballman, rsmith, rtrieu, rjmccall, dblaikie, atrick, gottesmm

Reviewed By: dblaikie

Subscribers: lebedev.ri, phosek, vsk, rnk, thakis, sammccall, mclow.lists, llvm-commits, rjmccall

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

llvm-svn: 329491

6 years ago[libcxx][test] Silence -Wself-assign diagnostics
Roman Lebedev [Sat, 7 Apr 2018 10:36:03 +0000 (10:36 +0000)]
[libcxx][test] Silence -Wself-assign diagnostics

Summary:
D44883 extends -Wself-assign to also work on C++ classes.
These new warnings pop up in the test suite, so they have to be silenced.

Please refer to the D45082 for disscussion on whether this is the right way to solve this.

Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: Quuxplusone, cfe-commits

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

llvm-svn: 329490

6 years agoFix stack-use-after-scope in test previously hidden by -fmerge-all-constants
Vitaly Buka [Sat, 7 Apr 2018 09:46:00 +0000 (09:46 +0000)]
Fix stack-use-after-scope in test previously hidden by -fmerge-all-constants

llvm-svn: 329489

6 years ago[LLVM-C] Move DIBuilder Bindings For Block Scopes
Robert Widmann [Sat, 7 Apr 2018 06:07:55 +0000 (06:07 +0000)]
[LLVM-C] Move DIBuilder Bindings For Block Scopes

Summary: Move LLVMDIBuilderCreateFunction , LLVMDIBuilderCreateLexicalBlock, and LLVMDIBuilderCreateLexicalBlockFile from Go to LLVM-C.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark, harlanhaskins

Subscribers: llvm-commits

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

llvm-svn: 329488

6 years agoRevert "ARM: Do not spill CSR to stack on entry to noreturn functions"
Vitaly Buka [Sat, 7 Apr 2018 05:36:44 +0000 (05:36 +0000)]
Revert "ARM: Do not spill CSR to stack on entry to noreturn functions"

Breaks ubsan test TestCases/Misc/missing_return.cpp on ARM

This reverts commit r329287

llvm-svn: 329486

6 years agoUse void() to create a void expression type
Eric Fiselier [Sat, 7 Apr 2018 04:28:11 +0000 (04:28 +0000)]
Use void() to create a void expression type

llvm-svn: 329484

6 years agoConvert line endings of lib/WindowsManifest/CMakeLists.txt to unix.
Nico Weber [Sat, 7 Apr 2018 04:28:08 +0000 (04:28 +0000)]
Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix.

llvm-svn: 329483

6 years agoSort source lists in lib/StaticAnalyzer.
Nico Weber [Sat, 7 Apr 2018 04:25:01 +0000 (04:25 +0000)]
Sort source lists in lib/StaticAnalyzer.

llvm-svn: 329481

6 years agoRemove trailing space in build file.
Nico Weber [Sat, 7 Apr 2018 03:30:28 +0000 (03:30 +0000)]
Remove trailing space in build file.

llvm-svn: 329479

6 years agoMake CodeGen depend just once on clangAnalysis.
Nico Weber [Sat, 7 Apr 2018 03:29:47 +0000 (03:29 +0000)]
Make CodeGen depend just once on clangAnalysis.

llvm-svn: 329477

6 years agoRemove another unnecessary -I flag passed to clang-tblgen.
Nico Weber [Sat, 7 Apr 2018 01:34:36 +0000 (01:34 +0000)]
Remove another unnecessary -I flag passed to clang-tblgen.

llvm-svn: 329476

6 years ago[unittests] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Sat, 7 Apr 2018 01:29:45 +0000 (01:29 +0000)]
[unittests] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to
llvm::sort.  Refer the comments section in D44363 for a list of all the
required patches.

llvm-svn: 329475

6 years agoWork around missing braces in init warning
Eric Fiselier [Sat, 7 Apr 2018 01:28:54 +0000 (01:28 +0000)]
Work around missing braces in init warning

llvm-svn: 329474

6 years ago[tests] Fix format-binary-non-ascii.s to work with Python 3 on Windows
Aaron Smith [Sat, 7 Apr 2018 00:55:26 +0000 (00:55 +0000)]
[tests] Fix format-binary-non-ascii.s to work with Python 3 on Windows

Some platforms interpret the pound sign as one character. Platforms that use
Python 2.x actually interpret it as two characters because in the Python 2.x
version of lit, the string used for the file name is a byte string and the pound
sign is two bytes.

Patch by Stella Stamenova!

llvm-svn: 329472

6 years agoCOFF: Process /merge flag as we create output sections.
Peter Collingbourne [Sat, 7 Apr 2018 00:46:55 +0000 (00:46 +0000)]
COFF: Process /merge flag as we create output sections.

With this we can merge builtin sections.

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

llvm-svn: 329471

6 years ago[Support] Make line-number cache robust against access patterns.
Graydon Hoare [Sat, 7 Apr 2018 00:44:02 +0000 (00:44 +0000)]
[Support] Make line-number cache robust against access patterns.

Summary:
The LLVM SourceMgr class (which is used indirectly by Swift, though not Clang)
has a routine for looking up line numbers of SMLocs. This routine uses a
shared, special-purpose cache that handles exactly one access pattern
efficiently: looking up the line number of an SMLoc that points into the same
buffer as the last query made to the SourceMgr, at a location in the buffer at
or ahead of the last query.

When this works it's fine, but when it fails it's catastrophic for performancer:
one recent out-of-order access from a Swift utility routine ran for tens of
seconds, spending 99% of its time repeatedly scanning buffers for '\n'.

This change removes the shared cache from the SourceMgr and installs a new
cache in each SrcBuffer. The per-SrcBuffer caches are also "full", in the sense
that rather than caching a single last-query pointer, they cache _all_ the
line-ending offsets, in a binary-searchable array, such that once it's
populated (on first access), all subsequent access patterns run at the same
speed.

Performance measurements I've done show this is actually a little bit faster on
real codebases (though only a couple fractions of a percent). Memory usage is
up by a few tens to hundreds of bytes per SrcBuffer that has a line lookup done
on it; I've attempted to minimize this by using dynamic selection of integer
sized when storing offset arrays. But the main motive here is to
make-impossible the cases we don't always see, that show up by surprise when
there is an out-of-order access pattern.

Reviewers: jordan_rose

Reviewed By: jordan_rose

Subscribers: probinson, llvm-commits

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

llvm-svn: 329470

6 years agoWindows needs the current codepage instead of utf8 sometimes
Aaron Smith [Sat, 7 Apr 2018 00:32:59 +0000 (00:32 +0000)]
Windows needs the current codepage instead of utf8 sometimes

Llvm-mc (and tools that use Path.inc on Windows) assume that strings are utf-8
encoded, however, this is not always the case. On Windows the default codepage
is not utf-8, so most of the time the strings are not utf-8 encoded.

The lld test 'format-binary-non-ascii' uses llvm-mc with a file with non-ascii
characters in the name which is how this bug was found. The test fails when run
using Python 3 because it uses properly encoded unicode strings (Python 2 actually
ends up using a byte string which is not utf-8 encoded, so the test passes, but
that's separate issue).

Patch by Stella Stamenova!

llvm-svn: 329468

6 years agoGeneralize test for 32-bit targets.
Richard Smith [Sat, 7 Apr 2018 00:28:32 +0000 (00:28 +0000)]
Generalize test for 32-bit targets.

llvm-svn: 329467

6 years ago[lit] Fix several Python 2/3 compatibility issues and tests
Aaron Smith [Sat, 7 Apr 2018 00:21:28 +0000 (00:21 +0000)]
[lit] Fix several Python 2/3 compatibility issues and tests

- In Python 2.x, basestring is the base string type, but in
  Python 3.x basestring is not defined and instead str includes
  unicode strings.

- When Python is in a path that includes spaces, it needs to
  be specified with quotes in the test files for it to run.

- The cache.ll test relies on files of a specific size being
  created by Python, but on some versions of Windows the
  files that are created by the current code are one byte
  larger than expected. To fix the test, update file creation
  to always make files of the expected size.

Patch by Stella Stamenova!

llvm-svn: 329466

6 years agoRecommit r329442: Generate Libclang invocation reproducers using a new
Alex Lorenz [Sat, 7 Apr 2018 00:03:27 +0000 (00:03 +0000)]
Recommit r329442: Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option

The recommit fixes:
- An MSAN failure (CCPrintOptions wasn't initialized in the Driver)
- Ensures that the strings in the libclang invocation files are escaped

Original message:

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

llvm-svn: 329465

6 years agoRemove two unnecessary -I flags passed to clang-tblgen.
Nico Weber [Fri, 6 Apr 2018 23:36:50 +0000 (23:36 +0000)]
Remove two unnecessary -I flags passed to clang-tblgen.

llvm-svn: 329464

6 years ago[NVPTX] add support for initializing fp16 arrays.
Artem Belevich [Fri, 6 Apr 2018 22:25:08 +0000 (22:25 +0000)]
[NVPTX] add support for initializing fp16 arrays.

Previously HalfTy was not handled which would either trigger an assertion,
or result in array initialized with garbage.

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

llvm-svn: 329463

6 years agoselect: simplify implementation and fix fp16
Jan Vesely [Fri, 6 Apr 2018 22:00:00 +0000 (22:00 +0000)]
select: simplify implementation and fix fp16

Fix half precision implementation
Vector ?: operator should behave exactly as select
Passes CTS on carrizo

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
llvm-svn: 329462

6 years agoFix warning by cl::opt<int> -> cl::opt<unsigned>
Vitaly Buka [Fri, 6 Apr 2018 21:41:17 +0000 (21:41 +0000)]
Fix warning by cl::opt<int> -> cl::opt<unsigned>

llvm-svn: 329461

6 years agoImplement P0768r1: Library support for the Spaceship Operator.
Eric Fiselier [Fri, 6 Apr 2018 21:37:23 +0000 (21:37 +0000)]
Implement P0768r1: Library support for the Spaceship Operator.

this patch adds the <compare> header and implements all of it
except for [comp.alg].

As I understand it, the header is needed by the compiler in
when implementing the semantics of operator<=>. For that reason
I feel it's important to land this header early, despite
all compilers lacking support.

llvm-svn: 329460

6 years agoRuntime flag to control branch funnel threshold
Vitaly Buka [Fri, 6 Apr 2018 21:32:36 +0000 (21:32 +0000)]
Runtime flag to control branch funnel threshold

Reviewers: pcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 329459

6 years agoRevert r324557, "gold-plugin: Do not set codegen opt level based on LTO opt level."
Peter Collingbourne [Fri, 6 Apr 2018 21:14:33 +0000 (21:14 +0000)]
Revert r324557, "gold-plugin: Do not set codegen opt level based on LTO opt level."

It was reported that this change measurably regressed -plugin-opt=O3
performance.

There is an ongoing discussion on llvm-dev about the correct way to
set the CG opt level, see thread "[llvm-dev] [RFC] Adding function
attributes to represent codegen optimization level".

llvm-svn: 329458

6 years ago[Release Notes] Add release note for "-fmerge-all-constants"
Manoj Gupta [Fri, 6 Apr 2018 21:11:09 +0000 (21:11 +0000)]
[Release Notes] Add release note for "-fmerge-all-constants"

Summary:
Add note that "-fmerge-all-constants" is not applied as default
anymore.

Reviewers: rjmccall, rsmith, chandlerc

Subscribers: llvm-commits, thakis

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

llvm-svn: 329457

6 years ago[NVPTX] Fixed vectorized LDG for f16.
Artem Belevich [Fri, 6 Apr 2018 21:10:24 +0000 (21:10 +0000)]
[NVPTX] Fixed vectorized LDG for f16.

v2f16 is a special case in NVPTX. v4f16 may be loaded as a pair of v2f16
and that was not previously handled correctly by tryLDGLDU()

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

llvm-svn: 329456

6 years ago [RISCV] Tablegen-driven Instruction Compression.
Sameer AbuAsal [Fri, 6 Apr 2018 21:07:05 +0000 (21:07 +0000)]
[RISCV] Tablegen-driven Instruction Compression.

Summary:

    This patch implements a tablegen-driven Instruction Compression
    mechanism for generating RISCV compressed instructions
    (C Extension) from the expanded instruction form.

    This tablegen backend processes CompressPat declarations in a
    td file and generates all the compile-time and runtime checks
    required to validate the declarations, validate the input
    operands and generate correct instructions.

    The checks include validating register operands, immediate
    operands, fixed register operands and fixed immediate operands.

    Example:
      class CompressPat<dag input, dag output> {
        dag Input  = input;
        dag Output    = output;
        list<Predicate> Predicates = [];
      }

      let Predicates = [HasStdExtC] in {
      def : CompressPat<(ADD GPRNoX0:$rs1, GPRNoX0:$rs1, GPRNoX0:$rs2),
                        (C_ADD GPRNoX0:$rs1, GPRNoX0:$rs2)>;
      }

    The result is an auto-generated header file
    'RISCVGenCompressEmitter.inc' which exports two functions for
    compressing/uncompressing MCInst instructions, plus
    some helper functions:

      bool compressInst(MCInst& OutInst, const MCInst &MI,
                        const MCSubtargetInfo &STI,
                        MCContext &Context);

      bool uncompressInst(MCInst& OutInst, const MCInst &MI,
                          const MCRegisterInfo &MRI,
                          const MCSubtargetInfo &STI);

    The clients that include this auto-generated header file and
    invoke these functions can compress an instruction before emitting
    it, in the target-specific ASM or ELF streamer, or can uncompress
    an instruction before printing it, when the expanded instruction
    format aliases is favored.

    The following clients were added to implement compression\uncompression
    for RISCV:

    1) RISCVAsmParser::MatchAndEmitInstruction:
       Inserted a call to compressInst() to compresses instructions
       parsed by llvm-mc coming from an ASM input.
    2) RISCVAsmPrinter::EmitInstruction:
       Inserted a call to compressInst() to compress instructions that
       were lowered from Machine Instructions (MachineInstr).
    3) RVInstPrinter::printInst:
       Inserted a call to uncompressInst() to print the expanded
       version of the instruction instead of the compressed one (e.g,
       add s0, s0, a5 instead of c.add s0, a5) when -riscv-no-aliases
       is not passed.

This patch squashes D45119, D42780 and D41932. It was reviewed in  smaller patches by
asb, efriedma, apazos and mgrang.

Reviewers: asb, efriedma, apazos, llvm-commits, sabuasal

Reviewed By: sabuasal

Subscribers: mgorny, eraman, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, niosHD, kito-cheng, shiva0217, zzheng

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

llvm-svn: 329455

6 years ago[clang-tidy] One more fix compilation for ParentVirtualCallCheck.cpp: find_if predicate
Zinovy Nis [Fri, 6 Apr 2018 21:00:18 +0000 (21:00 +0000)]
[clang-tidy] One more fix compilation for ParentVirtualCallCheck.cpp: find_if predicate

llvm-svn: 329454

6 years agoAvoid some temporary allocations.
Rafael Espindola [Fri, 6 Apr 2018 20:53:06 +0000 (20:53 +0000)]
Avoid some temporary allocations.

Some system libraries have a lot of versioned symbols. When linking
scylla this brings the number of malloc calls from 49154 to 37944.

llvm-svn: 329453

6 years ago[clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp
Zinovy Nis [Fri, 6 Apr 2018 20:39:23 +0000 (20:39 +0000)]
[clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

llvm-svn: 329452

6 years ago[TableGen] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 6 Apr 2018 20:18:05 +0000 (20:18 +0000)]
[TableGen] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: stoklund, kparzysz, dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 329451

6 years ago[StackProtector] Ignore certain intrinsics when calculating sspstrong heuristic.
Matt Davis [Fri, 6 Apr 2018 20:14:13 +0000 (20:14 +0000)]
[StackProtector] Ignore certain intrinsics when calculating sspstrong heuristic.

Summary:
The 'strong' StackProtector heuristic takes into consideration call instructions.
Certain intrinsics, such as lifetime.start, can cause the
StackProtector to protect functions that do not need to be protected.

Specifically, a volatile variable, (not optimized away), but belonging to a stack
allocation will encourage a llvm.lifetime.start to be inserted during
compilation. Because that intrinsic is a 'call' the strong StackProtector
will see that the alloca'd variable is being passed to a call instruction, and
insert a stack protector. In this case the intrinsic isn't really lowered to a
call. This can cause unnecessary stack checking, at the cost of additional
(wasted) CPU cycles.

In the future we should rely on TargetTransformInfo::isLoweredToCall, but as of
now that routine considers all intrinsics as not being lowerable. That needs
to be corrected, and such a change is on my list of things to get moving on.

As a side note, the updated stack-protector-dbginfo.ll test always seems to
pass.  I never see the dbg.declare/dbg.value reaching the
StackProtector::HasAddressTaken, but I don't see any code excluding dbg
intrinsic calls either, so I think it's the safest thing to do.

Reviewers: void, timshen

Reviewed By: timshen

Subscribers: llvm-commits

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

llvm-svn: 329450

6 years agoDon't assume constructors return void.
Richard Smith [Fri, 6 Apr 2018 20:06:02 +0000 (20:06 +0000)]
Don't assume constructors return void.

Should fix ARM buildbot.

llvm-svn: 329449

6 years ago[clang-tidy] Check if grand-..parent's virtual method was called instead of overridde...
Zinovy Nis [Fri, 6 Apr 2018 20:02:50 +0000 (20:02 +0000)]
[clang-tidy] Check if grand-..parent's virtual method was called instead of overridden parent's.

class A {...int virtual foo() {...}...};
class B: public A {...int foo() override {...}...};
class C: public B {...int foo() override {... A::foo()...}};
                                              ^^^^^^^^ warning: qualified name A::foo refers to a member overridden in subclass; did you mean 'B'? [bugprone-parent-virtual-call]

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

llvm-svn: 329448

6 years agoRevert r329442 "Generate Libclang invocation reproducers using a new
Alex Lorenz [Fri, 6 Apr 2018 19:45:29 +0000 (19:45 +0000)]
Revert r329442 "Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option"

The tests are failing on some bots

llvm-svn: 329447

6 years ago[doc] Overhaul doc on preparing IR for processing by Polly.
Michael Kruse [Fri, 6 Apr 2018 19:24:18 +0000 (19:24 +0000)]
[doc] Overhaul doc on preparing IR for processing by Polly.

The previously documented method did not work (anymore).

Suggested-by: Philip Pfaffe <philip.pfaffe@gmail.com>
llvm-svn: 329446

6 years agoRevert "[analyzer] Remove an unused variable"
George Karpenkov [Fri, 6 Apr 2018 19:14:05 +0000 (19:14 +0000)]
Revert "[analyzer] Remove an unused variable"

This reverts commit 2fa3e3edc4ed6547cc4ce46a8c79d1891a5b3b36.

Removed the wrong variable.

llvm-svn: 329445

6 years ago[analyzer] Remove an unused variable
George Karpenkov [Fri, 6 Apr 2018 19:03:43 +0000 (19:03 +0000)]
[analyzer] Remove an unused variable

llvm-svn: 329444

6 years ago[EarlyCSE] Add debug counter for debugging mis-optimizations. NFC.
Geoff Berry [Fri, 6 Apr 2018 18:47:33 +0000 (18:47 +0000)]
[EarlyCSE] Add debug counter for debugging mis-optimizations. NFC.

Reviewers: reames, spatel, davide, dberlin

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 329443

6 years agoGenerate Libclang invocation reproducers using a new -cc1gen-reproducer
Alex Lorenz [Fri, 6 Apr 2018 18:30:14 +0000 (18:30 +0000)]
Generate Libclang invocation reproducers using a new -cc1gen-reproducer
driver option

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

llvm-svn: 329442

6 years ago[RISCV] Update MC compression tests
Sameer AbuAsal [Fri, 6 Apr 2018 18:27:45 +0000 (18:27 +0000)]
[RISCV] Update MC compression tests

Summary:
This patch updates MC tests related to compression in RISCV to
insure they work correctly with automatic compression and relaxation
enabled. This is the first part of a series of patches to implement
automatic compression for RISCV.

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: shiva0217, efriedma, llvm-commits, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, niosHD, kito-cheng

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

llvm-svn: 329441

6 years ago[AMDGPU][MC][GFX9] Added s_call_b64
Dmitry Preobrazhensky [Fri, 6 Apr 2018 18:24:49 +0000 (18:24 +0000)]
[AMDGPU][MC][GFX9] Added s_call_b64

See bug 36843: https://bugs.llvm.org/show_bug.cgi?id=36843

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329440

6 years ago[Hexagon] Fix assert with packetizing IMPLICIT_DEF instructions
Krzysztof Parzyszek [Fri, 6 Apr 2018 18:19:22 +0000 (18:19 +0000)]
[Hexagon] Fix assert with packetizing IMPLICIT_DEF instructions

The compiler is generating packet with the following instructions,
which causes an undefined register assert in the verifier.

  $r0 = IMPLICIT_DEF
  $r1 = IMPLICIT_DEF
  S2_storerd_io killed $r29, 0, killed %d0

The problem is that the packetizer is not saving the IMPLICIT_DEF
instructions, which are needed when checking if it is legal to
add the store instruction. The fix is to add the IMPLICIT_DEF
instructions to the CurrentPacketMIs structure.

Patch by Brendon Cahoon.

llvm-svn: 329439

6 years ago[libFuzzer] Print a correct error message when a directory can't be
Matt Morehouse [Fri, 6 Apr 2018 18:15:24 +0000 (18:15 +0000)]
[libFuzzer] Print a correct error message when a directory can't be
opened.

Summary:
Currently if the directory cannot be opened for a reason other than
non-existence (e.g. too many open file descriptors) the error message
printed is incredibly confusing.

Patch By: Alex Gaynor

Reviewers: kcc, morehouse

Reviewed By: morehouse

Subscribers: delcypher, llvm-commits, Sanitizers

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

llvm-svn: 329438

6 years ago[Hexagon] Prevent a stall across zero-latency instructions in a packet
Krzysztof Parzyszek [Fri, 6 Apr 2018 18:13:11 +0000 (18:13 +0000)]
[Hexagon] Prevent a stall across zero-latency instructions in a packet

Packetizer keeps two zero-latency bound instrctions in the same packet ignoring
the stalls on the later instruction. This should not be the case if there is no
data dependence.

Patch by Sumanth Gundapaneni.

llvm-svn: 329437

6 years ago[Hexagon] Remove duplicated code, NFC
Krzysztof Parzyszek [Fri, 6 Apr 2018 18:10:13 +0000 (18:10 +0000)]
[Hexagon] Remove duplicated code, NFC

llvm-svn: 329436

6 years ago[CodeGen] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 6 Apr 2018 18:08:42 +0000 (18:08 +0000)]
[CodeGen] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: bogner, rnk, MatzeB, RKSimon

Reviewed By: rnk

Subscribers: JDevlieghere, javed.absar, llvm-commits

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

llvm-svn: 329435

6 years ago[Hexagon] Handle subregisters when calculating iteration count in HW loops
Krzysztof Parzyszek [Fri, 6 Apr 2018 17:51:57 +0000 (17:51 +0000)]
[Hexagon] Handle subregisters when calculating iteration count in HW loops

llvm-svn: 329434

6 years agofmod: Port from amd_builtins
Jan Vesely [Fri, 6 Apr 2018 17:43:08 +0000 (17:43 +0000)]
fmod: Port from amd_builtins

Uses only denormal path for fp32.
Passes CTS on carrizo and turks.

v2: whitespace fix

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry <awatry@gmail.com>
llvm-svn: 329433

6 years agoCleanup Reduction helpers by using ArrayRef(NoneType) constructor. NFCI.
Simon Pilgrim [Fri, 6 Apr 2018 17:25:06 +0000 (17:25 +0000)]
Cleanup Reduction helpers by using ArrayRef(NoneType) constructor. NFCI.

Pointed out by @abataev on D45366.

llvm-svn: 329431

6 years ago[AMDGPU][MC][GFX9] Added instruction s_endpgm_ordered_ps_done
Dmitry Preobrazhensky [Fri, 6 Apr 2018 17:25:00 +0000 (17:25 +0000)]
[AMDGPU][MC][GFX9] Added instruction s_endpgm_ordered_ps_done

See bug 36844: https://bugs.llvm.org/show_bug.cgi?id=36844

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329430

6 years ago[InstCombine] limit nsz: -(X - Y) --> Y - X to hasOneUse()
Sanjay Patel [Fri, 6 Apr 2018 17:24:08 +0000 (17:24 +0000)]
[InstCombine] limit nsz: -(X - Y) --> Y - X to hasOneUse()

As noted in the post-commit discussion for r329350, we shouldn't
generally assume that fsub is the same cost as fneg.

llvm-svn: 329429

6 years ago[clang-tidy] Sort includes; NFC
George Burgess IV [Fri, 6 Apr 2018 17:22:36 +0000 (17:22 +0000)]
[clang-tidy] Sort includes; NFC

llvm-svn: 329428

6 years agoAdd additional tests from D45336
Simon Pilgrim [Fri, 6 Apr 2018 17:18:44 +0000 (17:18 +0000)]
Add additional tests from D45336

llvm-svn: 329427

6 years ago[lldb-server] Set a more generous timeout when testing gdbremote.
Davide Italiano [Fri, 6 Apr 2018 17:17:20 +0000 (17:17 +0000)]
[lldb-server] Set a more generous timeout when testing gdbremote.

One of our downstream bot is struggling under load,  but this
value should be enough for everyone.

llvm-svn: 329426

6 years agoAdd additional tests from D45366
Simon Pilgrim [Fri, 6 Apr 2018 17:15:56 +0000 (17:15 +0000)]
Add additional tests from D45366

llvm-svn: 329425

6 years ago[X686] Add appropriate ReadAfterLd for the register input to memory forms of ADC...
Craig Topper [Fri, 6 Apr 2018 17:12:18 +0000 (17:12 +0000)]
[X686] Add appropriate ReadAfterLd for the register input to memory forms of ADC/SBB.

llvm-svn: 329424

6 years agoRevert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit"
Jan Kratochvil [Fri, 6 Apr 2018 17:11:13 +0000 (17:11 +0000)]
Revert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit"

The reverted commit changed DWARFUnit from https://reviews.llvm.org/D40466 and
https://reviews.llvm.org/D42892 that was prepared for DWARFPartialUnit and
made from it a superclass for DWARFTypeUnit.  DWARFUnit's intention was:
DWARFUnit->DWARFSomeNameUnit->DWARFCompileUnit
DWARFUnit->DWARFSomeNameUnit->DWARFTypeUnit
DWARFUnit->DWARFPartialUnit

Discussed at: https://reviews.llvm.org/D45170

This reverts commit r329305.

llvm-svn: 329423

6 years ago[compiler-rt][dfsan][mips] UnXPASS a consistently passing test
Simon Dardis [Fri, 6 Apr 2018 17:03:36 +0000 (17:03 +0000)]
[compiler-rt][dfsan][mips] UnXPASS a consistently passing test

llvm-svn: 329422

6 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Fri, 6 Apr 2018 17:01:54 +0000 (17:01 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 329421

6 years ago[HIP] define __CUDA_ARCH_=1 for amdgcn targets
Yaxun Liu [Fri, 6 Apr 2018 16:43:42 +0000 (16:43 +0000)]
[HIP] define __CUDA_ARCH_=1 for amdgcn targets

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

llvm-svn: 329420

6 years ago[AMDGPU][MC][GFX9] Added instructions *saveexec*, *wrexec* and *bitreplicate*
Dmitry Preobrazhensky [Fri, 6 Apr 2018 16:35:11 +0000 (16:35 +0000)]
[AMDGPU][MC][GFX9] Added instructions *saveexec*, *wrexec* and *bitreplicate*

See bug 36840: https://bugs.llvm.org/show_bug.cgi?id=36840

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329419

6 years ago[InstCombine] add test for fsub+fneg with extra use; NFC
Sanjay Patel [Fri, 6 Apr 2018 16:30:52 +0000 (16:30 +0000)]
[InstCombine] add test for fsub+fneg with extra use; NFC

llvm-svn: 329418

6 years ago[X86] Remove InstRWs for basic arithmetic instructions from Sandy Bridge scheduler...
Craig Topper [Fri, 6 Apr 2018 16:29:31 +0000 (16:29 +0000)]
[X86] Remove InstRWs for basic arithmetic instructions from Sandy Bridge scheduler model.

We can get this right through WriteALU and friends now.

llvm-svn: 329417

6 years ago[X86] Attempt to model basic arithmetic instructions in the Haswell/Broadwell/Skylake...
Craig Topper [Fri, 6 Apr 2018 16:16:48 +0000 (16:16 +0000)]
[X86] Attempt to model basic arithmetic instructions in the Haswell/Broadwell/Skylake scheduler models without InstRWs

Summary:
This patch removes InstRW overrides for basic arithmetic/logic instructions. To do this I've added the store address port to RMW. And used a WriteSequence to make the latency additive. It does not cover ADC/SBB because they have different latency.

Apparently we were inconsistent about whether the store has latency or not thus the test changes.

I've also left out Sandy Bridge because the load latency there is currently 4 cycles and should be 5.

Reviewers: RKSimon, andreadb

Reviewed By: andreadb

Subscribers: llvm-commits

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

llvm-svn: 329416

6 years ago[X86] Add an extra store address cycle to WriteRMW in the Sandy Bridge/Broadwell...
Craig Topper [Fri, 6 Apr 2018 16:16:46 +0000 (16:16 +0000)]
[X86] Add an extra store address cycle to WriteRMW in the Sandy Bridge/Broadwell/Haswell/Skylake scheduler model.

Even those the address was calculated for the load, its calculated again for the store.

llvm-svn: 329415

6 years ago[X86] Merge itineraries for CLC, CMC, and STC.
Craig Topper [Fri, 6 Apr 2018 16:16:43 +0000 (16:16 +0000)]
[X86] Merge itineraries for CLC, CMC, and STC.

These are very simple flag setting instructions that appear to only be a single uop. They're unlikely to need this separation.

llvm-svn: 329414

6 years ago[CostModel][X86] Regenerate bit count cost tests with update_analyze_test_checks.py
Simon Pilgrim [Fri, 6 Apr 2018 16:14:27 +0000 (16:14 +0000)]
[CostModel][X86] Regenerate bit count cost tests with update_analyze_test_checks.py

llvm-svn: 329413

6 years ago[InstCombine] add potential calloc tests and regenerate checks; NFC
Sanjay Patel [Fri, 6 Apr 2018 16:06:08 +0000 (16:06 +0000)]
[InstCombine] add potential calloc tests and regenerate checks; NFC

D45344 is proposing to remove the use restriction that made the calloc
transform safe, but it doesn't currently address the problematic example
given inD16337. Add a test to make sure that doesn't break.

llvm-svn: 329412