platform/upstream/llvm.git
7 years agoGPURuntime: ensure compilation with C99
Tobias Grosser [Sun, 11 Sep 2016 07:32:50 +0000 (07:32 +0000)]
GPURuntime: ensure compilation with C99

Otherwise, older compiler will error out on some of the C99 features we use.

llvm-svn: 281159

7 years ago[CodeGen] Make the TwoAddressInstructionPass check if the instruction is commutable...
Craig Topper [Sun, 11 Sep 2016 06:00:15 +0000 (06:00 +0000)]
[CodeGen] Make the TwoAddressInstructionPass check if the instruction is commutable before calling findCommutedOpIndices for every operand. Also make sure the operand is a register before each call to save some work on commutable instructions that might have an operand.

llvm-svn: 281158

7 years ago[AVX-512] Add test cases to demonstrate opportunities for commuting vpternlog. Commut...
Craig Topper [Sun, 11 Sep 2016 05:33:43 +0000 (05:33 +0000)]
[AVX-512] Add test cases to demonstrate opportunities for commuting vpternlog. Commuting will be added in a future commit.

llvm-svn: 281157

7 years ago[AVX-512] Add VPTERNLOG to load folding tables.
Craig Topper [Sun, 11 Sep 2016 05:33:40 +0000 (05:33 +0000)]
[AVX-512] Add VPTERNLOG to load folding tables.

llvm-svn: 281156

7 years ago[X86] Side effecting asm in AVX512 integer stack folding test should return 2 x i64...
Craig Topper [Sun, 11 Sep 2016 05:33:38 +0000 (05:33 +0000)]
[X86] Side effecting asm in AVX512 integer stack folding test should return 2 x i64 not 8 x i64.

llvm-svn: 281155

7 years ago[X86] Make a helper method into a static function local to the cpp file.
Craig Topper [Sun, 11 Sep 2016 05:33:35 +0000 (05:33 +0000)]
[X86] Make a helper method into a static function local to the cpp file.

llvm-svn: 281154

7 years agoAdd handling of !invariant.load to PropagateMetadata.
Justin Lebar [Sun, 11 Sep 2016 01:39:08 +0000 (01:39 +0000)]
Add handling of !invariant.load to PropagateMetadata.

Summary:
This will let e.g. the load/store vectorizer propagate this metadata
appropriately.

Reviewers: arsenm

Subscribers: tra, jholewinski, hfinkel, mzolotukhin

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

llvm-svn: 281153

7 years ago[NVPTX] Use ldg for explicitly invariant loads.
Justin Lebar [Sun, 11 Sep 2016 01:39:04 +0000 (01:39 +0000)]
[NVPTX] Use ldg for explicitly invariant loads.

Summary:
With this change (plus some changes to prevent !invariant from being
clobbered within llvm), clang will be able to model the __ldg CUDA
builtin as an invariant load, rather than as a target-specific llvm
intrinsic.  This will let the optimizer play with these loads --
specifically, we should be able to vectorize them in the load-store
vectorizer.

Reviewers: tra

Subscribers: jholewinski, hfinkel, llvm-commits, chandlerc

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

llvm-svn: 281152

7 years ago[CodeGen] Split out the notions of MI invariance and MI dereferenceability.
Justin Lebar [Sun, 11 Sep 2016 01:38:58 +0000 (01:38 +0000)]
[CodeGen] Split out the notions of MI invariance and MI dereferenceability.

Summary:
An IR load can be invariant, dereferenceable, neither, or both.  But
currently, MI's notion of invariance is IR-invariant &&
IR-dereferenceable.

This patch splits up the notions of invariance and dereferenceability at
the MI level.  It's NFC, so adds some probably-unnecessary
"is-dereferenceable" checks, which we can remove later if desired.

Reviewers: chandlerc, tstellarAMD

Subscribers: jholewinski, arsenm, nemanjai, llvm-commits

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

llvm-svn: 281151

7 years agoCodeGen: remove unnecessary else case
Saleem Abdulrasool [Sun, 11 Sep 2016 01:25:15 +0000 (01:25 +0000)]
CodeGen: remove unnecessary else case

Refactor the assignment so that its much more clear that the if-clause contains
the lookup, and once cached is directly used.  NFC.

llvm-svn: 281150

7 years agoMCInstrDesc: Flags (uint64_t) was checked using (1 << MCID::XYZ), but this
Sjoerd Meijer [Sat, 10 Sep 2016 20:54:19 +0000 (20:54 +0000)]
MCInstrDesc: Flags (uint64_t) was checked using (1 << MCID::XYZ), but this
should have been (1ULL << MCID::XYZ). Currently this works because enum Flag
has 31 values, but extending it will result in a compile warnings/errors.
This was part of the accepted patch in https://reviews.llvm.org/D23601, but
it was suggested to apply this first as a separate patch.

llvm-svn: 281149

7 years ago[MachO] Remove code accidentally cut'n'pasted 3 times.
Davide Italiano [Sat, 10 Sep 2016 20:41:26 +0000 (20:41 +0000)]
[MachO] Remove code accidentally cut'n'pasted 3 times.

It wasn't harmful, just goofy. It's weird to see how this has
fallen through the crack without anybody noticing for so long.

llvm-svn: 281148

7 years agoIt should also be legal to pass a swifterror parameter to a call as a swifterror
Arnold Schwaighofer [Sat, 10 Sep 2016 19:42:53 +0000 (19:42 +0000)]
It should also be legal to pass a swifterror parameter to a call as a swifterror
argument.

