platform/upstream/llvm.git
7 years agoAMDGPU: Shift down reserved SP register like scratch wave offset
Matt Arsenault [Tue, 25 Apr 2017 23:40:57 +0000 (23:40 +0000)]
AMDGPU: Shift down reserved SP register like scratch wave offset

llvm-svn: 301367

7 years ago[DAG] fix formatting of isConstantSplat(); NFC
Sanjay Patel [Tue, 25 Apr 2017 23:33:28 +0000 (23:33 +0000)]
[DAG] fix formatting of isConstantSplat(); NFC

llvm-svn: 301366

7 years ago[clang-tidy] run-clang-tidy.py: check if clang-apply-replacements succeeds
Jakub Kuderski [Tue, 25 Apr 2017 22:38:39 +0000 (22:38 +0000)]
[clang-tidy] run-clang-tidy.py: check if clang-apply-replacements succeeds

Summary:
When running run-clang-tidy.py with -fix it tries to apply found replacements at the end.
If there are errors running clang-apply-replacements, the script currently crashes or displays no error at all.

This patch checks for errors running clang-apply-replacements the same way clang-tidy binary is handled.

Another option would be probably checking for clang-apply-replacements (when -fix is passed) even before running clang-tidy.

Reviewers: Prazek, alexfh, bkramer, mfherbst

Reviewed By: Prazek, alexfh

Subscribers: kimgr, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 301365

7 years ago[Hexagon] Handle -O4 when checking optimization level
Krzysztof Parzyszek [Tue, 25 Apr 2017 21:31:55 +0000 (21:31 +0000)]
[Hexagon] Handle -O4 when checking optimization level

llvm-svn: 301364

7 years agoAMDGPU: Clean up VOP3NoMods pattern
Matt Arsenault [Tue, 25 Apr 2017 21:17:38 +0000 (21:17 +0000)]
AMDGPU: Clean up VOP3NoMods pattern

There is no need to copy the operands or inspect the sources.
Also remove some unnecessary clamp/omod usage.

llvm-svn: 301363

7 years ago[x86] add more tests for potential change in bool math folding; NFC
Sanjay Patel [Tue, 25 Apr 2017 20:56:14 +0000 (20:56 +0000)]
[x86] add more tests for potential change in bool math folding; NFC

Also, use AVX2 to show a potential difference for 256-bit vectors.

llvm-svn: 301362

