platform/upstream/llvm.git
7 years agoMake convertToUnixPathSeparator return a new string instead of mutating argument.
Rui Ueyama [Wed, 7 Dec 2016 20:22:27 +0000 (20:22 +0000)]
Make convertToUnixPathSeparator return a new string instead of mutating argument.

llvm-svn: 288972

7 years agoSimplify. NFC.
Rafael Espindola [Wed, 7 Dec 2016 20:20:39 +0000 (20:20 +0000)]
Simplify. NFC.

llvm-svn: 288971

7 years agoUse the correct MaxPageSize.
Rafael Espindola [Wed, 7 Dec 2016 20:10:43 +0000 (20:10 +0000)]
Use the correct MaxPageSize.

Found by inspection.

llvm-svn: 288970

7 years ago[change-namespace] always add a '::' prefix when a symbol reference needs to be fully...
Eric Liu [Wed, 7 Dec 2016 20:08:02 +0000 (20:08 +0000)]
[change-namespace] always add a '::' prefix when a symbol reference needs to be fully-qualified.

llvm-svn: 288969

7 years ago[GVNHoist] Invalidate MemDep when an instruction is moved.
Eli Friedman [Wed, 7 Dec 2016 19:55:59 +0000 (19:55 +0000)]
[GVNHoist] Invalidate MemDep when an instruction is moved.

See also r279907.

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

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

llvm-svn: 288968

7 years agoFormat. NFC.
George Rimar [Wed, 7 Dec 2016 19:44:27 +0000 (19:44 +0000)]
Format. NFC.

llvm-svn: 288967

7 years ago[ELF] - Print absolute file name in errors when possible.
George Rimar [Wed, 7 Dec 2016 19:42:25 +0000 (19:42 +0000)]
[ELF] - Print absolute file name in errors when possible.

Currently LLD prints basename of source file name in error messages,
for example:
$ mkdir foo
$ echo 'void _start(void) { foobar(); }' > foo/bar.c
$ gcc -g -c foo/bar.c
$ bin/ld.lld -o out bar.o
bin/ld.lld: error: bar.c:1: undefined symbol 'foobar'
$
This should say:
bin/ld.lld: error: foo/bar.c:1: undefined symbol 'foobar'

This is PR31299

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

llvm-svn: 288966

7 years ago[X86] Skip over DEBUG_VALUE while looking for start of call sequence
Michael Kuperstein [Wed, 7 Dec 2016 19:31:08 +0000 (19:31 +0000)]
[X86] Skip over DEBUG_VALUE while looking for start of call sequence

If we don't skip over DEBUG_VALUEs, we get differences between -g and non-g
code.

This fixes PR31242.

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

llvm-svn: 288965

7 years ago[X86] Do not assume "ri" instructions always have an immediate operand
Michael Kuperstein [Wed, 7 Dec 2016 19:29:18 +0000 (19:29 +0000)]
[X86] Do not assume "ri" instructions always have an immediate operand

The second operand of an "ri" instruction may be an immediate, but it may
also be a globalvariable, so we should make any assumptions.

This fixes PR31271.

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

llvm-svn: 288964

7 years agoFix the apple build issue caused by r288956
Chris Bieneman [Wed, 7 Dec 2016 19:28:22 +0000 (19:28 +0000)]
Fix the apple build issue caused by r288956

Should be checking if HAVE_CRASHREPORTERCLIENT_H is defined not relying on it having a value.

llvm-svn: 288963

7 years ago[CUDA] Improve target attribute checking for function templates.
Artem Belevich [Wed, 7 Dec 2016 19:27:16 +0000 (19:27 +0000)]
[CUDA] Improve target attribute checking for function templates.

* __host__ __device__ functions are no longer considered to be
  redeclarations of __host__ or __device__ functions. This prevents
  unintentional merging of target attributes across them.
* Function target attributes are not considered (and must match) during
  explicit instantiation and specialization of function templates.

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

llvm-svn: 288962

7 years agoRevert "[CMake] Use cmakedefine01 instead of cmakedefine"
Chris Bieneman [Wed, 7 Dec 2016 19:25:38 +0000 (19:25 +0000)]
Revert "[CMake] Use cmakedefine01 instead of cmakedefine"

This reverts commit r288959.

Apparently using cmakedefine01 explodes.

llvm-svn: 288961