rdar://28233388

llvm-svn: 281147

7 years ago[llvm-cov] Move the 'jump to first unexecuted line' link
Vedant Kumar [Sat, 10 Sep 2016 19:37:26 +0000 (19:37 +0000)]
[llvm-cov] Move the 'jump to first unexecuted line' link

Having it in the same row as the source name is jarring. Move it next to
the "Source" column label.

llvm-svn: 281146

7 years ago[llvm-cov] Minor visual tweaks for html reports
Vedant Kumar [Sat, 10 Sep 2016 19:37:20 +0000 (19:37 +0000)]
[llvm-cov] Minor visual tweaks for html reports

  - Change the location of the 'Region Coverage' column.
  - Use less css and text for some labels.

llvm-svn: 281145

7 years agoInstCombine: Don't combine loads/stores from swifterror to a new type
Arnold Schwaighofer [Sat, 10 Sep 2016 18:14:57 +0000 (18:14 +0000)]
InstCombine: Don't combine loads/stores from swifterror to a new type

This generates invalid IR: the only users of swifterror can be call
arguments, loads, and stores.

rdar://28242257

llvm-svn: 281144

7 years agoAdd an isSwiftError predicate to Value
Arnold Schwaighofer [Sat, 10 Sep 2016 18:14:54 +0000 (18:14 +0000)]
Add an isSwiftError predicate to Value

llvm-svn: 281143

7 years agoADT: Move ilist_node_access to ilist_detail::NodeAccess...
Duncan P. N. Exon Smith [Sat, 10 Sep 2016 16:55:06 +0000 (16:55 +0000)]
ADT: Move ilist_node_access to ilist_detail::NodeAccess...

... and make a few ilist-internal API changes, in preparation for
changing how ilist_node is templated.  The only effect for ilist users
should be changing the friend target from llvm::ilist_node_access to
llvm::ilist_detail::NodeAccess (which is only necessary when they
inherit privately from ilist_node).
- Split out SpecificNodeAccess, which has overloads of getNodePtr and
  getValuePtr that are untemplated.