7 years ago[Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified
Krzysztof Parzyszek [Tue, 25 Apr 2017 20:51:51 +0000 (20:51 +0000)]
[Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified

llvm-svn: 301361

7 years agoAMDGPU: Fix ValueKind code object metadata for images
Konstantin Zhuravlyov [Tue, 25 Apr 2017 20:38:26 +0000 (20:38 +0000)]
AMDGPU: Fix ValueKind code object metadata for images

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

llvm-svn: 301360

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Tue, 25 Apr 2017 20:30:08 +0000 (20:30 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 301359

7 years ago[llvm-pdbdump] Allow sorting / filtering by immediate padding
Zachary Turner [Tue, 25 Apr 2017 20:22:29 +0000 (20:22 +0000)]
[llvm-pdbdump] Allow sorting / filtering by immediate padding

llvm-svn: 301358

7 years ago[llvm-pdbdump] Dump File / Line Info to YAML.
Zachary Turner [Tue, 25 Apr 2017 20:22:02 +0000 (20:22 +0000)]
[llvm-pdbdump] Dump File / Line Info to YAML.

We were already parsing and dumping this to the human readable
format, but not to the YAML format.  This does so, in preparation
for reading it in and reconstructing the line information from
YAML.

llvm-svn: 301357

7 years ago[StringExtras] Add a fromHex to complement toHex.
Zachary Turner [Tue, 25 Apr 2017 20:21:35 +0000 (20:21 +0000)]
[StringExtras] Add a fromHex to complement toHex.

We already have a function toHex that will convert a string like
"\xFF\xFF" to the string "FFFF", but we do not have one that goes
the other way - i.e. to convert a textual string representing a
sequence of hexadecimal characters into the corresponding actual
bytes.  This patch adds such a function.

llvm-svn: 301356

7 years agoAttempt to fix a Windows bot.
Rui Ueyama [Tue, 25 Apr 2017 19:55:28 +0000 (19:55 +0000)]
Attempt to fix a Windows bot.

Looks like `echo "{_start;};"` on lld-x86_64-win7 bot echoes `_start;;`
for some reason. I cannot reproduce the issue locally. I suspect that
it might be interpreting {<word>} in a special way. This patch is to
attempt to fix it by appending space characters.

llvm-svn: 301353

7 years agoSimplifyLibCalls: Fix crash on memset(notmalloc())
Matthias Braun [Tue, 25 Apr 2017 19:44:25 +0000 (19:44 +0000)]
SimplifyLibCalls: Fix crash on memset(notmalloc())

rdar://31520787

llvm-svn: 301352

7 years agoFix an assertion when skipping stack values in DWARF2 mode.
Adrian Prantl [Tue, 25 Apr 2017 19:40:53 +0000 (19:40 +0000)]
Fix an assertion when skipping stack values in DWARF2 mode.
The fix consists of resetting LocationKind when addMachineRegExpression fails.

rdar://problem/31803010

llvm-svn: 301351

7 years ago[builtins] Implement emulated TLS on Windows.
Frederich Munch [Tue, 25 Apr 2017 19:04:19 +0000 (19:04 +0000)]
[builtins] Implement emulated TLS on Windows.

Summary:
LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows.

Reviewers: chh, howard.hinnant

Reviewed By: chh

Subscribers: mgorny, llvm-commits

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

llvm-svn: 301350

7 years agoFix Hwloc API Incompatibility
Jonathan Peyton [Tue, 25 Apr 2017 19:04:07 +0000 (19:04 +0000)]
Fix Hwloc API Incompatibility

Older Hwloc libraries (< 1.10.0) don't offer the HWLOC_OBJ_NUMANODE nor
HWLOC_OBJ_PACKAGE types. Instead they are named HWLOC_OBJ_NODE and
HWLOC_OBJ_SOCKET instead. This patch just defines the newer names based on
the older names when using an older Hwloc.

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

llvm-svn: 301349

7 years agoMinor fix for distribute_parallel_for_num_threads_codegen on AARCH64
Carlo Bertolli [Tue, 25 Apr 2017 18:59:37 +0000 (18:59 +0000)]
Minor fix for distribute_parallel_for_num_threads_codegen on AARCH64

llvm-svn: 301348

7 years ago[llvm-objdump] Don't attempt to print lines beyond the end of file
Petr Hosek [Tue, 25 Apr 2017 18:56:33 +0000 (18:56 +0000)]
[llvm-objdump] Don't attempt to print lines beyond the end of file

This may trigger a segfault in llvm-objdump when the line number stored
in debug infromation points beyond the end of file; lines in LineBuffer
are stored in std::vector which is allocated in chunks, so even if the
debug info points beyond the end of the file, this doesn't necessarily
trigger the segfault unless the line number points beyond the allocated
space.

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

llvm-svn: 301347

7 years ago[Hexagon] Only increment debug counters if debug option is present
Krzysztof Parzyszek [Tue, 25 Apr 2017 18:56:14 +0000 (18:56 +0000)]
[Hexagon] Only increment debug counters if debug option is present

llvm-svn: 301346

7 years ago[LV] Make LIT test insensitive to basic block numbering
Gil Rapaport [Tue, 25 Apr 2017 18:14:24 +0000 (18:14 +0000)]
[LV] Make LIT test insensitive to basic block numbering

This patch is part of D28975's breakdown.

induction.ll encodes the specific (and rather arbitrary) numbers given to
predicated basic blocks by the unique naming mechanism, which makes it
sensitive to changes in LV's instruction generation order. This patch replaces
those specific numbers with a numeric pattern.

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

llvm-svn: 301345

7 years ago[PGO/tests] Update comment to reflect reality.
Davide Italiano [Tue, 25 Apr 2017 18:04:31 +0000 (18:04 +0000)]
[PGO/tests] Update comment to reflect reality.

llvm-svn: 301344

7 years agoSkip bitcasts while looking for GEP in LoadStoreVectorizer
Stanislav Mekhanoshin [Tue, 25 Apr 2017 18:00:08 +0000 (18:00 +0000)]
Skip bitcasts while looking for GEP in LoadStoreVectorizer

Differential Revisison: https://reviews.llvm.org/D32101

llvm-svn: 301343

7 years ago[X86][AVX2] Add shuffle test for PR27320 showing current codegen.
Simon Pilgrim [Tue, 25 Apr 2017 18:00:04 +0000 (18:00 +0000)]
[X86][AVX2] Add shuffle test for PR27320 showing current codegen.

llvm-svn: 301342

7 years ago[InstCombine] Remove redundant code from SimplifyUsingDistributiveLaws
Craig Topper [Tue, 25 Apr 2017 17:54:12 +0000 (17:54 +0000)]
[InstCombine] Remove redundant code from SimplifyUsingDistributiveLaws

The code I've removed here exists in ExpandBinOp in InstSimplify which we call into before SimplifyUsingDistributiveLaws. The code in InstSimplify looks to have been copied from here.

I verified this code doesn't fire on any lit tests. Not that that proves its definitely dead.

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

llvm-svn: 301341

7 years agoRecommit of
Carlo Bertolli [Tue, 25 Apr 2017 17:52:12 +0000 (17:52 +0000)]
Recommit of
[OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host

https://reviews.llvm.org/D29508

This patch makes the following additions:

It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation.
It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses.
It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code.

llvm-svn: 301340

7 years ago[PGO] Update test now that we don't call IndirectCallPromotion.
Davide Italiano [Tue, 25 Apr 2017 17:48:10 +0000 (17:48 +0000)]
[PGO] Update test now that we don't call IndirectCallPromotion.

llvm-svn: 301339

7 years ago[APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary...
Craig Topper [Tue, 25 Apr 2017 17:46:30 +0000 (17:46 +0000)]
[APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary APInts

This patch uses various APInt methods to reduce temporary APInt creation.

This should be all of the unrelated cleanups that got buried in D32376(creating a KnownBits struct) as well as some pointed out by Simon during the review of that. Plus a few improvements to use counting instead of masking.

I've left out any places where we do something like (KnownZero & KnownOne) != 0 as I plan to add a helper method to KnownBits to ask that question and didn't want to thrash that code an additional time.

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

llvm-svn: 301338

7 years ago[InstCombine] Fix CHECK-LABEL in two tests.
Craig Topper [Tue, 25 Apr 2017 17:40:58 +0000 (17:40 +0000)]
[InstCombine] Fix CHECK-LABEL in two tests.

llvm-svn: 301337

7 years agoMake it explicit that -export-dynamic overrides -dynamic-list and -export-dynamic...
Rui Ueyama [Tue, 25 Apr 2017 17:40:12 +0000 (17:40 +0000)]
Make it explicit that -export-dynamic overrides -dynamic-list and -export-dynamic-symbol.

No functionality change.

llvm-svn: 301336

7 years ago[lsan] When necessary, define LSan suppression for pthread_exit.
Alex Shlyapnikov [Tue, 25 Apr 2017 17:24:27 +0000 (17:24 +0000)]
[lsan] When necessary, define LSan suppression for pthread_exit.

Summary:
Generalize already defined LSan suppression for the leak on
pthread_exit, some envs do not have the entire call stack symbolized,
so we have to be less specific.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 301335

7 years ago[X86][SSE] Add tests for PR14657 showing current codegen.
Simon Pilgrim [Tue, 25 Apr 2017 17:22:34 +0000 (17:22 +0000)]
[X86][SSE] Add tests for PR14657 showing current codegen.

llvm-svn: 301334

7 years agoPrint complete DIExpressions in the assembler output DEBUG_VALUE comments.
Adrian Prantl [Tue, 25 Apr 2017 17:22:09 +0000 (17:22 +0000)]
Print complete DIExpressions in the assembler output DEBUG_VALUE comments.

The previous code was complex, incorrect, and couldn't print everything.

llvm-svn: 301333

7 years agoAdd a test for ICF and REL relocations.
Rui Ueyama [Tue, 25 Apr 2017 17:19:15 +0000 (17:19 +0000)]
Add a test for ICF and REL relocations.

llvm-svn: 301332

7 years ago[WebAssembly] Fix relocation count in wasm binaries with call_indirect
Sam Clegg [Tue, 25 Apr 2017 17:13:23 +0000 (17:13 +0000)]
[WebAssembly] Fix relocation count in wasm binaries with call_indirect

Subscribers: jfb, dschuff

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

llvm-svn: 301331

7 years ago[WebAssembly] Read global index in init expression as LEB
Sam Clegg [Tue, 25 Apr 2017 17:11:56 +0000 (17:11 +0000)]
[WebAssembly] Read global index in init expression as LEB

Subscribers: jfb, dschuff

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

llvm-svn: 301330

7 years ago[InstSimplify] Handle (~A & ~B) | (~A ^ B) -> ~A ^ B
Craig Topper [Tue, 25 Apr 2017 17:01:32 +0000 (17:01 +0000)]
[InstSimplify] Handle (~A & ~B) | (~A ^ B) -> ~A ^ B

The code Sanjay Patel moved over from InstCombine doesn't work properly if the 'and' has both inputs as nots because we used a commuted op matcher on the 'and' first. But this will bind to the first 'not' on 'and' when there could be two 'not's. InstCombine could rely on DeMorgan to ensure the 'and' wouldn't have two 'not's eventually, but InstSimplify can't rely on that.

This patch matches the xor first then checks for the ands and allows a not of either operand of the xor.

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

llvm-svn: 301329

7 years ago[libclang] Check for a record declaration before a template specialization
Alex Lorenz [Tue, 25 Apr 2017 16:59:07 +0000 (16:59 +0000)]
[libclang] Check for a record declaration before a template specialization

Fixes PR32539.

Patch by Emilio Cobos Álvarez!

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

llvm-svn: 301328

7 years ago[PM] Run IndirectCallPromotion only when PGO is enabled.
Davide Italiano [Tue, 25 Apr 2017 16:54:45 +0000 (16:54 +0000)]
[PM] Run IndirectCallPromotion only when PGO is enabled.

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

llvm-svn: 301327

7 years ago[InstCombine] Remove superfluous curly braces around a single line if body. NFC
Craig Topper [Tue, 25 Apr 2017 16:48:19 +0000 (16:48 +0000)]
[InstCombine] Remove superfluous curly braces around a single line if body. NFC

llvm-svn: 301326

7 years ago[ValueTracking] Use APInt::operator|=(uint64_t) instead of creating a temporary APInt...
Craig Topper [Tue, 25 Apr 2017 16:48:14 +0000 (16:48 +0000)]
[ValueTracking] Use APInt::operator|=(uint64_t) instead of creating a temporary APInt. NFC

llvm-svn: 301325

7 years ago[ValueTracking] Use APInt instead of auto. NFC
Craig Topper [Tue, 25 Apr 2017 16:48:09 +0000 (16:48 +0000)]
[ValueTracking] Use APInt instead of auto. NFC

This is a pre-commit for a patch I'm working on to turn KnownZero/One into a struct. Once I do that the type here will be less obvious.

llvm-svn: 301324

7 years ago[ValueTracking] Use BitWidth local variable instead of re-reading it from KnownZero...
Craig Topper [Tue, 25 Apr 2017 16:48:03 +0000 (16:48 +0000)]
[ValueTracking] Use BitWidth local variable instead of re-reading it from KnownZero. NFC

This is a pre-commit for a patch that I'm working on to merge KnownZero/KnownOne into a KnownBits struct which would have had to touch this line.

llvm-svn: 301323

7 years ago[SelectionDAG] Added getBuildVector(ArrayRef<SDUse>) helper.
Simon Pilgrim [Tue, 25 Apr 2017 16:41:28 +0000 (16:41 +0000)]
[SelectionDAG] Added getBuildVector(ArrayRef<SDUse>) helper.

llvm-svn: 301322

7 years ago[OpenMP] Optimized default kernel launch parameters in CUDA plugin
George Rokos [Tue, 25 Apr 2017 16:34:13 +0000 (16:34 +0000)]
[OpenMP] Optimized default kernel launch parameters in CUDA plugin

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

llvm-svn: 301321

7 years ago[DAGCombiner] Refactor to make it easy to add support for vectors in a future patch...
Simon Pilgrim [Tue, 25 Apr 2017 16:16:03 +0000 (16:16 +0000)]
[DAGCombiner] Refactor to make it easy to add support for vectors in a future patch. NFCI.

llvm-svn: 301320

7 years ago[ELF] Improve error message for incompatible section flags
Rui Ueyama [Tue, 25 Apr 2017 16:00:44 +0000 (16:00 +0000)]
[ELF] Improve error message for incompatible section flags

Previously we were not printing out the flags of the incompatible
section which made it difficult to determine what the problem was.

The error message format has been change to the following:

  error: incompatible section flags for .bar
  >>> /foo/bar/incompatible-section-flags.s.tmp.o:(.bar): 0x403
  >>> output section .bar: 0x3

Patch by Alexander Richardson.

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

llvm-svn: 301319

7 years ago[OpenMP] Add missing parenthesis which triggers a compile error
George Rokos [Tue, 25 Apr 2017 15:55:39 +0000 (15:55 +0000)]
[OpenMP] Add missing parenthesis which triggers a compile error

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

llvm-svn: 301318

7 years agoResubmit r301309: [DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.
Andrew Ng [Tue, 25 Apr 2017 15:39:57 +0000 (15:39 +0000)]
Resubmit r301309: [DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.

This patch reapplies r301309 with the fix to the MIR test to fix the assertion
triggered by r301309. Had trimmed a little bit too much from the MIR!

llvm-svn: 301317

7 years ago[InstCombine] Add missing commute handling to (A | B) & (B ^ (~A)) -> (A & B)
Craig Topper [Tue, 25 Apr 2017 15:19:04 +0000 (15:19 +0000)]
[InstCombine] Add missing commute handling to (A | B) & (B ^ (~A)) -> (A & B)

The matching here wasn't able to handle all the possible commutes. It always assumed the not would be on the left of the xor, but that's not guaranteed.

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

llvm-svn: 301316

7 years ago[index] Index type source info for class specializations
Alex Lorenz [Tue, 25 Apr 2017 15:13:42 +0000 (15:13 +0000)]
[index] Index type source info for class specializations

rdar://31758344

llvm-svn: 301315

7 years ago[SelectionDAG] Use getBuildVector helper where possible. NFCI
Simon Pilgrim [Tue, 25 Apr 2017 15:10:47 +0000 (15:10 +0000)]
[SelectionDAG] Use getBuildVector helper where possible. NFCI

llvm-svn: 301314

7 years ago[AVR] Support the LDWRdPtr instruction with the same Src+Dst register
Dylan McKay [Tue, 25 Apr 2017 15:09:04 +0000 (15:09 +0000)]
[AVR] Support the LDWRdPtr instruction with the same Src+Dst register

llvm-svn: 301313

7 years agoRevert "[DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler."
Andrew Ng [Tue, 25 Apr 2017 14:36:01 +0000 (14:36 +0000)]
Revert "[DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler."

This reverts commit r301309 which is causing buildbot assertion failures.

llvm-svn: 301312

7 years agoBring back the ability opt out of padding zero-byte functions by not providing a...
Daniel Sanders [Tue, 25 Apr 2017 14:27:27 +0000 (14:27 +0000)]
Bring back the ability opt out of padding zero-byte functions by not providing a nop instruction.

Summary: No test case since I'm not aware of an in-tree target that needs this.

Reviewers: hans

Subscribers: llvm-commits

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

llvm-svn: 301311

7 years ago[index] Record the 'SpecializationOf' relation for function specializations
Alex Lorenz [Tue, 25 Apr 2017 14:22:29 +0000 (14:22 +0000)]
[index] Record the 'SpecializationOf' relation for function specializations

rdar://31603531

llvm-svn: 301310

7 years ago[DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.
Andrew Ng [Tue, 25 Apr 2017 13:39:49 +0000 (13:39 +0000)]
[DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.

This patch fixes a bug with the updating of DBG_VALUE's in
BreakAntiDependencies. Previously, it would only attempt to update the first
DBG_VALUE following the instruction whose register is being changed,
potentially leaving DBG_VALUE's referring to the wrong register. Now the code
will update all DBG_VALUE's that immediately follow the instruction.

This issue was detected as a result of an optimized codegen difference with
"-g" where an X86 byte/word fixup was not performed due to a DBG_VALUE
referencing the wrong register.

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

llvm-svn: 301309

7 years ago[SelectionDAG] Pull out repeated getValueType calls. NFCI.
Simon Pilgrim [Tue, 25 Apr 2017 13:39:07 +0000 (13:39 +0000)]
[SelectionDAG] Pull out repeated getValueType calls. NFCI.

Noticed in D32391.

llvm-svn: 301308

7 years ago[Compiler-rt][MIPS] Fix assert introduce with commit rl301171.
Nitesh Jain [Tue, 25 Apr 2017 13:25:40 +0000 (13:25 +0000)]
[Compiler-rt][MIPS] Fix assert introduce with commit rl301171.

llvm-svn: 301307

7 years agoRemove the home-grown android toolchain file and all references to it
Pavel Labath [Tue, 25 Apr 2017 12:58:49 +0000 (12:58 +0000)]
Remove the home-grown android toolchain file and all references to it

Summary:
The toolchain file has been deprecated in favor of the "official"
toolchain file present in the Android NDK. Also update the web
build instructions to reflect this.

Reviewers: eugene

Subscribers: srhines, mgorny, dgross, tberghammer, lldb-commits

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

llvm-svn: 301306

7 years ago[DAGCombiner] Add vector support for (srl (trunc (srl x, c1)), c2) combine.
Simon Pilgrim [Tue, 25 Apr 2017 12:40:45 +0000 (12:40 +0000)]
[DAGCombiner] Add vector support for (srl (trunc (srl x, c1)), c2) combine.

llvm-svn: 301305

7 years ago[SimplifyLibCalls] Fix infinite loop with fast-math optimization.
Andrew Ng [Tue, 25 Apr 2017 12:36:14 +0000 (12:36 +0000)]
[SimplifyLibCalls] Fix infinite loop with fast-math optimization.

One of the fast-math optimizations is to replace calls to standard double
functions with their float equivalents, e.g. exp -> expf. However, this can
cause infinite loops for the following:

  float expf(float val) { return (float) exp((double) val); }

A similar inline declaration exists in the MinGW-w64 math.h header file which
when compiled with -O2/3 and fast-math generates infinite loops.

So this fix checks that the calling function to the standard double function
that is being replaced does not match the float equivalent.

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

llvm-svn: 301304

7 years ago[SelectionDAG] Recognise splat vector isKnownToBeAPowerOfTwo one/sign bit shift cases.
Simon Pilgrim [Tue, 25 Apr 2017 12:29:07 +0000 (12:29 +0000)]
[SelectionDAG] Recognise splat vector isKnownToBeAPowerOfTwo one/sign bit shift cases.

llvm-svn: 301303

7 years agoFix fuzzer.c test on platforms where CLANG_DEFAULT_CXX_STDLIB is libc++
Ismail Donmez [Tue, 25 Apr 2017 11:24:14 +0000 (11:24 +0000)]
Fix fuzzer.c test on platforms where CLANG_DEFAULT_CXX_STDLIB is libc++

llvm-svn: 301302

7 years ago[DeLICM] Use Known information when comparing Existing.Occupied and Proposed.Occupied.
Michael Kruse [Tue, 25 Apr 2017 10:57:32 +0000 (10:57 +0000)]
[DeLICM] Use Known information when comparing Existing.Occupied and Proposed.Occupied.

Do not conflict if the value of Existing and Proposed are the same.

This change only affects unit tests, but no functional changes are
expected on LLVM-IR, as no Known information is yet extracted and
consequently this functionality is only triggered through unit tests.

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

llvm-svn: 301301

7 years ago[DAGCombiner] Use SDValue::getConstantOperandVal helper where possible. NFCI.
Simon Pilgrim [Tue, 25 Apr 2017 10:47:35 +0000 (10:47 +0000)]
[DAGCombiner] Use SDValue::getConstantOperandVal helper where possible. NFCI.

llvm-svn: 301300

7 years ago[PPCGCodeGeneration] Update PPCG Code Generation for OpenCL compatibility
Siddharth Bhat [Tue, 25 Apr 2017 08:08:29 +0000 (08:08 +0000)]
[PPCGCodeGeneration] Update PPCG Code Generation for OpenCL compatibility

Added a small change to the way pointer arguments are set in the kernel
code generation. The way the pointer is retrieved now, specifically requests
global address space to be annotated. This is necessary, if the IR should be
run through NVPTX to generate OpenCL compatible PTX.

The changes do not affect the PTX Strings generated for the CUDA target
(nvptx64-nvidia-cuda), but are necessary for OpenCL (nvptx64-nvidia-nvcl).

Additionally, the data layout has been updated to what the NVPTX Backend requests/recommends.

Contributed-by: Philipp Schaad
Reviewers: Meinersbur, grosser, bollu

Reviewed By: grosser, bollu

Subscribers: jlebar, pollydev, llvm-commits, nemanjai, yaxunl, Anastasia

Tags: #polly

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

llvm-svn: 301299

7 years ago[IVUsers] Don't bail out of normalizing non-affine add recs
Sanjoy Das [Tue, 25 Apr 2017 06:53:25 +0000 (06:53 +0000)]
[IVUsers] Don't bail out of normalizing non-affine add recs

Summary:
In a previous change I changed SCEV's normalization / denormalization
to work with non-affine add recs.  So the bailout in IVUsers can be
removed.

Reviewers: atrick, efriedma

Reviewed By: atrick

Subscribers: davide, mcrosier, llvm-commits

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

llvm-svn: 301298

7 years ago[InstCombine] Add test cases for missing commute handling in ((A ^ C) ^ B) & (B ...
Craig Topper [Tue, 25 Apr 2017 06:47:49 +0000 (06:47 +0000)]
[InstCombine] Add test cases for missing commute handling in ((A ^ C) ^ B) & (B ^ A) -> (B ^ A) & ~C

llvm-svn: 301297

7 years ago[InstCombine] Add test cases showing failures to handle commuted patterns after trick...
Craig Topper [Tue, 25 Apr 2017 06:22:17 +0000 (06:22 +0000)]
[InstCombine] Add test cases showing failures to handle commuted patterns after tricking the operand complexity sorting.

llvm-svn: 301296

7 years ago[LLDB][MIPS] Fix typo in TestStepOverWatchpoint.py.
Nitesh Jain [Tue, 25 Apr 2017 06:12:59 +0000 (06:12 +0000)]
[LLDB][MIPS] Fix typo in TestStepOverWatchpoint.py.

Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 301295

7 years ago[InstCombine] Use commutable matchers to reduce some code. NFC
Craig Topper [Tue, 25 Apr 2017 06:02:11 +0000 (06:02 +0000)]
[InstCombine] Use commutable matchers to reduce some code. NFC

llvm-svn: 301294

7 years ago[LV] Remove redundant basic block split
Gil Rapaport [Tue, 25 Apr 2017 05:57:22 +0000 (05:57 +0000)]
[LV] Remove redundant basic block split

This patch is part of D28975's breakdown.

Genreating the control-flow to guard predicated instructions modified to
only use SplitBlockAndInsertIfThen() for producing the if-then construct.

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

llvm-svn: 301293

7 years agoUpdate doc of the variadic version of getOrInsertFunction
Serge Guelton [Tue, 25 Apr 2017 05:45:37 +0000 (05:45 +0000)]
Update doc of the variadic version of getOrInsertFunction

It no longer needs a null terminator.

llvm-svn: 301292

7 years ago[CodeExtractor]: Fixup use refs of the old phi.
Xinliang David Li [Tue, 25 Apr 2017 04:51:19 +0000 (04:51 +0000)]
[CodeExtractor]: Fixup use refs of the old phi.

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

llvm-svn: 301291

7 years agoDefine __tls_get_addr as a hidden symbol even for ARM or MIPS.
Rui Ueyama [Tue, 25 Apr 2017 04:44:54 +0000 (04:44 +0000)]
Define __tls_get_addr as a hidden symbol even for ARM or MIPS.

addIgnored defines a given symbol even if there is no existing
symbol with the same name. So, even if libc provides __tls_get_addr,
we should still be able to call addIgnored.

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

llvm-svn: 301290

7 years ago[ObjCARC] Do not sink an objc_retain past a clang.arc.use.
Akira Hatanaka [Tue, 25 Apr 2017 04:06:35 +0000 (04:06 +0000)]
[ObjCARC] Do not sink an objc_retain past a clang.arc.use.

We need to do this to prevent a miscompile which sinks an objc_retain
past an objc_release that releases the object objc_retain retains. This
happens because the top-down and bottom-up traversals each determines
the insert point for retain or release individually without knowing
where the other instruction is moved.

For example, when the following IR is fed to the ARC optimizer, the
top-down traversal decides to insert objc_retain right before
objc_release and the bottom-up traversal decides to insert objc_release
right after clang.arc.use.

(IR before ARC optimizer)
%11 = call i8* @objc_retain(i8* %10)
call void (...) @clang.arc.use(%0* %5)
call void @llvm.dbg.value(...)
call void @objc_release(i8* %6)

This reverses the order of objc_release and objc_retain, which causes
the object to be destructed prematurely.

(IR after ARC optimizer)
call void (...) @clang.arc.use(%0* %5)
call void @objc_release(i8* %6)
call void @llvm.dbg.value(...)
%11 = call i8* @objc_retain(i8* %10)

rdar://problem/30530580

llvm-svn: 301289

7 years ago[SimplifyLibCalls] Remove a cl::opt that's been `true` for a long time.
Davide Italiano [Tue, 25 Apr 2017 03:48:47 +0000 (03:48 +0000)]
[SimplifyLibCalls] Remove a cl::opt that's been `true` for a long time.

llvm-svn: 301288

7 years agoAdd comments about Widnows .reloc section.
Rui Ueyama [Tue, 25 Apr 2017 03:31:10 +0000 (03:31 +0000)]
Add comments about Widnows .reloc section.

llvm-svn: 301287

7 years agoDo not create temporary files in the main source tree.
Rui Ueyama [Tue, 25 Apr 2017 03:30:50 +0000 (03:30 +0000)]
Do not create temporary files in the main source tree.

llvm-svn: 301286

7 years agoPlacate MSVC's narrowing conversion unhappiness.
Richard Smith [Tue, 25 Apr 2017 00:40:40 +0000 (00:40 +0000)]
Placate MSVC's narrowing conversion unhappiness.

llvm-svn: 301285

7 years ago[unittests] Derive Occupied from Unused when given.
Michael Kruse [Tue, 25 Apr 2017 00:30:42 +0000 (00:30 +0000)]
[unittests] Derive Occupied from Unused when given.

When both, OccupiedAndKnown and Unused are given, use the former only
for the Known values. The relation Unused \union Occupied must always
hold.

This allows us to specify Known independently of Occupied. It is needed
for an artificial test case in https://reviews.llvm.org/D32025.

llvm-svn: 301284

7 years ago[unittests] Add postcondition to completeLifetime.
Michael Kruse [Tue, 25 Apr 2017 00:30:32 +0000 (00:30 +0000)]
[unittests] Add postcondition to completeLifetime.

llvm-svn: 301283

7 years agoExport __progname even if a -dynamic-list is given.
Rui Ueyama [Tue, 25 Apr 2017 00:15:48 +0000 (00:15 +0000)]
Export __progname even if a -dynamic-list is given.

BSD's __progname symbol is defined in crt1.o and linked against main
executables. The libc expects that main executables export __progname
symbol via .dynsym sections. In order to handle this case, we scan
undefined symbols in DSOs and exported them by setting Sym->ExportDynamic
to true.

But it turned out that setting that variable is not enough to make sure
that symbols are exported in all use cases. If a -dynamic-list option is
given, all symbols not explicitly mentioned in a version script are
hidden by default. That hides __progname symbol. This patch fixes the issue.

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

llvm-svn: 301282

7 years agoTeach SCEV normalization to de/normalize non-affine add recs
Sanjoy Das [Tue, 25 Apr 2017 00:09:19 +0000 (00:09 +0000)]
Teach SCEV normalization to de/normalize non-affine add recs

Summary:
Before this change, SCEV Normalization would incorrectly normalize
non-affine add recurrences.  To work around this there was (still is)
a check in place to make sure we only tried to normalize affine add
recurrences.

We recently found a bug in aforementioned check to bail out of
normalizing non-affine add recurrences.  However, instead of fixing
the bailout, I have decided to teach SCEV normalization to work
correctly with non-affine add recurrences, making the bailout
unnecessary (I'll remove it in a subsequent change).

I've also added some unit tests (which would have failed before this
change).

Reviewers: atrick, sunfish, efriedma

Reviewed By: atrick

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

llvm-svn: 301281

7 years agoName the C++ source files for two tests correctly.
Sean Callanan [Mon, 24 Apr 2017 23:58:36 +0000 (23:58 +0000)]
Name the C++ source files for two tests correctly.

llvm-svn: 301280

7 years agoReplace a binary .so with a text .s.
Rui Ueyama [Mon, 24 Apr 2017 23:51:18 +0000 (23:51 +0000)]
Replace a binary .so with a text .s.

Since LLD is now able to take version scripts, we no longer
have to keep a pre-generated binary file for a test.

llvm-svn: 301279

7 years agoRemove a useless temporary variable.
Rui Ueyama [Mon, 24 Apr 2017 23:50:58 +0000 (23:50 +0000)]
Remove a useless temporary variable.

llvm-svn: 301278

7 years agoFixed two bad Makefiles that might be breaking Linux.
Sean Callanan [Mon, 24 Apr 2017 23:49:06 +0000 (23:49 +0000)]
Fixed two bad Makefiles that might be breaking Linux.

llvm-svn: 301277

7 years agoInferAddressSpaces: Use reference arguments instead of pointers
Matt Arsenault [Mon, 24 Apr 2017 23:42:41 +0000 (23:42 +0000)]
InferAddressSpaces: Use reference arguments instead of pointers

llvm-svn: 301276

7 years ago[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Mon, 24 Apr 2017 23:21:38 +0000 (23:21 +0000)]
[Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 301275

7 years agoRevert r301089 "[builtins] Implement emulated TLS on Windows."
Hans Wennborg [Mon, 24 Apr 2017 23:16:49 +0000 (23:16 +0000)]
Revert r301089 "[builtins] Implement emulated TLS on Windows."

This broke the self-host build on Windows (PR32777).

Original commit message:

> [builtins] Implement emulated TLS on Windows.
>
> Summary:
> LLVM JIT needs to be able to use emulated TLS on all platforms, and this provides a reference one can compile to enable emutls for Linux/Mac/Windows.
>
> Reviewers: chh, howard.hinnant
>
> Reviewed By: chh
>
> Subscribers: mgorny, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D30787

llvm-svn: 301274

7 years ago[Expression parser] Return both types and variables
Sean Callanan [Mon, 24 Apr 2017 23:14:04 +0000 (23:14 +0000)]
[Expression parser] Return both types and variables

Many times a user wants to access a type when there's a variable of
the same name, or a variable when there's a type of the same name.
Depending on the precise context, currently the expression parser
can fail to resolve one or the other.

This is because ClangExpressionDeclMap has logic to limit the
amount of information it searches, and that logic sometimes cuts
down the search prematurely. This patch removes some of those early
exits.

In that sense, this patch trades performance (early exit is faster)
for correctness.

I've also included two new test cases showing examples of this
behavior – as well as modifying an existing test case that gets it
wrong.

llvm-svn: 301273

7 years ago[asan] Fix Windows global dead stripping tests
Reid Kleckner [Mon, 24 Apr 2017 23:13:47 +0000 (23:13 +0000)]
[asan] Fix Windows global dead stripping tests

Pass /Gw to clang-cl which is equivalent to -fdata-sections. This is now
necessary.

llvm-svn: 301272

7 years ago[modules ts] Diagnose 'export' declarations outside of a module interface.
Richard Smith [Mon, 24 Apr 2017 23:12:30 +0000 (23:12 +0000)]
[modules ts] Diagnose 'export' declarations outside of a module interface.

llvm-svn: 301271

7 years agoInferAddressSpaces: Remove redundant assert
Matt Arsenault [Mon, 24 Apr 2017 23:02:57 +0000 (23:02 +0000)]
InferAddressSpaces: Remove redundant assert

This is just asserting all the operations are handled in the
switch, which the unreachable already handles.

llvm-svn: 301270

7 years ago[ARM, x86] add more vector tests for bool math; NFC
Sanjay Patel [Mon, 24 Apr 2017 22:42:34 +0000 (22:42 +0000)]
[ARM, x86] add more vector tests for bool math; NFC

I'm proposing a fold for increment-of-sexted-bool in:
https://reviews.llvm.org/D31944
...so we need to know what happens in more cases like these.

llvm-svn: 301269

7 years ago[git-llvm] Remove CR from middle of svn propget output
Reid Kleckner [Mon, 24 Apr 2017 22:26:46 +0000 (22:26 +0000)]
[git-llvm] Remove CR from middle of svn propget output

llvm-svn: 301268

7 years agoMake getSlotAttributes return an AttributeSet instead of a wrapper list
Reid Kleckner [Mon, 24 Apr 2017 22:25:02 +0000 (22:25 +0000)]
Make getSlotAttributes return an AttributeSet instead of a wrapper list

Remove the temporary, poorly named getSlotSet method which did the same
thing. Also remove getSlotNode, which is a hold-over from when we were
dealing with AttributeSetNode* instead of AttributeSet.

llvm-svn: 301267

7 years ago[Polly] [DependenceInfo] change WAR generation, Read will not block Read
Siddharth Bhat [Mon, 24 Apr 2017 22:23:12 +0000 (22:23 +0000)]
[Polly] [DependenceInfo] change WAR generation, Read will not block Read

Earlier, the call to buildFlow was:
    WAR = buildFlow(Write, Read, MustWrite, Schedule).

This meant that Read could block another Read, since must-sources can
block each other.

Fixed the call to buildFlow to correctly compute Read. The resulting
code needs to do some ISL juggling to get the output we want.

Bug report: https://bugs.llvm.org/show_bug.cgi?id=32623

Reviewers: Meinersbur

Tags: #polly

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

llvm-svn: 301266