7 years ago[builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod
Weiming Zhao [Wed, 7 Dec 2016 19:14:29 +0000 (19:14 +0000)]
[builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod

Summary:
For idivsi3, convert the Thumb2 only instruction to thumb1.
For aeabi_idivmod, using __divsi3.

Reviewers: rengolin, compnerd

Subscribers: llvm-commits

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

llvm-svn: 288960

7 years ago[CMake] Use cmakedefine01 instead of cmakedefine
Chris Bieneman [Wed, 7 Dec 2016 19:13:32 +0000 (19:13 +0000)]
[CMake] Use cmakedefine01 instead of cmakedefine

Looks like we need a 01 value for HAVE_CRASHREPORTERCLIENT_H.

llvm-svn: 288959

7 years ago[InstCombine] add tests for smin+icmp; NFC
Sanjay Patel [Wed, 7 Dec 2016 18:56:55 +0000 (18:56 +0000)]
[InstCombine] add tests for smin+icmp; NFC

The tests that already work are folded in InstSimplify, so those
tests should be redundant and we can remove them if they don't
seem worthwhile for completeness.

llvm-svn: 288957

7 years ago[CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H
Chris Bieneman [Wed, 7 Dec 2016 18:53:04 +0000 (18:53 +0000)]
[CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H

The CMake build has been hardcoding this to undef forever, we shouldn't have been doing that.

llvm-svn: 288956

7 years ago[ObjectYAML] Support for DWARF __debug_abbrev section
Chris Bieneman [Wed, 7 Dec 2016 18:52:59 +0000 (18:52 +0000)]
[ObjectYAML] Support for DWARF __debug_abbrev section

This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools.

llvm-svn: 288955

7 years ago[builtin] for the condition for check __ARM_FEATURE_CLZ
Weiming Zhao [Wed, 7 Dec 2016 18:41:07 +0000 (18:41 +0000)]
[builtin] for the condition for check __ARM_FEATURE_CLZ

Summary: Since CLZ is not available for Thumb1, we use __ARM_ARCH_ISA_THUMB != 1 as one of the conditions.

Reviewers: rnk, compnerd, rengolin

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 288954

7 years ago[asan] Disable yet another unstable test under AArch64
Renato Golin [Wed, 7 Dec 2016 18:37:49 +0000 (18:37 +0000)]
[asan] Disable yet another unstable test under AArch64

llvm-svn: 288953

7 years ago[SelectionDAG] Add knownbits support for vector demandedelts in SMAX/SMIN/UMAX/UMIN...
Simon Pilgrim [Wed, 7 Dec 2016 17:54:00 +0000 (17:54 +0000)]
[SelectionDAG] Add knownbits support for vector demandedelts in SMAX/SMIN/UMAX/UMIN opcodes

llvm-svn: 288926

7 years agoAdd unittests for foreach(Elt|Piece). NFC.
Michael Kruse [Wed, 7 Dec 2016 17:48:02 +0000 (17:48 +0000)]
Add unittests for foreach(Elt|Piece). NFC.

llvm-svn: 288925

7 years agoAdd more ISL foreachElt functions. NFC.
Michael Kruse [Wed, 7 Dec 2016 17:47:57 +0000 (17:47 +0000)]
Add more ISL foreachElt functions. NFC.

Add and implement foreachElt for isl_map, isl_set and isl_union_set. These are
used by an out-of-tree patch which is in process of being upstreamed.

llvm-svn: 288924

7 years ago[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator
Malcolm Parsons [Wed, 7 Dec 2016 17:39:04 +0000 (17:39 +0000)]
[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator

Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith

Subscribers: cfe-commits

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

llvm-svn: 288923

7 years ago[analyzer] Fix typo in nullability checker diagnostic
Devin Coughlin [Wed, 7 Dec 2016 17:36:27 +0000 (17:36 +0000)]
[analyzer] Fix typo in nullability checker diagnostic

'infered' --> 'inferred'

llvm-svn: 288922

7 years agoELF/AArch64: Refactor R_AARCH64_LDST{8,15,32,64,128}_ABS_LO12_NC Relocations
Adhemerval Zanella [Wed, 7 Dec 2016 17:31:48 +0000 (17:31 +0000)]
ELF/AArch64: Refactor R_AARCH64_LDST{8,15,32,64,128}_ABS_LO12_NC Relocations

This patch refactor how to apply the R_AARCH64_LDST{8,16,32,64,128}_ABS_NC
relocations by adding a new function to correct extract the bits expected
by each relocation.  This make is explicit which are the bits range expected
and simplify the code to mask and shift the deriable values.

It also fixes the R_AARCH64_LDST128_ABS_LO12_NC mask, although in pratice
the mask/shift always returns a 16 bytes aligned value.

Checked on AArch64 and with test-suite.

llvm-svn: 288921

7 years ago[X86] Add knownbits vector UMAX test
Simon Pilgrim [Wed, 7 Dec 2016 17:21:13 +0000 (17:21 +0000)]
[X86] Add knownbits vector UMAX test

In preparation for demandedelts support

llvm-svn: 288920

7 years ago[change-namespace] don't fix using shadow decls in classes.
Eric Liu [Wed, 7 Dec 2016 17:04:07 +0000 (17:04 +0000)]
[change-namespace] don't fix using shadow decls in classes.

Summary:
Using shadow declarations in classes always refers to base class, which does not
need to be fixed/qualified since it can be inferred from inheritance.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 288919

7 years ago[X86][SSE] Remove AND -> VZEXT combine
Simon Pilgrim [Wed, 7 Dec 2016 17:02:41 +0000 (17:02 +0000)]
[X86][SSE] Remove AND -> VZEXT combine

This is now performed more generally by the target shuffle combine code.

Already covered by tests that were originally added in D7666/rL229480 to support combineVectorZext (or VectorZextCombine as it was known then....).

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

llvm-svn: 288918

7 years ago[analyzer] Remove an unused enum value in RetainCountChecker.
Artem Dergachev [Wed, 7 Dec 2016 16:51:54 +0000 (16:51 +0000)]
[analyzer] Remove an unused enum value in RetainCountChecker.

No functional change intended.

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

llvm-svn: 288917

7 years ago[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes
Simon Pilgrim [Wed, 7 Dec 2016 16:28:21 +0000 (16:28 +0000)]
[SelectionDAG] Add knownbits support for EXTRACT_VECTOR_ELT opcodes

llvm-svn: 288916

7 years agoAdd IslPtr type traits. NFC.
Michael Kruse [Wed, 7 Dec 2016 16:17:59 +0000 (16:17 +0000)]
Add IslPtr type traits. NFC.

Add traits for isl_id and isl_multi_aff, required by out-of-tree patches
currently in progress of upstreaming.

isl_union_pw_aff_dump has been added to ISL during one of the last ISL
updates, such that we can also enable its dump() trait.

llvm-svn: 288915

7 years ago[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.
Artem Dergachev [Wed, 7 Dec 2016 16:12:26 +0000 (16:12 +0000)]
[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.

Avoids a crash and a related false positive.

Investigation by Daniel Krupp!

llvm-svn: 288914

7 years ago[SelectionDAG] Removed old knownbits TODO comment. NFCI.
Simon Pilgrim [Wed, 7 Dec 2016 15:31:12 +0000 (15:31 +0000)]
[SelectionDAG] Removed old knownbits TODO comment. NFCI.

EXTRACT_VECTOR_ELT does support demanded elts if the element index is known and in range.

llvm-svn: 288913

7 years ago[X86] Add test to show missed opportunities to calculate knownbits in INSERT_VECTOR_ELT
Simon Pilgrim [Wed, 7 Dec 2016 15:27:18 +0000 (15:27 +0000)]
[X86] Add test to show missed opportunities to calculate knownbits in INSERT_VECTOR_ELT

llvm-svn: 288912

7 years ago[X86][SSE] Fix vpextrd/vpextrq checks
Simon Pilgrim [Wed, 7 Dec 2016 15:10:05 +0000 (15:10 +0000)]
[X86][SSE] Fix vpextrd/vpextrq checks

They were testing for the pre-vex versions

llvm-svn: 288911

7 years ago[X86][SSE] Force execution domain of 32-bit extractps/pextrd in the stack folding...
Simon Pilgrim [Wed, 7 Dec 2016 15:06:14 +0000 (15:06 +0000)]
[X86][SSE] Force execution domain of 32-bit extractps/pextrd in the stack folding tests

llvm-svn: 288910

7 years ago[LV] Scalarize operands of predicated instructions
Matthew Simpson [Wed, 7 Dec 2016 15:03:32 +0000 (15:03 +0000)]
[LV] Scalarize operands of predicated instructions

This patch attempts to scalarize the operand expressions of predicated
instructions if they were conditionally executed in the original loop. After
scalarization, the expressions will be sunk inside the blocks created for the
predicated instructions. The transformation essentially performs
un-if-conversion on the operands.

The cost model has been updated to determine if scalarization is profitable. It
compares the cost of a vectorized instruction, assuming it will be
if-converted, to the cost of the scalarized instruction, assuming that the
instructions corresponding to each vector lane will be sunk inside a predicated
block, possibly avoiding execution. If it's more profitable to scalarize the
entire expression tree feeding the predicated instruction, the expression will
be scalarized; otherwise, it will be vectorized. We only consider the cost of
the entire expression to accurately estimate the cost of the required
insertelement and extractelement instructions.

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

llvm-svn: 288909

7 years ago[change-namespace] move template class forward-declarations and don't move fwd-decls...
Eric Liu [Wed, 7 Dec 2016 14:20:52 +0000 (14:20 +0000)]
[change-namespace] move template class forward-declarations and don't move fwd-decls in classes.

Summary:
Forward declarations in moved namespaces should be moved back to the old
namespaces. We should also move template class forward declarations.

Also fix a bug that moves forward declarations of nested classes.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 288908

7 years agoTry unbreaking the MSVC build.
Benjamin Kramer [Wed, 7 Dec 2016 13:35:11 +0000 (13:35 +0000)]
Try unbreaking the MSVC build.

llvm-svn: 288907

7 years ago[X86][SSE] Regenerate test.
Simon Pilgrim [Wed, 7 Dec 2016 13:05:04 +0000 (13:05 +0000)]
[X86][SSE] Regenerate test.

llvm-svn: 288906

7 years ago[AVR] Expand 'SELECT_CC' nodes whereever possible
Dylan McKay [Wed, 7 Dec 2016 12:34:47 +0000 (12:34 +0000)]
[AVR] Expand 'SELECT_CC' nodes whereever possible

llvm-svn: 288905

7 years ago[LowerTypeTests] Use the TrailingObjects infrastructure for trailing objects.
Benjamin Kramer [Wed, 7 Dec 2016 12:31:45 +0000 (12:31 +0000)]
[LowerTypeTests] Use the TrailingObjects infrastructure for trailing objects.

Also avoid allocating ~3x as much memory as needed.

llvm-svn: 288904

7 years agoWhen GVN removes a redundant load, it should not modify the debug location of the...
Andrea Di Biagio [Wed, 7 Dec 2016 12:31:36 +0000 (12:31 +0000)]
When GVN removes a redundant load, it should not modify the debug location of the dominating load.

In the case of a fully redundant load LI dominated by an equivalent load V, GVN
should always preserve the original debug location of V. Otherwise, we risk to
introduce an incorrect stepping.
If V has debug info, then clearly it should not be modified. If V has a null
debugloc, then it is still potentially incorrect to propagate LI's debugloc
because LI may not post-dominate V.

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

llvm-svn: 288903

7 years ago[X86][SSE] Consistently set MOVD/MOVQ load/store/move instructions to integer domain
Simon Pilgrim [Wed, 7 Dec 2016 12:10:49 +0000 (12:10 +0000)]
[X86][SSE] Consistently set MOVD/MOVQ load/store/move instructions to integer domain

We are being inconsistent with these instructions (and all their variants.....) with a random mix of them using the default float domain.

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

llvm-svn: 288902

7 years ago[InlineFunction] Refactor code in function `fixupLineNumbers' as suggested by David...
Andrea Di Biagio [Wed, 7 Dec 2016 12:01:45 +0000 (12:01 +0000)]
[InlineFunction] Refactor code in function `fixupLineNumbers' as suggested by David in D27462. NFC

llvm-svn: 288901

7 years ago[mips][rtdyld] Merge code to write relocated values to the section. NFC
Simon Dardis [Wed, 7 Dec 2016 11:41:23 +0000 (11:41 +0000)]
[mips][rtdyld] Merge code to write relocated values to the section. NFC

Preparation work for implementing N32 support.

Patch By: Daniel Sanders

Reviewers: vkalintiris, atanasyan

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

llvm-svn: 288900

7 years ago[AVR] Move a pseudo expansion test into a folder
Dylan McKay [Wed, 7 Dec 2016 11:21:45 +0000 (11:21 +0000)]
[AVR] Move a pseudo expansion test into a folder

llvm-svn: 288899

7 years ago[X86][XOP] Fix VPERMIL2 non-constant pool shuffle decoding (PR31296)
Simon Pilgrim [Wed, 7 Dec 2016 11:19:00 +0000 (11:19 +0000)]
[X86][XOP] Fix VPERMIL2 non-constant pool shuffle decoding (PR31296)

The non-constant pool version of DecodeVPERMIL2PMask was not offsetting correctly for the second input. I've updated the code to match the implementation in the constant-pool version.

Annoyingly this bug was hidden for so long as it's tricky to combine to useful variable shuffle masks that don't become constant-pool entries.

llvm-svn: 288898

7 years ago[AVR] Allow loading from stack slots where src and dest registers are identical
Dylan McKay [Wed, 7 Dec 2016 11:08:56 +0000 (11:08 +0000)]
[AVR] Allow loading from stack slots where src and dest registers are identical

Fixes PR 31256

llvm-svn: 288897

7 years agoImplement the -Wstrict-prototypes warning
Alex Lorenz [Wed, 7 Dec 2016 10:52:18 +0000 (10:52 +0000)]
Implement the -Wstrict-prototypes warning

This commit fixes PR20796. It implements the C only -Wstrict-prototypes warning.
Clang now emits a warning for function declarations which have no parameters
specified and for K&R function definitions with more than 0 parameters that are
not preceded by a previous prototype declaration.

The patch was originally submitted by Paul Titei!

rdar://15060615

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

llvm-svn: 288896

7 years ago[InlineFunction] Do not propagate the callsite debug location to instructions inlined...
Andrea Di Biagio [Wed, 7 Dec 2016 10:37:26 +0000 (10:37 +0000)]
[InlineFunction] Do not propagate the callsite debug location to instructions inlined from functions with debug info.

When a function F is inlined, InlineFunction extends the debug location of every
instruction inlined from F by adding an InlinedAt.

However, if an instruction has a 'null' debug location, InlineFunction would
propagate the callsite debug location to it. This behavior existed since
revision 210459.

Revision 210459 was originally committed specifically to workaround the lack of
debug information for instructions inlined from intrinsic functions (which are
usually declared with attributes `__always_inline__, __nodebug__`).

The problem with revision 210459 is that it doesn't make any sort of distinction
between instructions inlined from a 'nodebug' function and instructions which
are inlined from a function built with debug info. This issue may lead to
incorrect stepping in the debugger.

This patch works under the assumption that a nodebug function does not have a
DISubprogram. When a function F is inlined into another function G,
InlineFunction checks if F has debug info associated with it.

For nodebug functions, the InlineFunction logic is unchanged (i.e. it would
still propagate the callsite debugloc to the inlined instructions). Otherwise,
InlineFunction no longer propagates the callsite debug location.

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

llvm-svn: 288895

7 years ago[PM] Add some more logging to make it more clear when the CGSCC
Chandler Carruth [Wed, 7 Dec 2016 10:33:15 +0000 (10:33 +0000)]
[PM] Add some more logging to make it more clear when the CGSCC
infrastrucutre is skipping SCCs and RefSCCs.

llvm-svn: 288894

7 years ago[ObjC++] Don't enter a C++ declarator scope when the current context is
Alex Lorenz [Wed, 7 Dec 2016 10:24:44 +0000 (10:24 +0000)]
[ObjC++] Don't enter a C++ declarator scope when the current context is
an Objective-C declaration

This commit ensures that Sema won't enter a C++ declarator scope when the
current context is an Objective-C declaration. This prevents an assertion
failure in EnterDeclaratorContext that's used to ensure that current context
will be restored correctly after exiting the declarator context.

rdar://20560175

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

llvm-svn: 288893

7 years agoCompilation database test: don't try to output to CWD
Sam McCall [Wed, 7 Dec 2016 09:19:07 +0000 (09:19 +0000)]
Compilation database test: don't try to output to CWD

Summary:
Write output from compilation database test to %T rather than the working dir.
Sometimes CWD isn't writable!
Also specify no-canonical-prefixes so that clang has 'clang' in the name.

Reviewers: bkramer

Subscribers: joerg, cfe-commits

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

llvm-svn: 288892

7 years ago[OpenCL] Added a LIT test for ensuring address space mangling is done the same both...
Alexey Bader [Wed, 7 Dec 2016 08:43:49 +0000 (08:43 +0000)]
[OpenCL] Added a LIT test for ensuring address space mangling is done the same both in OpenCL1.2 and OpenCL2.0.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 288891

7 years ago[OpenCL] Fix SPIR version generation.
Alexey Bader [Wed, 7 Dec 2016 08:38:24 +0000 (08:38 +0000)]
[OpenCL] Fix SPIR version generation.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

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

llvm-svn: 288890

7 years agoReintroduce a check accidentally removed in 288873 to fix clang bots
Philip Reames [Wed, 7 Dec 2016 04:48:50 +0000 (04:48 +0000)]
Reintroduce a check accidentally removed in 288873 to fix clang bots

I believe this is the cause of the failure, but have not been able to confirm.  Note that this is a speculative fix; I'm still waiting for a full build to finish as I synced and ended up doing a clean build which takes 20+ minutes on my machine.

llvm-svn: 288886

7 years agoAdd comments and reorder code a bit to clarify the intention. NFC.
Rui Ueyama [Wed, 7 Dec 2016 04:45:34 +0000 (04:45 +0000)]
Add comments and reorder code a bit to clarify the intention. NFC.

llvm-svn: 288885

7 years agoFix a warning introduced in r288874
Philip Reames [Wed, 7 Dec 2016 04:11:22 +0000 (04:11 +0000)]
Fix a warning introduced in r288874

llvm-svn: 288884

7 years agoMake a decision about whether we should warn on missing entry or not early.
Rui Ueyama [Wed, 7 Dec 2016 04:06:21 +0000 (04:06 +0000)]
Make a decision about whether we should warn on missing entry or not early.

Config->WarnMissingEntry is a single-purpose boolean variable, and
I think it's easier to understand than Config->HasEntry.

llvm-svn: 288883

7 years agoSimplify -e <number> option handling.
Rui Ueyama [Wed, 7 Dec 2016 03:23:06 +0000 (03:23 +0000)]
Simplify -e <number> option handling.

This patch is to parse the entry symbol name lazily.

llvm-svn: 288882

7 years agoLowerTypeTests: Add a test that covers "unsatisfiable" type metadata.
Peter Collingbourne [Wed, 7 Dec 2016 03:04:34 +0000 (03:04 +0000)]
LowerTypeTests: Add a test that covers "unsatisfiable" type metadata.

llvm-svn: 288881

7 years ago[ELF] Fix the broken PPC test
Petr Hosek [Wed, 7 Dec 2016 03:04:02 +0000 (03:04 +0000)]
[ELF] Fix the broken PPC test

This is related to the change in handling of entry point symbols.

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

llvm-svn: 288880

7 years agoAMDGPU : Add S_SETREG instructions to fix fdiv precision issues.
Tom Stellard [Wed, 7 Dec 2016 02:42:15 +0000 (02:42 +0000)]
AMDGPU : Add S_SETREG instructions to fix fdiv precision issues.

Patch By: Wei Ding

Summary: This patch fixes the fdiv precision issues.

Reviewers: b-sumner, cfang, wdng, arsenm

Subscribers: kzhuravl, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 288879

7 years ago[ELF] Shared libraries should have entry point
Petr Hosek [Wed, 7 Dec 2016 02:26:16 +0000 (02:26 +0000)]
[ELF] Shared libraries should have entry point

Shared libraries should have entry set following the same rules as for
regular binaries. The only difference is that in case the default entry
point (_start or __start) isn't found (unless it was set explicitly), we
shouldn't give a warning as in case of regular binaries.

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

llvm-svn: 288878

7 years ago[ELF] Only binaries should have DT_DEBUG entry
Petr Hosek [Wed, 7 Dec 2016 02:05:42 +0000 (02:05 +0000)]
[ELF] Only binaries should have DT_DEBUG entry

The presence of DT_DEBUG entry is unrelated to the existence of entry point.

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

llvm-svn: 288877

7 years ago[AArch64] Correct the check of signed 9-bit imm in isLegalAddressingMode()
Haicheng Wu [Wed, 7 Dec 2016 01:45:04 +0000 (01:45 +0000)]
[AArch64] Correct the check of signed 9-bit imm in isLegalAddressingMode()

In the addressing mode, signed 9-bit imm is [-256, 255], not [-512, 511].

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

llvm-svn: 288876

7 years ago[LCG] Add basic verification of the parent set and fix bugs it uncovers.
Chandler Carruth [Wed, 7 Dec 2016 01:42:40 +0000 (01:42 +0000)]
[LCG] Add basic verification of the parent set and fix bugs it uncovers.

The existing unittests actually cover this now that we verify things.

llvm-svn: 288875

7 years ago[LVI] Remove used return value from markX functions
Philip Reames [Wed, 7 Dec 2016 01:03:56 +0000 (01:03 +0000)]
[LVI] Remove used return value from markX functions

llvm-svn: 288874

7 years ago[LVI] Simplify mergeIn code
Philip Reames [Wed, 7 Dec 2016 00:54:21 +0000 (00:54 +0000)]
[LVI] Simplify mergeIn code

Remove the unused return type, use early return, use assignment operator.

llvm-svn: 288873

7 years agoDriver: Remove support for -fobjc-gc*
Duncan P. N. Exon Smith [Wed, 7 Dec 2016 00:31:10 +0000 (00:31 +0000)]
Driver: Remove support for -fobjc-gc*

As a first step toward removing Objective-C garbage collection from
Clang, remove support from the driver.  I'm hoping this will flush out
any expected bots/configurations/whatever that might rely on it.

I've left the options behind temporarily in -cc1 to keep tests passing.
I'll kill them off entirely in a follow up when I've had a chance to
update/delete the rest of Clang.

llvm-svn: 288872

7 years ago[LVI] Simplify obfuscated code
Philip Reames [Wed, 7 Dec 2016 00:28:28 +0000 (00:28 +0000)]
[LVI] Simplify obfuscated code

It doesn't matter why something is overdefined if it is...

llvm-svn: 288871

7 years agoFix test.
Richard Smith [Wed, 7 Dec 2016 00:24:40 +0000 (00:24 +0000)]
Fix test.

llvm-svn: 288870

7 years ago[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in...
Erich Keane [Wed, 7 Dec 2016 00:21:45 +0000 (00:21 +0000)]
[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in window. Need add "complete object flag" check in eh cleanup code.

The problem only happen on window ( A MS-ABI issuer )

The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor.

The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup.

clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor.
But that part is missing for cleanup code.

To fix this add similar code as v-base init to cleanup code, same algorithm.

1> Add new routine:
EmitDtorCompleteObjectHandler

With corresponding to EmitCtorCompleteObjectHandler

2> In the EmitDestructorCal
Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor.

Just add check for "complete object flag" before call to v-base dtor.

Without my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

cleanupret from %13 unwind to caller, !dbg !66

with my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
%is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66
br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d

bg !66

Dtor.dtor_vbase: ; preds = %ehcleanup

call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

br label %Dtor.skip_vbase, !dbg !66

Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup

cleanupret from %13 unwind to caller, !dbg !66

Please let me know you need more info.

Patch by Jennifer Yu.

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

llvm-svn: 288869

7 years agoAddress review feedback by adding comments about ${:uid}
Reid Kleckner [Wed, 7 Dec 2016 00:17:18 +0000 (00:17 +0000)]
Address review feedback by adding comments about ${:uid}

llvm-svn: 288868

7 years agoIR: Reduce the amount of boilerplate required for a metadata kind. NFCI.
Peter Collingbourne [Tue, 6 Dec 2016 23:53:01 +0000 (23:53 +0000)]
IR: Reduce the amount of boilerplate required for a metadata kind. NFCI.

llvm-svn: 288867

7 years ago[c++17] P0135R1: Guaranteed copy elision.
Richard Smith [Tue, 6 Dec 2016 23:52:28 +0000 (23:52 +0000)]
[c++17] P0135R1: Guaranteed copy elision.

When an object of class type is initialized from a prvalue of the same type
(ignoring cv qualifications), use the prvalue to initialize the object directly
instead of inserting a redundant elidable call to a copy constructor.

llvm-svn: 288866

7 years agoAMDGPU: Add llvm.amdgcn.interp.mov intrinsic
Tom Stellard [Tue, 6 Dec 2016 23:52:13 +0000 (23:52 +0000)]
AMDGPU: Add llvm.amdgcn.interp.mov intrinsic

Reviewers: arsenm, nhaehnle

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

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

llvm-svn: 288865

7 years ago[llc] Fix -stop-after=consthoist initializing the pass.
Davide Italiano [Tue, 6 Dec 2016 23:49:58 +0000 (23:49 +0000)]
[llc] Fix -stop-after=consthoist initializing the pass.

llvm-svn: 288864

7 years ago[OpenMP] Fix typo in the run command in the test case. NFC.
Kelvin Li [Tue, 6 Dec 2016 23:18:06 +0000 (23:18 +0000)]
[OpenMP] Fix typo in the run command in the test case. NFC.

llvm-svn: 288862

7 years agoAMDGPU: Fix crash on i16 constant expression
Matt Arsenault [Tue, 6 Dec 2016 23:18:06 +0000 (23:18 +0000)]
AMDGPU: Fix crash on i16 constant expression

llvm-svn: 288861

7 years ago[XRay][compiler-rt] Explicitly add dependency to pthread
Dean Michael Berris [Tue, 6 Dec 2016 23:08:45 +0000 (23:08 +0000)]
[XRay][compiler-rt] Explicitly add dependency to pthread

This should fix the sanitizer bootstrap builds.

Follow-up to D26232.

llvm-svn: 288860

7 years agoLowerTypeTests: Improve performance by optimising type metadata queries.
Peter Collingbourne [Tue, 6 Dec 2016 23:02:13 +0000 (23:02 +0000)]
LowerTypeTests: Improve performance by optimising type metadata queries.

Requesting metadata for a global is a relatively expensive operation as it
involves a map lookup, but it's one that we need to do relatively frequently in
this pass to collect the list of type metadata nodes associated with a global.
This change improves the performance of type metadata queries by prebuilding
data structures that keep the global together with its list of type metadata,
and changing the pass to use that data structure wherever we were previously
passing global references around.

This change also eliminates some O(N^2) behavior by collecting the list of
globals associated with each type identifier during the first pass over the
list of globals rather than visiting each global to compute that list every
time we add a new type identifier.

Reduces pass runtime on a module containing Chrome's vtables from over 60s
to 0.9s.

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

llvm-svn: 288859

7 years ago[X86][XOP] Add test case for PR31296
Simon Pilgrim [Tue, 6 Dec 2016 22:50:13 +0000 (22:50 +0000)]
[X86][XOP] Add test case for PR31296

llvm-svn: 288858

7 years ago[CodeGen] Fix result type for SMULO/UMULO legalization
Eli Friedman [Tue, 6 Dec 2016 22:49:36 +0000 (22:49 +0000)]
[CodeGen] Fix result type for SMULO/UMULO legalization

On some platforms (like MSP430) the second element of the result
structure for SMULO/UMULO may have a shorter type than the one
returned by SetCC. We need to truncate it to the right type, or
else some incorrect code may be generated later on.

This fixes issue https://github.com/rust-lang/rust/issues/37829

Patch by Vadzim Dambrouski!

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

llvm-svn: 288857

7 years agoAMDGPU: Fix operand name for v_interp_*
Matt Arsenault [Tue, 6 Dec 2016 22:29:43 +0000 (22:29 +0000)]
AMDGPU: Fix operand name for v_interp_*

Other VOP instructions call the output vdst

llvm-svn: 288856

7 years ago[InstSimplify] fixed (?) to not mutate icmps
Sanjay Patel [Tue, 6 Dec 2016 22:09:52 +0000 (22:09 +0000)]
[InstSimplify] fixed (?) to not mutate icmps

As Eli noted in the post-commit thread for r288833, the use of
swapOperands() may not be allowed in InstSimplify, so I'm
removing those calls here pending further review.

The swap mutates the icmp, and there doesn't appear to be precedent
for instruction mutation in InstSimplify.

I didn't actually have any tests for those cases, so I'm adding
a few here.

llvm-svn: 288855

7 years agoReplace "|&" with "2>&1 |" to support bash pre-4
Evgeniy Stepanov [Tue, 6 Dec 2016 22:02:21 +0000 (22:02 +0000)]
Replace "|&" with "2>&1 |" to support bash pre-4

Summary: Old bash release (3.2) on SLES11 chokes on new redirection shortcut.

Patch by Brian Cain.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 288854

7 years ago[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warning...
Eugene Zelenko [Tue, 6 Dec 2016 22:00:57 +0000 (22:00 +0000)]
[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 288853

7 years agoAMDGPU/SI: Set correct value for amd_kernel_code_t::kernarg_segment_alignment
Tom Stellard [Tue, 6 Dec 2016 21:53:10 +0000 (21:53 +0000)]
AMDGPU/SI: Set correct value for amd_kernel_code_t::kernarg_segment_alignment

Reviewers: arsenm

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

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

llvm-svn: 288852

7 years ago[BDCE/DebugInfo] Preserve llvm.dbg.value's argument.
Davide Italiano [Tue, 6 Dec 2016 21:52:47 +0000 (21:52 +0000)]
[BDCE/DebugInfo] Preserve llvm.dbg.value's argument.

BDCE has two phases:
1. It asks SimplifyDemandedBits if all the bits of an instruction are dead, and if so,
replaces all its uses with the constant zero.
2. Then, it asks SimplifyDemandedBits again if the instruction is really dead
(no side effects etc..) and if so, eliminates it.

Now, in 1) if all the bits of an instruction are dead, we may end up replacing a dbg use:
  %call = tail call i32 (...) @g() #4, !dbg !15
  tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !8, metadata !16), !dbg !17
->
  %call = tail call i32 (...) @g() #4, !dbg !15
  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !8, metadata !16), !dbg !17

but not eliminating the call because it may have arbitrary side effects.
In other words, we lose some debug informations.
This patch fixes the problem making sure that BDCE does nothing with the instruction if
it has side effects and no non-dbg uses.

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

llvm-svn: 288851

7 years agoDisable -Wweak-vtables when there are no key functions
Reid Kleckner [Tue, 6 Dec 2016 21:44:41 +0000 (21:44 +0000)]
Disable -Wweak-vtables when there are no key functions

Our -Wweak-vtables diagnostic is powered by our key function
calculation, which checks if key functions are enabled. We won't find
any key functions in C++ ABIs that lack key functions, so -Wweak-vtables
was warning on every dynamic class before this change. So, turn off this
warning in ABIs without key functions.

Addresses PR31220

llvm-svn: 288850

7 years agoAMDGPU/SI: Don't move copies of immediates to the VALU
Tom Stellard [Tue, 6 Dec 2016 21:13:30 +0000 (21:13 +0000)]
AMDGPU/SI: Don't move copies of immediates to the VALU

Summary:
If we write an immediate to a VGPR and then copy the VGPR to an
SGPR, we can replace the copy with a S_MOV_B32 sgpr, imm, rather than
moving the copy to the SALU.

Reviewers: arsenm

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

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

llvm-svn: 288849

7 years agoGlobalISel: correctly handle small args via memory.
Tim Northover [Tue, 6 Dec 2016 21:02:19 +0000 (21:02 +0000)]
GlobalISel: correctly handle small args via memory.

We were rounding size in bits down rather than up, leading to 0-sized slots for
i1 (assert!) and bugs for other types not byte-aligned.

llvm-svn: 288848

7 years ago[X86] Prefer reduced width multiplication over pmulld on Silvermont
Zvi Rackover [Tue, 6 Dec 2016 19:35:20 +0000 (19:35 +0000)]
[X86] Prefer reduced width multiplication over pmulld on Silvermont

Summary:
Prefer expansions such as: pmullw,pmulhw,unpacklwd,unpackhwd over pmulld.
On Silvermont [source: Optimization Reference Manual]:
PMULLD has a throughput of 1/11 [instruction/cycles].
PMULHUW/PMULHW/PMULLW have a throughput of 1/2 [instruction/cycles].

Fixes pr31202.

Analysis of this issue was done by Fahana Aleen.

Reviewers: wmi, delena, mkuper

Subscribers: RKSimon, llvm-commits

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

llvm-svn: 288844

7 years ago[llgo] Remove support for LLVM attributes
Meador Inge [Tue, 6 Dec 2016 19:22:04 +0000 (19:22 +0000)]
[llgo] Remove support for LLVM attributes

llgo supports the application of LLVM attributes to global objects
and functions.  This "feature" is undocumented and untested.  As
discusses in D27442, it should be removed.

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

llvm-svn: 288843

7 years ago[DAGCombine] Add (sext_in_reg (zext x)) -> (sext x) combine
Simon Pilgrim [Tue, 6 Dec 2016 19:09:37 +0000 (19:09 +0000)]
[DAGCombine] Add (sext_in_reg (zext x)) -> (sext x) combine

Handle the case where a sign extension has ended up being split into separate stages (typically to get around vector legal ops) and a zext + sext_in_reg gets inserted.

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

llvm-svn: 288842

7 years ago[InstSimplify] add folds for and-of-icmps with same operands
Sanjay Patel [Tue, 6 Dec 2016 19:05:46 +0000 (19:05 +0000)]
[InstSimplify] add folds for and-of-icmps with same operands

All of these (and a few more) are already handled by InstCombine,
but we shouldn't have to wait until then to simplify these because
they're cheap to deal with here in InstSimplify.

This is the 'and' sibling of the earlier 'or' patch:
https://reviews.llvm.org/rL288833

llvm-svn: 288841

7 years agoGlobalISel: fall back gracefully when we hit unhandled legalizer default.
Tim Northover [Tue, 6 Dec 2016 19:02:15 +0000 (19:02 +0000)]
GlobalISel: fall back gracefully when we hit unhandled legalizer default.

llvm-svn: 288840

7 years ago[SelectionDAG] We can ignore knownbits from an undef shuffle vector index if we don...
Simon Pilgrim [Tue, 6 Dec 2016 18:58:25 +0000 (18:58 +0000)]
[SelectionDAG] We can ignore knownbits from an undef shuffle vector index if we don't actually demand that element

llvm-svn: 288839