- Use more typedefs to prevent more changes later.
- Force inheritance to use *NodeAccess (to emphasize that ilist *users*
  shouldn't be doing this).

There should be no functionality change here.

llvm-svn: 281142

7 years agoADT: Use typedefs for ilist_base and ilist_node_base, NFC
Duncan P. N. Exon Smith [Sat, 10 Sep 2016 16:28:52 +0000 (16:28 +0000)]
ADT: Use typedefs for ilist_base and ilist_node_base, NFC

This is a prep commit to minimize changes in a follow-up that is adding
a template parameter to ilist_node_base and ilist_base.

llvm-svn: 281141

7 years ago[InstCombine] clean up foldICmpBinOpEqualityWithConstant / foldICmpIntrinsicWithConst...
Sanjay Patel [Sat, 10 Sep 2016 15:33:39 +0000 (15:33 +0000)]
[InstCombine] clean up foldICmpBinOpEqualityWithConstant / foldICmpIntrinsicWithConstant ; NFC

1. Rename variables to be consistent with related/preceding code (may want to reorganize).
2. Fix comments/formatting.

llvm-svn: 281140

7 years ago[InstCombine] rename and reorganize some icmp folding functions; NFC
Sanjay Patel [Sat, 10 Sep 2016 15:03:44 +0000 (15:03 +0000)]
[InstCombine] rename and reorganize some icmp folding functions; NFC

Everything under foldICmpInstWithConstant() should now be working for
splat vectors via m_APInt matchers. Ie, I've removed all of the FIXMEs
that I added while cleaning that section up. Note that not all of the
associated FIXMEs in the regression tests are gone though, because some
of the tests require earlier folds that are still scalar-only.

llvm-svn: 281139

7 years agoWe also need to pass swifterror in R12 under swiftcc not only under ccc
Arnold Schwaighofer [Sat, 10 Sep 2016 14:16:55 +0000 (14:16 +0000)]
We also need to pass swifterror in R12 under swiftcc not only under ccc

rdar://28190687

llvm-svn: 281138

7 years ago[AMDGPU] Refactor MUBUF/MTBUF instructions
Valery Pykhtin [Sat, 10 Sep 2016 13:09:16 +0000 (13:09 +0000)]
[AMDGPU] Refactor MUBUF/MTBUF instructions

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

llvm-svn: 281137

7 years agoAdd missing test coverage for an inheritance model attrib merge diag.
Nico Weber [Sat, 10 Sep 2016 13:03:59 +0000 (13:03 +0000)]
Add missing test coverage for an inheritance model attrib merge diag.

Without this, no tests fail if I remove the Diag() in the first if in
Sema::mergeMSInheritanceAttr().

llvm-svn: 281136

7 years ago[gold/LTO] Add test case for r281134
Teresa Johnson [Sat, 10 Sep 2016 06:18:17 +0000 (06:18 +0000)]
[gold/LTO] Add test case for r281134

Add test case that was supposed to go in with r281134.

llvm-svn: 281135

7 years ago[LTO] Handle null GV in Symbol object
Teresa Johnson [Sat, 10 Sep 2016 06:15:26 +0000 (06:15 +0000)]
[LTO] Handle null GV in Symbol object

Similar to other Symbol methods, have Symbol::getComdat handle
a null GV gracefully.

Fixes PR30326.

llvm-svn: 281134

7 years ago[tablegen] Check that an optional IdentifierArgument of an attribute is
Akira Hatanaka [Sat, 10 Sep 2016 03:29:43 +0000 (03:29 +0000)]
[tablegen] Check that an optional IdentifierArgument of an attribute is
provided before trying to print it.

This fixes a segfault that occurs when function printPretty generated by
tablegen tries to print an optional argument of attribute
objc_bridge_related.

rdar://problem/28155469

llvm-svn: 281132

7 years ago[WebAssembly] Fix typos in comments
Heejin Ahn [Sat, 10 Sep 2016 02:33:47 +0000 (02:33 +0000)]
[WebAssembly] Fix typos in comments

llvm-svn: 281131

7 years ago[libFuzzer] print a failed-merge warning only in the merge mode
Kostya Serebryany [Sat, 10 Sep 2016 02:17:22 +0000 (02:17 +0000)]
[libFuzzer] print a failed-merge warning only in the merge mode

llvm-svn: 281130

7 years ago[ELF] Fix memory leak in BinaryFile handling.
Michael J. Spencer [Sat, 10 Sep 2016 01:42:43 +0000 (01:42 +0000)]
[ELF] Fix memory leak in BinaryFile handling.

llvm-svn: 281129

7 years agoAMDGPU: Implement is{LoadFrom|StoreTo}FrameIndex
Matt Arsenault [Sat, 10 Sep 2016 01:20:33 +0000 (01:20 +0000)]
AMDGPU: Implement is{LoadFrom|StoreTo}FrameIndex

llvm-svn: 281128

7 years agoAMDGPU: Fix scheduling info for spill pseudos
Matt Arsenault [Sat, 10 Sep 2016 01:20:28 +0000 (01:20 +0000)]
AMDGPU: Fix scheduling info for spill pseudos

These defaulted to Write32Bit. I don't think this actually matters
since these don't exist during scheduling.

llvm-svn: 281127

7 years ago[asan] Add flag to allow lifetime analysis of problematic allocas
Vitaly Buka [Sat, 10 Sep 2016 01:06:11 +0000 (01:06 +0000)]
[asan] Add flag to allow lifetime analysis of problematic allocas

Summary:
Could be useful for comparison when we suspect that alloca was skipped
because of this.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 281126

7 years ago[CodeGen] Rename MachineInstr::isInvariantLoad to isDereferenceableInvariantLoad...
Justin Lebar [Sat, 10 Sep 2016 01:03:20 +0000 (01:03 +0000)]
[CodeGen] Rename MachineInstr::isInvariantLoad to isDereferenceableInvariantLoad.  NFC

Summary:
I want to separate out the notions of invariance and dereferenceability
at the MI level, so that they correspond to the equivalent concepts at
the IR level.  (Currently an MI load is MI-invariant iff it's
IR-invariant and IR-dereferenceable.)

First step is renaming this function.

Reviewers: chandlerc

Subscribers: MatzeB, jfb, llvm-commits

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

llvm-svn: 281125

7 years ago[libFuzzer] don't print help for internal flags
Kostya Serebryany [Sat, 10 Sep 2016 00:35:30 +0000 (00:35 +0000)]
[libFuzzer] don't print help for internal flags

llvm-svn: 281124

7 years ago[libFuzzer] print a visible message if merge fails due to a crash
Kostya Serebryany [Sat, 10 Sep 2016 00:15:41 +0000 (00:15 +0000)]
[libFuzzer] print a visible message if merge fails due to a crash

llvm-svn: 281122

7 years agoasync structured data packet handling improvements
Todd Fiala [Sat, 10 Sep 2016 00:06:29 +0000 (00:06 +0000)]
async structured data packet handling improvements

This change does the following:
* Changes the signature for the continuation delegate method that handles
  async structured data from accepting an already-parsed structured data
  element to taking just the packet contents.
* Moves the conversion of the JSON-async: packet contents from
  GDBRemoteClientBase to the continuation delegate method.
* Adds a new unit test for verifying that the $JSON-asyc: packets get
  decoded and that the decoded packets get forwarded on to the delegate
  for further processing. Thanks to Pavel for making that whole section of
  code easily unit testable!
* Tightens up the packet verification on reception of a $JSON-async:
  packet contents. The code prior to this change is susceptible to a
  segfault if a packet is carefully crafted that starts with $J but
  has a total length shorter than the length of "$JSON-async:".

Reviewers: labath, clayborg, zturner

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

llvm-svn: 281121

7 years agoRemove dead code in the SelectionDAG headers (NFC)
Vedant Kumar [Sat, 10 Sep 2016 00:05:19 +0000 (00:05 +0000)]
Remove dead code in the SelectionDAG headers (NFC)

I tested this with "ninja check-llvm-codegen" on a Release build with
all architectures enabled, and again with a Debug build on x86.

Found with llvm-cov.

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

llvm-svn: 281120

7 years agoModules: for ObjectiveC try to keep the definition invariant.
Manman Ren [Fri, 9 Sep 2016 23:48:27 +0000 (23:48 +0000)]
Modules: for ObjectiveC try to keep the definition invariant.

When deserializing ObjCInterfaceDecl with definition data, if we already have
a definition, try to keep the definition invariant; also pull in the
categories even if it is not what getDefinition returns (this effectively
combines categories).

rdar://27926200
rdar://26708823

llvm-svn: 281119

7 years ago[SE] Remove Utils directory
Jason Henline [Fri, 9 Sep 2016 23:33:58 +0000 (23:33 +0000)]
[SE] Remove Utils directory

Summary:
There is no purpose in splitting out the Error class from the rest of
the StreamExecutor code. This organization was just a vestige of an old
failed design.

Plus, this change fixes a bug in the build where the utilites library
was not being statically linked in with libstreamexecutor.

Reviewers: jlebar, jprice

Subscribers: beanz, parallel_libs-commits

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

llvm-svn: 281118

7 years agoAMDGPU: Fix immediate folding logic when shrinking instructions
Matt Arsenault [Fri, 9 Sep 2016 23:32:53 +0000 (23:32 +0000)]
AMDGPU: Fix immediate folding logic when shrinking instructions

If the literal is being folded into src0, it doesn't matter
if it's an SGPR because it's being replaced with the literal.

Also fixes initially selecting 32-bit versions of some instructions
which also confused commuting.

llvm-svn: 281117

7 years ago[sanitizer] Add interceptor for ttyname_r
Keno Fischer [Fri, 9 Sep 2016 23:09:34 +0000 (23:09 +0000)]
[sanitizer] Add interceptor for ttyname_r

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281116

7 years agoMove the contents of test/elf to test/ELF
Hans Wennborg [Fri, 9 Sep 2016 22:46:16 +0000 (22:46 +0000)]
Move the contents of test/elf to test/ELF

Having two directories with the same name modulo case does not work well
on Windows. The new test/elf directory was added in r281108. I assume
the intention was to add the test file to the existing test/ELF dir.

llvm-svn: 281115

7 years agoInliner: Don't mark swifterror allocas with lifetime markers
Arnold Schwaighofer [Fri, 9 Sep 2016 22:40:27 +0000 (22:40 +0000)]
Inliner: Don't mark swifterror allocas with lifetime markers

This would create a bitcast use which fails the verifier: swifterror values may
only be used by loads, stores, and as function arguments.

rdar://28233244

llvm-svn: 281114

7 years agoX86: Fold tail calls into conditional branches also for 64-bit (PR26302)
Hans Wennborg [Fri, 9 Sep 2016 22:37:27 +0000 (22:37 +0000)]
X86: Fold tail calls into conditional branches also for 64-bit (PR26302)

This extends the optimization in r280832 to also work for 64-bit. The only
quirk is that we can't do this for 64-bit Windows (yet).

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

llvm-svn: 281113

7 years agoAMDGPU: Run LoadStoreVectorizer pass by default
Matt Arsenault [Fri, 9 Sep 2016 22:29:28 +0000 (22:29 +0000)]
AMDGPU: Run LoadStoreVectorizer pass by default

llvm-svn: 281112

7 years ago[libFuzzer] use sizeof() in tests instead of 4 and 8
Kostya Serebryany [Fri, 9 Sep 2016 22:21:16 +0000 (22:21 +0000)]
[libFuzzer] use sizeof() in tests instead of 4 and 8

llvm-svn: 281111

7 years agoLSV: Fix incorrectly increasing alignment
Matt Arsenault [Fri, 9 Sep 2016 22:20:14 +0000 (22:20 +0000)]
LSV: Fix incorrectly increasing alignment

If the unaligned access has a dynamic offset, it may be odd which
would make the adjusted alignment incorrect to use.

llvm-svn: 281110

7 years ago[gold] Test that we handle invalid directory correctly.
Davide Italiano [Fri, 9 Sep 2016 22:14:57 +0000 (22:14 +0000)]
[gold] Test that we handle invalid directory correctly.

I had this test sitting around for a while but always forgot to
commit. Rafael reviewed it a while ago.

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

llvm-svn: 281109

7 years ago[ELF] Add support for -b binary
Michael J. Spencer [Fri, 9 Sep 2016 22:08:04 +0000 (22:08 +0000)]
[ELF] Add support for -b binary

Implemented by building an ELF file in memory.

elf, default, and binary match gold behavior.

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

llvm-svn: 281108

7 years ago[InstCombine] use m_APInt to allow icmp ult X, C folds for splat constant vectors
Sanjay Patel [Fri, 9 Sep 2016 21:59:37 +0000 (21:59 +0000)]
[InstCombine] use m_APInt to allow icmp ult X, C folds for splat constant vectors

llvm-svn: 281107

7 years ago[libFuzzer] one more puzzle for value profile
Kostya Serebryany [Fri, 9 Sep 2016 21:58:42 +0000 (21:58 +0000)]
[libFuzzer] one more puzzle for value profile

llvm-svn: 281106

7 years ago[X86][XOP] Fix VPERMIL2PD mask creation on 32-bit targets
Simon Pilgrim [Fri, 9 Sep 2016 21:47:21 +0000 (21:47 +0000)]
[X86][XOP] Fix VPERMIL2PD mask creation on 32-bit targets

Use getConstVector helper to correctly create v2i64/v4i64 constants on 32-bit targets

llvm-svn: 281105

7 years ago[Hexagon] Fix disassembler crash after r279255
Krzysztof Parzyszek [Fri, 9 Sep 2016 21:45:00 +0000 (21:45 +0000)]
[Hexagon] Fix disassembler crash after r279255

When p0 was added as an explicit operand to the duplex subinstructions,
the disassembler was not updated to reflect this.

llvm-svn: 281104

7 years ago[sanitizer] fix an allocator bug where the allocated memory may overlap with the...
Kostya Serebryany [Fri, 9 Sep 2016 21:42:33 +0000 (21:42 +0000)]
[sanitizer] fix an allocator bug where the allocated memory may overlap with the free array (kudos to Kostya Korcthinsky). Also make sure that the allocator does not mmap more than requested. Test both.

llvm-svn: 281103

7 years ago[X86] Regenerate test. NFC.
Michael Kuperstein [Fri, 9 Sep 2016 21:36:17 +0000 (21:36 +0000)]
[X86] Regenerate test. NFC.

llvm-svn: 281099

7 years agoAdd comments.
Rui Ueyama [Fri, 9 Sep 2016 21:35:38 +0000 (21:35 +0000)]
Add comments.

llvm-svn: 281098

7 years agoEnable in-tree builds of parallel-libs.
Justin Lebar [Fri, 9 Sep 2016 21:34:12 +0000 (21:34 +0000)]
Enable in-tree builds of parallel-libs.

Summary:
parallel-libs needs its own changes to make this work; these are just
the LLVM changes.

Reviewers: jhen

Subscribers: llvm-commits, beanz, jprice

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

llvm-svn: 281097

7 years agoRevert "Compact InputSectionData from 64 to 48 bytes. NFC."
Rafael Espindola [Fri, 9 Sep 2016 21:20:30 +0000 (21:20 +0000)]
Revert "Compact InputSectionData from 64 to 48 bytes. NFC."

This reverts commit r281084.

The link was failing on some bots. No idea why. I will try to
reproduce it on Monday.

llvm-svn: 281096

7 years agoCreate phi nodes for swifterror values at the end of the phi instructions list
Arnold Schwaighofer [Fri, 9 Sep 2016 21:18:47 +0000 (21:18 +0000)]
Create phi nodes for swifterror values at the end of the phi instructions list

ISel makes assumption about the order of phi nodes.

rdar://28190150

llvm-svn: 281095

7 years agoDebug info: Bump the default DWARF version on Darwin to 4.
Adrian Prantl [Fri, 9 Sep 2016 21:10:35 +0000 (21:10 +0000)]
Debug info: Bump the default DWARF version on Darwin to 4.

This is a spiritual re-commit of r201375 with only a brief delay
for upgrading the green dragon builders.

llvm-svn: 281094

7 years ago[asan] Store access_size in the {Stack,Global}AddressDescription objects
Filipe Cabecinhas [Fri, 9 Sep 2016 21:09:06 +0000 (21:09 +0000)]
[asan] Store access_size in the {Stack,Global}AddressDescription objects

Summary:
This is important information when we want to describe errors, and should be
part of these descriptions. Otherwise, we need to know the access size when
printing/emitting the description.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281093

7 years ago[NVPTX] Implement llvm.fabs.f32, llvm.max.f32, etc.
Justin Lebar [Fri, 9 Sep 2016 21:07:26 +0000 (21:07 +0000)]
[NVPTX] Implement llvm.fabs.f32, llvm.max.f32, etc.

Summary:
Previously these only worked via NVPTX-specific intrinsics.

This change will allow us to convert these target-specific intrinsics
into the general LLVM versions, allowing existing LLVM passes to reason
about their behavior.

It also gets us some minor codegen improvements as-is, from situations
where we canonicalize code into one of these llvm intrinsics.

Reviewers: majnemer

Subscribers: llvm-commits, jholewinski, tra

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

llvm-svn: 281092

7 years ago[StreamExecutor] Make SE work with an in-tree LLVM build.
Justin Lebar [Fri, 9 Sep 2016 21:01:02 +0000 (21:01 +0000)]
[StreamExecutor] Make SE work with an in-tree LLVM build.

Summary:
With these changes, we can put parallel-libs within llvm/projects and
build as normal.

This is kind of the minimal change I could figure out how to make while
still making us compatible with llvm's build system.  Some things I'm
not thrilled about include:

 * The creation of a CoreTests directory (the macros really seemed to
   want this)

 * Pulling SimpleHostPlatformDevice.h into CoreTests.  It seems to me
   this should live inside unittests/include, or maybe tests/include,
   but I didn't want to make that change in this patch.

One important piece of work that remains to be done is to make

  $ ninja check-streamexecutor

run all the tests.  Right now the only way I've figured out to run the
tests is

  $ ninja projects/parallel-libs/streamexecutor/unittests/StreamExecutorUnitTests
  $ projects/parallel-libs/streamexecutor/unittests/CoreTests/CoreTests

Reviewers: jhen

Subscribers: beanz, parallel_libs-commits, jprice

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

llvm-svn: 281091

7 years ago[asan] Add a new AddressDescription structure, which can describe any type of address.
Filipe Cabecinhas [Fri, 9 Sep 2016 20:43:20 +0000 (20:43 +0000)]
[asan] Add a new AddressDescription structure, which can describe any type of address.

Summary:
This is useful for inclusion in the Error* structures, to describe an
arbitrary address.

Remove the old struct since it's used only once. This removes one level of
indirection, and moves all *AddressDescription to be one of the recently
introduced structures.

This merges differential revisions: D24131 and D24132

Reviewers: kcc, eugenis, vitalybuka

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 281090

7 years ago[CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.
Justin Lebar [Fri, 9 Sep 2016 20:35:43 +0000 (20:35 +0000)]
[CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.

Summary:
This fixes a bug where we were unable to compile the following CUDA
file with libstdc++ (didn't try libc++):

  #include <future>
  void foo() { std::shared_future<int> x; }

The problem is that <future> only defines std::shared_future if
__GCC_ATOMIC_INT_LOCK_FREE > 1.  When we compiled this file for device,
the macro was set to 1, and then the class didn't exist at all.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 281089

7 years agoARM: move the builtins libcall CC setup
Saleem Abdulrasool [Fri, 9 Sep 2016 20:11:31 +0000 (20:11 +0000)]
ARM: move the builtins libcall CC setup

Move the target specific setup into the target specific lowering setup.  As
pointed out by Anton, the initial change was moving this too high up the stack
resulting in a violation of the layering (the target generic code path setup
target specific bits).  Sink this into the ARM specific setup.  NFC.

llvm-svn: 281088

7 years ago[cmake] Fix a stale comment from an earlier version of r281085. NFC.
Michael Gottesman [Fri, 9 Sep 2016 19:48:22 +0000 (19:48 +0000)]
[cmake] Fix a stale comment from an earlier version of r281085. NFC.

llvm-svn: 281086

7 years ago[cmake] Export gtest/gtest_main and its dependencies via a special build tree only...
Michael Gottesman [Fri, 9 Sep 2016 19:45:34 +0000 (19:45 +0000)]
[cmake] Export gtest/gtest_main and its dependencies via a special build tree only cmake exports file.

Previously, gtest/gtest_main were not exported via cmake. The intention here was
to ensure that users whom are linking against the LLVM install tree would not
get the gtest/gtest_main targets. This prevents downstream projects that link
against the LLVM build tree (i.e. Swift) from getting this dependency
information in their cmake builds. Without such dependency information, linker
issues can result on linux due to LLVMSupport being put before gtest on the
linker command line.

This commit preserves behavior that we want for the install tree, while adding
support for the build tree by:

1. The special casing for gtest/gtest_main in the add_llvm_library code is
removed in favor of a flag called "BUILDTREE_ONLY". If this is set, then the
library is communicating that it is only meant to be exported into the build
tree and is not meant to be installed or exported via the install tree. This
part is just a tweak to remove the special case, the underlying code is the
same.

2. The cmake code that exports cmake targets for the build tree has special code
to import an additional targets file called
LLVMBuildTreeOnlyExports.cmake. Additionally the extra targets are added to the
LLVMConfig.cmake's LLVM_EXPORTED_TARGETS variable. In contrast, the
"installation" cmake file uses the normal LLVM_EXPORTS_TARGETS as before and
does not include the extra exports file. This is implemented by
defining/undefining variables when performing a configure of the build/install
tree LLVMConfig.cmake files.

llvm-svn: 281085

7 years agoCompact InputSectionData from 64 to 48 bytes. NFC.
Rafael Espindola [Fri, 9 Sep 2016 19:42:11 +0000 (19:42 +0000)]
Compact InputSectionData from 64 to 48 bytes. NFC.

llvm-svn: 281084

7 years agotest: adjust the GUID
Saleem Abdulrasool [Fri, 9 Sep 2016 19:41:46 +0000 (19:41 +0000)]
test: adjust the GUID

Although the GUID seems to be stable across test runs now, it seems to be
unstable across hosts.  Lets be a bit more lax about the reading of the RSDS
record.

llvm-svn: 281083

7 years agoAdd a lower level zlib::uncompress.
Rafael Espindola [Fri, 9 Sep 2016 19:32:36 +0000 (19:32 +0000)]
Add a lower level zlib::uncompress.

SmallVectors are convenient, but they don't cover every use case.

In particular, they are fairly large (3 pointers + one element) and
there is no way to take ownership of the buffer to put it somewhere
else.  This patch then adds a lower lever interface that works with
any buffer.

llvm-svn: 281082

7 years agoAMDGPU : Fix mqsad_u32_u8 instruction incorrect data type.
Wei Ding [Fri, 9 Sep 2016 19:31:51 +0000 (19:31 +0000)]
AMDGPU : Fix mqsad_u32_u8 instruction incorrect data type.

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

llvm-svn: 281081

7 years agoAMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is 8-byte aligned for HSA
Tom Stellard [Fri, 9 Sep 2016 19:28:00 +0000 (19:28 +0000)]
AMDGPU/SI: Make sure llvm.amdgcn.implicitarg.ptr() is 8-byte aligned for HSA

Reviewers: arsenm

Subscribers: arsenm, wdng, nhaehnle, llvm-commits

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

llvm-svn: 281080

7 years agoCOFF: make builds more reproducible
Saleem Abdulrasool [Fri, 9 Sep 2016 19:26:03 +0000 (19:26 +0000)]
COFF: make builds more reproducible

Change the way we calculate the build id to use MD5 to give reproducible build
ids. Previously we would generate random bytes for the build id GUID.

llvm-svn: 281079

7 years agoModules: revert r280728.
Manman Ren [Fri, 9 Sep 2016 19:03:07 +0000 (19:03 +0000)]
Modules: revert r280728.

In post-commit review, Richard suggested a better way to fix this.
rdar://27926200

llvm-svn: 281078

7 years ago[pdb] Print out some more info when dumping a raw stream.
Zachary Turner [Fri, 9 Sep 2016 19:00:49 +0000 (19:00 +0000)]
[pdb] Print out some more info when dumping a raw stream.

We have various command line options that print the type of a
stream, the size of a stream, etc but nowhere that it can all be
viewed together.

Since a previous patch introduced the ability to dump the bytes
of a stream, this seems like a good place to present a full view
of the stream's properties including its size, what kind of data
it represents, and the blocks it occupies.  So I added the
ability to print that information to the -stream-data command
line option.

llvm-svn: 281077

7 years ago[llvm-cov] Remove some asserts in the html renderer (NFC)
Vedant Kumar [Fri, 9 Sep 2016 18:44:40 +0000 (18:44 +0000)]
[llvm-cov] Remove some asserts in the html renderer (NFC)

These asserts are making tests fragile. The renderer does not enter an
invalid state when they fail, however, it may spit out a garbled
coverage report because the source text no longer matches the provided
coverage mapping.

Another follow-up to r281072.

llvm-svn: 281076

7 years ago[asan] Disable handle_abort in Android tests.
Evgeniy Stepanov [Fri, 9 Sep 2016 18:43:24 +0000 (18:43 +0000)]
[asan] Disable handle_abort in Android tests.

The same thing is already done on Mac. handle_abort slows down tests
significantly because it triggers tombstone collection on Android;
also, it changes failed test outcome from "not-crash" to "crash" (as
in "bin/not --crash").

This change adds handle_abort=0 to asan options on android (test
only!), and also tweaks android_run.py to semi-correctly pass the
crash/no-crash status to the caller.

llvm-svn: 281075

7 years agoDo not widen load for different variable in GVN.
Dehao Chen [Fri, 9 Sep 2016 18:42:35 +0000 (18:42 +0000)]
Do not widen load for different variable in GVN.

Summary:
Widening load in GVN is too early because it will block other optimizations like PRE, LICM.

https://llvm.org/bugs/show_bug.cgi?id=29110

The SPECCPU2006 benchmark impact of this patch:

Reference: o2_nopatch
(1): o2_patched

           Benchmark             Base:Reference   (1)
-------------------------------------------------------
spec/2006/fp/C++/444.namd                  25.2  -0.08%
spec/2006/fp/C++/447.dealII               45.92  +1.05%
spec/2006/fp/C++/450.soplex                41.7  -0.26%
spec/2006/fp/C++/453.povray               35.65  +1.68%
spec/2006/fp/C/433.milc                   23.79  +0.42%
spec/2006/fp/C/470.lbm                    41.88  -1.12%
spec/2006/fp/C/482.sphinx3                47.94  +1.67%
spec/2006/int/C++/471.omnetpp             22.46  -0.36%
spec/2006/int/C++/473.astar               21.19  +0.24%
spec/2006/int/C++/483.xalancbmk           36.09  -0.11%
spec/2006/int/C/400.perlbench             33.28  +1.35%
spec/2006/int/C/401.bzip2                 22.76  -0.04%
spec/2006/int/C/403.gcc                   32.36  +0.12%
spec/2006/int/C/429.mcf                   41.04  -0.41%
spec/2006/int/C/445.gobmk                 26.94  +0.04%
spec/2006/int/C/456.hmmer                  24.5  -0.20%
spec/2006/int/C/458.sjeng                    28  -0.46%
spec/2006/int/C/462.libquantum            55.25  +0.27%
spec/2006/int/C/464.h264ref               45.87  +0.72%

geometric mean                                   +0.23%

For most benchmarks, it's a wash, but we do see stable improvements on some benchmarks, e.g. 447,453,482,400.

Reviewers: davidxl, hfinkel, dberlin, sanjoy, reames

Subscribers: gberry, junbuml

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

llvm-svn: 281074

7 years agoFix another -Wunused-variable for non-assert build.
Rui Ueyama [Fri, 9 Sep 2016 18:37:08 +0000 (18:37 +0000)]
Fix another -Wunused-variable for non-assert build.

llvm-svn: 281073

7 years ago[llvm-cov] Try to fix the native_separators.c test some more
Vedant Kumar [Fri, 9 Sep 2016 18:34:43 +0000 (18:34 +0000)]
[llvm-cov] Try to fix the native_separators.c test some more

It's still breaking this bot (though, it looks like it always had been):

  http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015

This time, add quotes around llvm-{cov,config} so that lit won't expand
them.

Thanks to Reid for suggesting the patch!

llvm-svn: 281072

7 years agoMyriad: nominally "support" ASAN.
Douglas Katzman [Fri, 9 Sep 2016 18:20:49 +0000 (18:20 +0000)]
Myriad: nominally "support" ASAN.

Doesn't work, but needs to be enabled in order to get there.

llvm-svn: 281071

7 years ago[pdb] Add command line options for dumping individual streams and blocks
Zachary Turner [Fri, 9 Sep 2016 18:17:52 +0000 (18:17 +0000)]
[pdb] Add command line options for dumping individual streams and blocks

I ran into a situation where I wanted to print out the contents of
page 6 of a PDB as a binary blob, and there was no straightforward
way to do that.

In addition to adding that, this patch also adds the ability to dump
a stream by index as a binary blob, and it will stitch together all
the blocks and dump the whole thing as one seemingly contiguous
sequence of bytes.

llvm-svn: 281070

7 years agoFix -Wunused-variable for non-assert build.
Rui Ueyama [Fri, 9 Sep 2016 18:07:33 +0000 (18:07 +0000)]
Fix -Wunused-variable for non-assert build.

llvm-svn: 281069

7 years ago[OPENMP] ppc64le recognized as big-endian
George Rokos [Fri, 9 Sep 2016 18:04:23 +0000 (18:04 +0000)]
[OPENMP] ppc64le recognized as big-endian

There is a bug in CMakeLists which causes powerpc64le systems to be recognized as big-endian. This patch fixes the issue.

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

llvm-svn: 281068

7 years ago[pdb] Pass CVRecord's through the visitor as non-const references.
Zachary Turner [Fri, 9 Sep 2016 18:03:39 +0000 (18:03 +0000)]
[pdb] Pass CVRecord's through the visitor as non-const references.

This simplifies a lot of code, and will actually be necessary for
an upcoming patch to serialize TPI record hash values.

The idea before was that visitors should be examining records, not
modifying them.  But this is no longer true with a visitor that
constructs a CVRecord from Yaml.  To handle this until now, we
were doing some fixups on CVRecord objects at a higher level, but
the code is really awkward, and it makes sense to just have the
visitor write the bytes into the CVRecord.  In doing so I uncovered
a few bugs related to `Data` and `RawData` and fixed those.

Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D24362

llvm-svn: 281067

7 years ago[libFuzzer] one more puzzle, value_profile cracks it in a second
Kostya Serebryany [Fri, 9 Sep 2016 18:00:04 +0000 (18:00 +0000)]
[libFuzzer] one more puzzle, value_profile cracks it in a second

llvm-svn: 281066

7 years ago[OPENMP] Implementation of omp_get_default_device and omp_set_default_device
George Rokos [Fri, 9 Sep 2016 17:55:26 +0000 (17:55 +0000)]
[OPENMP] Implementation of omp_get_default_device and omp_set_default_device

Implementation of missing OpenMP 4.0 API functions omp_get_default_device and omp_set_default_device.
Also, added support for the environment variable OMP_DEFAULT_DEVICE.

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

llvm-svn: 281065

7 years agoAlso cleanup comments around redundant colons/commas in format::cleanup.
Eric Liu [Fri, 9 Sep 2016 17:50:49 +0000 (17:50 +0000)]
Also cleanup comments around redundant colons/commas in format::cleanup.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 281064

7 years ago[pdb] Write PDB TPI Stream from Yaml.
Zachary Turner [Fri, 9 Sep 2016 17:46:17 +0000 (17:46 +0000)]
[pdb] Write PDB TPI Stream from Yaml.

This writes the full sequence of type records described in
Yaml to the TPI stream of the PDB file.

Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D24316

llvm-svn: 281063

7 years ago[llvm-cov] Handle native paths correctly in the text index
Vedant Kumar [Fri, 9 Sep 2016 17:37:11 +0000 (17:37 +0000)]
[llvm-cov] Handle native paths correctly in the text index

Treat filenames the same way in the text index as we do in the html
index. This is a follow-up to r281008 (an attempt to unbreak the
native_separators.c test on Windows).

Patch by Maggie Yi!

llvm-svn: 281062

7 years agoMove the ocaml_all target into the Misc folder for cleanliness; NFC.
Aaron Ballman [Fri, 9 Sep 2016 17:30:59 +0000 (17:30 +0000)]
Move the ocaml_all target into the Misc folder for cleanliness; NFC.

llvm-svn: 281061

7 years ago[codeview] Don't assert if the array element type is incomplete
Reid Kleckner [Fri, 9 Sep 2016 17:29:36 +0000 (17:29 +0000)]
[codeview] Don't assert if the array element type is incomplete

This can happen when the frontend knows the debug info will be emitted
somewhere else. Usually this happens for dynamic classes with out of
line constructors or key functions, but it can also happen when modules
are enabled.

llvm-svn: 281060

7 years ago[Bitcode] Add compatibility test for the 3.9 release
Vedant Kumar [Fri, 9 Sep 2016 17:24:31 +0000 (17:24 +0000)]
[Bitcode] Add compatibility test for the 3.9 release

Fork off compatibility.ll for the 3.9 release. The *.bc file in this
commit was produced using a Release build of the release_39 branch.

llvm-svn: 281059

7 years agoxfail DarwinLog "filter message by regex" tests
Todd Fiala [Fri, 9 Sep 2016 17:07:15 +0000 (17:07 +0000)]
xfail DarwinLog "filter message by regex" tests

These tests are not working reliably.  I'm marking them
xfail until I resolve the issue.

Tracked by:
llvm.org/pr30299

llvm-svn: 281058

7 years ago[DebugInfo] Ensure complete type is emitted with -fstandalone-debug
Reid Kleckner [Fri, 9 Sep 2016 17:03:53 +0000 (17:03 +0000)]
[DebugInfo] Ensure complete type is emitted with -fstandalone-debug

The logic for upgrading a class from a forward decl to a complete type
was not checking the debug info emission level before applying the
vtable optimization. This meant we ended up without debug info for a
class which was required to be complete. I noticed it because it
triggered an assertion during CodeView emission, but that's a separate
issue.

llvm-svn: 281057

7 years agoMake -fstandalone-debug and -flimit-debug-info available in clang-cl
Reid Kleckner [Fri, 9 Sep 2016 16:42:50 +0000 (16:42 +0000)]
Make -fstandalone-debug and -flimit-debug-info available in clang-cl

Our limited debug info optimizations are breaking down at DLL
boundaries, so we're going to evaluate the size impact of these
settings, and possibly change the default.

Users should be able to override our settings, though.

llvm-svn: 281056

7 years ago[InstCombine] add tests to show pattern matching failures due to commutation
Sanjay Patel [Fri, 9 Sep 2016 16:35:20 +0000 (16:35 +0000)]
[InstCombine] add tests to show pattern matching failures due to commutation

I was looking to fix a bug in getComplexity(), and these cases showed up as
obvious failures. I'm not sure how to find these in general though.

llvm-svn: 281055

7 years agoAttempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.
Justin Lebar [Fri, 9 Sep 2016 16:29:13 +0000 (16:29 +0000)]
Attempt to fix static_asserts in SelectionDAGNodes.h that MSVC chokes on.

These were added in r281051, which, I am embarrassed to admit, has an
incomplete commit message that I forgot to update before pushing.  You
can ignore element (2) in that list.

llvm-svn: 281054