platform/upstream/llvm.git
7 years ago[x86] add minmax tests with more predicate coverage; NFC
Sanjay Patel [Mon, 16 Oct 2017 15:20:00 +0000 (15:20 +0000)]
[x86] add minmax tests with more predicate coverage; NFC

llvm-svn: 315913

7 years ago[Polly] Add XFAIL to large-numbers-in-boundary-context.ll
Anna Thomas [Mon, 16 Oct 2017 15:12:39 +0000 (15:12 +0000)]
[Polly] Add XFAIL to large-numbers-in-boundary-context.ll

After rL315683 (improve SCEV to calculate max BETakenCount when end
bound of loop is variant and loop is of form {Start,+1, Stride} LT End)
this test in polly started failing.
However, as discussed in https://reviews.llvm.org/rL315683,
this polly test is not a loops bound test and the MaxBECount calculated by
SCEV looks correct. The max BECount is the value calculated even when the end
bound of loop is invariant.

As discussed with Tobias offline, I'm marking this as an XFAIL, until he
gets a chance to update the testcase, so the build bot goes to green.

llvm-svn: 315912

7 years ago[TableGen] Simplify CallingConvEmitter.cpp. NFC.
Javed Absar [Mon, 16 Oct 2017 14:52:26 +0000 (14:52 +0000)]
[TableGen] Simplify CallingConvEmitter.cpp. NFC.

llvm-svn: 315911

7 years ago[InstCombine] don't unnecessarily generate a constant; NFCI
Sanjay Patel [Mon, 16 Oct 2017 14:47:24 +0000 (14:47 +0000)]
[InstCombine] don't unnecessarily generate a constant; NFCI

llvm-svn: 315910

7 years ago[ValueTracking] fix typos, formatting; NFC
Sanjay Patel [Mon, 16 Oct 2017 14:46:37 +0000 (14:46 +0000)]
[ValueTracking] fix typos, formatting; NFC

llvm-svn: 315909

7 years ago[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one
Alexander Timofeev [Mon, 16 Oct 2017 14:35:29 +0000 (14:35 +0000)]
[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one

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

llvm-svn: 315908

7 years agoFix test name typo.
Simon Pilgrim [Mon, 16 Oct 2017 14:33:51 +0000 (14:33 +0000)]
Fix test name typo.

llvm-svn: 315907

7 years ago[X86][SSE] Added additional PACKUS shuffle tests
Simon Pilgrim [Mon, 16 Oct 2017 14:32:41 +0000 (14:32 +0000)]
[X86][SSE] Added additional PACKUS shuffle tests

Mainly inspired by PR34773

llvm-svn: 315906

7 years ago[mips][micromips] Fix (dis)assembly of bc1(t|f)
Simon Dardis [Mon, 16 Oct 2017 14:20:22 +0000 (14:20 +0000)]
[mips][micromips] Fix (dis)assembly of bc1(t|f)

Previously these instructions were marked codegen only and had
an under-specified instruction description that did not record the
fcc register.

Reviewers: atanasyan, abeserminji

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

llvm-svn: 315905

7 years agoISel type legalizer: debug messages. NFC.
Sjoerd Meijer [Mon, 16 Oct 2017 14:07:30 +0000 (14:07 +0000)]
ISel type legalizer: debug messages. NFC.

Minor addition and follow up of r314773 and r311533: this adds more
debug messages to the type legalizer. For each node, it dumps
legalization info for results and operands nodes, rather than just the
final legalized node.

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

llvm-svn: 315904

7 years agoFix or vs || typo.
Simon Pilgrim [Mon, 16 Oct 2017 14:01:59 +0000 (14:01 +0000)]
Fix or vs || typo.

llvm-svn: 315903

7 years ago[CUDA] Require libdevice only if needed
Jonas Hahnfeld [Mon, 16 Oct 2017 13:31:30 +0000 (13:31 +0000)]
[CUDA] Require libdevice only if needed

If the user passes -nocudalib, we can live without it being present.
Simplify the code by just checking whether LibDeviceMap is empty.

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

llvm-svn: 315902

7 years ago[mips] Provide alternate predicates for constant synthesis
Stefan Maksimovic [Mon, 16 Oct 2017 13:18:21 +0000 (13:18 +0000)]
[mips] Provide alternate predicates for constant synthesis

Ordering of patterns should not be of importance anymore
since the predicates used are mutually exclusive now.

llvm-svn: 315901

7 years ago[PowerPC] fix up in sign-/zero-extension elimination
Hiroshi Inoue [Mon, 16 Oct 2017 12:11:15 +0000 (12:11 +0000)]
[PowerPC] fix up in sign-/zero-extension elimination

This patch fixes a potential problem in my previous commit (https://reviews.llvm.org/rL315888) by adding a null check.

llvm-svn: 315900

7 years agoThis patch is a result of D37262: The issues with X86 prefixes. It closes PR7709...
Andrew V. Tischenko [Mon, 16 Oct 2017 11:14:29 +0000 (11:14 +0000)]
This patch is a result of D37262: The issues with X86 prefixes. It closes  PR7709, PR17697, PR19251, PR32809 and PR21640. There could be other bugs closed by this patch.

llvm-svn: 315899

7 years ago[clang-rename] Add function unit tests.
Haojian Wu [Mon, 16 Oct 2017 10:37:42 +0000 (10:37 +0000)]
[clang-rename] Add function unit tests.

Summary:
Also contain a fix:

* Fix a false positive of renaming a using shadow function declaration.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, mgorny, cfe-commits

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

llvm-svn: 315898

7 years ago[llvm-dwarfdump] - Teach tool to parse DW_CFA_GNU_args_size.
George Rimar [Mon, 16 Oct 2017 10:26:17 +0000 (10:26 +0000)]
[llvm-dwarfdump] - Teach tool to parse DW_CFA_GNU_args_size.

Currently llvm-dwarfdump runs into llvm_unreachable when
faces DW_CFA_GNU_args_size. Patch implements the support.

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

llvm-svn: 315897

7 years agoRevert rL315894, "SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)"
NAKAMURA Takumi [Mon, 16 Oct 2017 09:50:01 +0000 (09:50 +0000)]
Revert rL315894, "SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)"

llvm-svn: 315896

7 years agoMove folding of icmp with zero after checking for min/max idioms.
Nikolai Bozhenov [Mon, 16 Oct 2017 09:19:21 +0000 (09:19 +0000)]
Move folding of icmp with zero after checking for min/max idioms.

Summary:
The following transformation for cmp instruction:

  icmp smin(x, PositiveValue), 0 -> icmp x, 0

should only be done after checking for min/max to prevent infinite
looping caused by a reverse canonicalization. That is why this
transformation was moved to place after the mentioned check.

Reviewers: spatel, efriedma

Subscribers: llvm-commits

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

Patch by: Artur Gainullin <artur.gainullin@intel.com>

llvm-svn: 315895

7 years agoSLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)
NAKAMURA Takumi [Mon, 16 Oct 2017 09:15:23 +0000 (09:15 +0000)]
SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)

llvm-svn: 315894

7 years ago[clang-format] Break non-trailing comments, try 2
Krasimir Georgiev [Mon, 16 Oct 2017 09:08:53 +0000 (09:08 +0000)]
[clang-format] Break non-trailing comments, try 2

Summary:
This patch enables `BreakableToken` to manage the formatting of non-trailing
block comments. It is a refinement of https://reviews.llvm.org/D37007.
We discovered that the optimizer outsmarts us on cases where breaking the comment
costs considerably less than breaking after the comment. This patch addresses
this by ensuring that a newline is inserted between a block comment and the next
token.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 315893

7 years ago[change-namespace] do not change type locs in defaulted functions.
Eric Liu [Mon, 16 Oct 2017 08:20:10 +0000 (08:20 +0000)]
[change-namespace] do not change type locs in defaulted functions.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 315892

7 years ago[TableGen] Range loopify DAGISelMatcher. NFC.
Javed Absar [Mon, 16 Oct 2017 06:43:54 +0000 (06:43 +0000)]
[TableGen] Range loopify DAGISelMatcher. NFC.

llvm-svn: 315891

7 years ago[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect...
Daniel Sanders [Mon, 16 Oct 2017 05:39:30 +0000 (05:39 +0000)]
[aarch64][globalisel] Fix a crash in selectAddrModeIndexed() caused by incorrect G_FRAME_INDEX handling

The wrong operand was being rendered to the result instruction.

The crash was detected by Bitcode/simd_ops/AArch64_halide_runtime.bc

llvm-svn: 315890

7 years agobpf: fix bug on silently truncating 64-bit immediate
Yonghong Song [Mon, 16 Oct 2017 04:14:53 +0000 (04:14 +0000)]
bpf: fix bug on silently truncating 64-bit immediate

We came across an llvm bug when compiling some testcases that 64-bit
immediates are silently truncated into 32-bit and then packed into
BPF_JMP | BPF_K encoding.  This caused comparison with wrong value.

This bug looks to be introduced by r308080.  The Select_Ri pattern is
supposed to be lowered into J*_Ri while the latter only support 32-bit
immediate encoding, therefore Select_Ri should have similar immediate
predicate check as what J*_Ri are doing.

Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 315889

7 years ago[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended
Hiroshi Inoue [Mon, 16 Oct 2017 04:12:57 +0000 (04:12 +0000)]
[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended

This patch enables redundant sign- and zero-extension elimination in PowerPC MI Peephole pass.
If the input value of a sign- or zero-extension is known to be already sign- or zero-extended, the operation is redundant and can be eliminated.
One common case is sign-extensions for a method parameter or for a method return value; they must be sign- or zero-extended as defined in PPC ELF ABI.
For example of the following simple code, two extsw instructions are generated before the invocation of int_func and before the return. With this patch, both extsw are eliminated.

void int_func(int);
void ii_test(int a) {
    if (a & 1) return int_func(a);
}

Such redundant sign- or zero-extensions are quite common in many programs; e.g. I observed about 60,000 occurrences of the elimination while compiling the LLVM+CLANG.

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

llvm-svn: 315888

7 years agoRe-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscale...
Daniel Sanders [Mon, 16 Oct 2017 03:36:29 +0000 (03:36 +0000)]
Re-commit r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

The previous commit failed on MSVC due to a failure to convert an
initializer_list to a std::vector. Hopefully, MSVC will accept this version.

Depends on D37457

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315887

7 years agoRevert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled...
Daniel Sanders [Mon, 16 Oct 2017 02:15:39 +0000 (02:15 +0000)]
Revert r315885: [globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

MSVC doesn't like one of the constructors.

llvm-svn: 315886

7 years ago[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*
Daniel Sanders [Mon, 16 Oct 2017 01:16:35 +0000 (01:16 +0000)]
[globalisel][tblgen] Add support for iPTR and implement am_unscaled* and am_indexed*

Summary:
iPTR is a pointer of subtarget-specific size to any address space. Therefore
type checks on this size derive the SizeInBits from a subtarget hook.

At this point, we can import the simplests G_LOAD rules and select load
instructions using them. Further patches will support for the predicates to
enable additional loads as well as the stores.

Depends on D37457

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315885

7 years ago[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks
Daniel Sanders [Mon, 16 Oct 2017 00:56:30 +0000 (00:56 +0000)]
[globalisel][tablegen] Implement unindexed load, non-extending load, and MemVT checks

Summary:
This includes some context-sensitivity in the MVT to LLT conversion so that
pointer types are tested correctly.
FIXME: I'm not happy with the way this is done since everything is a
       special-case. I've yet to find a reasonable way to implement it.

select-load.mir fails because <1 x s64> loads in tablegen get priority over s64
loads. This is fixed in the next patch and as such they should be committed
together, I've posted them separately to help with the review.

Depends on D37456

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Subscribers: kristof.beyls, javed.absar, llvm-commits, igorb

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

llvm-svn: 315884

7 years ago[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC
Krzysztof Parzyszek [Mon, 16 Oct 2017 00:29:47 +0000 (00:29 +0000)]
[Hexagon] Add LLVM_ATTRIBUTE_UNUSED to operator<<, NFC

This should silence "unused function" warnings.

llvm-svn: 315883

7 years agoFix last_write_time.pass.cpp to work with clang-3.9 and earlier
Roman Lebedev [Sun, 15 Oct 2017 21:52:53 +0000 (21:52 +0000)]
Fix last_write_time.pass.cpp to work with clang-3.9 and earlier

At least with clang-3.9 and earlier, -Wunknown-pragmas is also needed.

llvm-svn: 315882

7 years agoRemove Config::FirstElf.
Rui Ueyama [Sun, 15 Oct 2017 21:43:09 +0000 (21:43 +0000)]
Remove Config::FirstElf.

llvm-svn: 315881

7 years ago[COFF] Fix a typo in a comment in a test. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:50 +0000 (21:09 +0000)]
[COFF] Fix a typo in a comment in a test. NFC.

These chars are accidentally included vim commands.

llvm-svn: 315880

7 years ago[COFF] Fix indentation. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:46 +0000 (21:09 +0000)]
[COFF] Fix indentation. NFC.

llvm-svn: 315879

7 years ago[COFF] Fix the description of the data type in a comment. NFC.
Martin Storsjo [Sun, 15 Oct 2017 21:09:43 +0000 (21:09 +0000)]
[COFF] Fix the description of the data type in a comment. NFC.

This was missed when changing data types back and forth during
review.

llvm-svn: 315878

7 years agoSimplify.
Rui Ueyama [Sun, 15 Oct 2017 21:07:25 +0000 (21:07 +0000)]
Simplify.

llvm-svn: 315877

7 years agoReally do make sure that last_write_time.pass.cpp still works with old clang
Roman Lebedev [Sun, 15 Oct 2017 20:46:12 +0000 (20:46 +0000)]
Really do make sure that last_write_time.pass.cpp still works with old clang

I *did* try to check that such kind of an issue was not introduced
by the rL315874, but clearly i failed to finish verification.

llvm-svn: 315876

7 years ago[Sema] Re-land: Diagnose tautological comparison with type's min/max values
Roman Lebedev [Sun, 15 Oct 2017 20:13:17 +0000 (20:13 +0000)]
[Sema] Re-land: Diagnose tautological comparison with type's min/max values

The first attempt, rL315614 was reverted because one libcxx
test broke, and i did not know at the time how to deal with it.

Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

llvm-svn: 315875

7 years agoSilence clang's -Wtautological-constant-compare in last_write_time.pass.cpp
Roman Lebedev [Sun, 15 Oct 2017 20:12:42 +0000 (20:12 +0000)]
Silence clang's -Wtautological-constant-compare in last_write_time.pass.cpp

Previously this broke the builders, when D38101 was committed.
Silence the warning so that it can be re-landed.

llvm-svn: 315874

7 years agoSearch for libxml2 on macOS too.
Nico Weber [Sun, 15 Oct 2017 19:13:57 +0000 (19:13 +0000)]
Search for libxml2 on macOS too.

This allows lld-link to process /manifestinput: flags on macOS too.
Also makes the `REQUIRES: manifesttool` lld tests run on macOS.
Setting LLVM_ENABLE_LIBXML2 to off can suppress this behavior, like on Linux.

llvm-svn: 315873

7 years ago[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode...
Daniel Sanders [Sun, 15 Oct 2017 19:01:32 +0000 (19:01 +0000)]
[tablegen] Use hasPredCode()/hasImmCode() instead of getPredCode().empty()/getImmCode().empty(). NFC

These are cheaper ways of testing for the presence of code than generating the C++ code and testing it's empty.

llvm-svn: 315872

7 years agoConvert clang::LangAS to a strongly typed enum
Alexander Richardson [Sun, 15 Oct 2017 18:48:14 +0000 (18:48 +0000)]
Convert clang::LangAS to a strongly typed enum

Summary:
Convert clang::LangAS to a strongly typed enum

Currently both clang AST address spaces and target specific address spaces
are represented as unsigned which can lead to subtle errors if the wrong
type is passed. It is especially confusing in the CodeGen files as it is
not possible to see what kind of address space should be passed to a
function without looking at the implementation.
I originally made this change for our LLVM fork for the CHERI architecture
where we make extensive use of address spaces to differentiate between
capabilities and pointers. When merging the upstream changes I usually
run into some test failures or runtime crashes because the wrong kind of
address space is passed to a function. By converting the LangAS enum to a
C++11 we can catch these errors at compile time. Additionally, it is now
obvious from the function signature which kind of address space it expects.

I found the following errors while writing this patch:

- ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address
  space to  TargetInfo::getPointer{Width,Align}()
- TypePrinter::printAttributedAfter() prints the numeric value of the
  clang AST address space instead of the target address space.
  However, this code is not used so I kept the current behaviour
- initializeForBlockHeader() in CGBlocks.cpp was passing
  LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}()
- CodeGenFunction::EmitBlockLiteral() was passing a AST address space to
  TargetInfo::getPointerWidth()
- CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space
  to Qualifiers::addAddressSpace()
- CGOpenMPRuntimeNVPTX::getParameterAddress() was using
  llvm::Type::getPointerTo() with a AST address space
- clang_getAddressSpace() returns either a LangAS or a target address
  space. As this is exposed to C I have kept the current behaviour and
  added a comment stating that it is probably not correct.

Other than this the patch should not cause any functional changes.

Reviewers: yaxunl, pcc, bader

Reviewed By: yaxunl, bader

Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits

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

llvm-svn: 315871

7 years agoPhony change to CMakeLists.txt to (hopefully) trigger regeneration
Krzysztof Parzyszek [Sun, 15 Oct 2017 18:23:16 +0000 (18:23 +0000)]
Phony change to CMakeLists.txt to (hopefully) trigger regeneration

Ninja doesn't seem to recognize a change in a CMakeLists.txt in a
subdirectory, so r315861 is not having any effect.

llvm-svn: 315870

7 years agoRe-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 18:22:54 +0000 (18:22 +0000)]
Re-commit r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

Hopefully fixed the ambiguous constructor that a large number of bots reported.

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: aemerson, javed.absar, igorb, llvm-commits, kristof.beyls

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

llvm-svn: 315869

7 years agoFix test case regresstion from rL315864
Martell Malone [Sun, 15 Oct 2017 18:01:28 +0000 (18:01 +0000)]
Fix test case regresstion from rL315864

The patch should have been checking against STDCXX17 not STDCXX14.

llvm-svn: 315868

7 years agoDriver: use ld64.lld when -fuse-ld=lld for darwin
Martell Malone [Sun, 15 Oct 2017 17:53:45 +0000 (17:53 +0000)]
Driver: use ld64.lld when -fuse-ld=lld for darwin

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

This is the clang driver component change to use this new alias.

Reviewers: ruiu, rnk

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

llvm-svn: 315867

7 years agoRevert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:51:07 +0000 (17:51 +0000)]
Revert r315863: [globalisel][tablegen] Import ComplexPattern when used as an operator

A large number of bots are failing on an ambiguous constructor call.

llvm-svn: 315866

7 years agoMACHO: ld64.lld alias for the MACHO LLD target
Martell Malone [Sun, 15 Oct 2017 17:41:20 +0000 (17:41 +0000)]
MACHO: ld64.lld alias for the MACHO LLD target

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

The clang driver component changes will be in a follow-up commit.

Reviewers: ruiu, rnk

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

llvm-svn: 315865

7 years ago[driver] [cl] Add/fix c++17/c++latest
Martell Malone [Sun, 15 Oct 2017 17:27:58 +0000 (17:27 +0000)]
[driver] [cl] Add/fix c++17/c++latest

Patch by: daxpedda

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

llvm-svn: 315864

7 years ago[globalisel][tablegen] Import ComplexPattern when used as an operator
Daniel Sanders [Sun, 15 Oct 2017 17:03:36 +0000 (17:03 +0000)]
[globalisel][tablegen] Import ComplexPattern when used as an operator

Summary:
It's possible for a ComplexPattern to be used as an operator in a match
pattern. This is used by the load/store patterns in AArch64 to name the
suboperands returned by ComplexPattern predicate so that they can be broken
apart and referenced independently in the result pattern.

This patch adds support for this in order to enable the import of load/store
patterns.

Depends on D37445

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: aemerson, javed.absar, igorb, llvm-commits, kristof.beyls

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

llvm-svn: 315863

7 years ago[X86] Remove the SlowBTMem feature flag entirely
Craig Topper [Sun, 15 Oct 2017 16:57:33 +0000 (16:57 +0000)]
[X86] Remove the SlowBTMem feature flag entirely

Turns out we have no patterns on the instructions that were using this feature flag for other reasons. These instructions are slow on all modern CPUs so it seems unlikely that we will spend any effort supporting these instructions going forward. So we might as well just kill of the feature flag and just fix up the comments.

llvm-svn: 315862

7 years ago[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD
Krzysztof Parzyszek [Sun, 15 Oct 2017 16:55:23 +0000 (16:55 +0000)]
[unittests] Only build llvm-cfi-verify if X86 is in LLVM_TARGETS_TO_BUILD

The test requires a target for triple x86-64, and it fails in builds that
do not have the X86 backend.

llvm-svn: 315861

7 years ago[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.
Craig Topper [Sun, 15 Oct 2017 16:41:17 +0000 (16:41 +0000)]
[AVX512] Don't mark EXTLOAD as legal with AVX512. Continue using custom lowering.

Summary:
This was impeding our ability to combine the extending shuffles with other shuffles as you can see from the test changes.

There's one special case that needed to be added to use VZEXT directly for v8i8->v8i64 since the custom lowering requires v64i8.

Reviewers: RKSimon, zvi, delena

Reviewed By: delena

Subscribers: llvm-commits

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

llvm-svn: 315860

7 years ago[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights...
Craig Topper [Sun, 15 Oct 2017 16:41:15 +0000 (16:41 +0000)]
[X86] Add FeatureSlowBTMem to Haswell, Broadwell, Skylake, Cannonlake, and Knights Landing CPUs.

Summary: I see nothing in Agner Fog's tables to indicate that this improved between Ivy Bridge and Haswell. It's also set for all Atom CPUs so I assume KNL should have it too.

Reviewers: RKSimon, zvi, gadi.haber

Reviewed By: gadi.haber

Subscribers: llvm-commits

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

llvm-svn: 315859

7 years ago[TableGen] Remove error checks incorrectly failing on non-error conditions
Krzysztof Parzyszek [Sun, 15 Oct 2017 15:39:56 +0000 (15:39 +0000)]
[TableGen] Remove error checks incorrectly failing on non-error conditions

In type inference, an empty type set for a specific hw mode is not an
error. In earlier stages of the design it was, but having to use non-
parameterized types with target intrinsics necessarily led to type
contradictions: since the intrinsics used specific types, they were
only valid for a specific hw mode, and the resulting type set for other
modes ended up empty. To accommodate the existence of such intrinsics
individual type sets were allowed to be empty as long as not all sets
were empty.

llvm-svn: 315858

7 years agorevert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp...
Sanjay Patel [Sun, 15 Oct 2017 15:39:15 +0000 (15:39 +0000)]
revert r314984: revert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

Recommitting r314698. The bug exposed by this change should be fixed with:
https://reviews.llvm.org/rL315579

llvm-svn: 315857

7 years agoAdd -f[no-]double-square-bracket-attributes as new driver options to control use...
Aaron Ballman [Sun, 15 Oct 2017 15:01:42 +0000 (15:01 +0000)]
Add -f[no-]double-square-bracket-attributes as new driver options to control use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later.

llvm-svn: 315856

7 years ago[SimplifyCFG] use range-for-loops, tidy; NFCI
Sanjay Patel [Sun, 15 Oct 2017 14:43:39 +0000 (14:43 +0000)]
[SimplifyCFG] use range-for-loops, tidy; NFCI

There seems to be something missing here as shown in PR34471:
https://bugs.llvm.org/show_bug.cgi?id=34471

llvm-svn: 315855

7 years agoReverting r315590; it did not include changes for llvm-tblgen, which is causing link...
Aaron Ballman [Sun, 15 Oct 2017 14:32:27 +0000 (14:32 +0000)]
Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people.

Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1

llvm-svn: 315854

7 years ago[MergeFunctions] Merge small functions if possible without a thunk.
whitequark [Sun, 15 Oct 2017 12:29:09 +0000 (12:29 +0000)]
[MergeFunctions] Merge small functions if possible without a thunk.

This can result in significant code size savings in some cases,
e.g. an interrupt table all filled with the same assembly stub
in a certain Cortex-M BSP results in code blowup by a factor of 2.5.

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

llvm-svn: 315853

7 years ago[MergeFunctions] Replace all uses of unnamed_addr functions.
whitequark [Sun, 15 Oct 2017 12:29:01 +0000 (12:29 +0000)]
[MergeFunctions] Replace all uses of unnamed_addr functions.

This reduces code size for constructs like vtables or interrupt
tables that refer to functions in global initializers.

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

llvm-svn: 315852

7 years ago[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565
Amjad Aboud [Sun, 15 Oct 2017 11:00:56 +0000 (11:00 +0000)]
[X86] Ignore DBG instructions in X86CmovConversion optimization to resolve PR34565

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

llvm-svn: 315851

7 years ago[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass...
Hongbin Zheng [Sun, 15 Oct 2017 07:31:02 +0000 (07:31 +0000)]
[LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the Loop Pass, NFC.

This avoid code duplication and allow us to add the disable unroll metadata elsewhere.

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

llvm-svn: 315850

7 years ago[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instru...
Craig Topper [Sun, 15 Oct 2017 06:39:07 +0000 (06:39 +0000)]
[X86] Lower vselect with constant condition to vector_shuffle even with AVX512 instructions.

Summary:
It's better to use our shuffle lowering code to handle these than loading an immediate into a k-register.

It really feels like this should be a DAG combine optimization rather than a lowering operation, but that's a problem for another day.

Reviewers: RKSimon, delena, zvi

Reviewed By: delena

Subscribers: llvm-commits

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

llvm-svn: 315849

7 years ago[X86] Don't use constant condition for select instruction when testing masking ops.
Craig Topper [Sun, 15 Oct 2017 06:05:50 +0000 (06:05 +0000)]
[X86] Don't use constant condition for select instruction when testing masking ops.

We should be able to fold constant conditions by converting to shuffles, but fixing that would break these tests in their current form. Since they are really trying to test masking ops, add a non-constant mask to the selects.

llvm-svn: 315848

7 years agoRemove unused variables
Vitaly Buka [Sun, 15 Oct 2017 05:35:02 +0000 (05:35 +0000)]
Remove unused variables

llvm-svn: 315847

7 years ago[Lex] Remove unused variables. No functionality change.
Benjamin Kramer [Sun, 15 Oct 2017 04:27:37 +0000 (04:27 +0000)]
[Lex] Remove unused variables. No functionality change.

llvm-svn: 315845

7 years ago[asan] Increase kHandlerStackSize for TracerThreadSignalHandler
Vitaly Buka [Sun, 15 Oct 2017 04:18:29 +0000 (04:18 +0000)]
[asan] Increase kHandlerStackSize for TracerThreadSignalHandler

4096 is not enough on some platform, e.g. Debian 4.9.0-3-amd64

llvm-svn: 315844

7 years ago[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC
Daniel Sanders [Sun, 15 Oct 2017 02:41:12 +0000 (02:41 +0000)]
[globalisel][tablegen] Map ld and st to G_LOAD and G_STORE. NFC

Summary:
There is an important mismatch between ISD::LOAD and G_LOAD (and likewise for
ISD::STORE and G_STORE). In SelectionDAG, ISD::LOAD is a non-atomic load
and atomic loads are handled by a separate node. However, this is not true of
GlobalISel's G_LOAD. For G_LOAD, the MachineMemOperand indicates the atomicity
of the operation. As a result, this mapping must also add a predicate that
checks for non-atomic MachineMemOperands.

This is NFC since these nodes always have predicates in practice and are
therefore always rejected at the moment.

Depends on D37443

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Reviewed By: qcolombet

Subscribers: kristof.beyls, llvm-commits, igorb

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

llvm-svn: 315843

7 years ago[c++2a] Fix failing regression test related to not adding the extension warning to...
Faisal Vali [Sun, 15 Oct 2017 02:13:17 +0000 (02:13 +0000)]
[c++2a] Fix failing regression test related to not adding the extension warning to a diagnostic group (in r315840)

In passing also complete a comment that I left uncompleted.

For ease of reference, here's the parent commit: https://reviews.llvm.org/rL315840

llvm-svn: 315842

7 years ago[tablegen] Handle common load/store predicates inside tablegen. NFC.
Daniel Sanders [Sun, 15 Oct 2017 02:06:44 +0000 (02:06 +0000)]
[tablegen] Handle common load/store predicates inside tablegen. NFC.

Summary:
GlobalISel and SelectionDAG require different code for the common
load/store predicates due to differences in the representation.
For example:
   SelectionDAG: (load<signext,i8>:i32 GPR32:$addr) // The <> denote properties of the SDNode that are not printed in the DAG
   GlobalISel: (G_SEXT:s32 (G_LOAD:s8 GPR32:$addr))
Even without that, differences in the IR (SDNode vs MachineInstr) require
differences in the C++ predicate.

This patch moves the implementation of the common load/store predicates
into tablegen so that it can handle these differences.

It's NFC for SelectionDAG since it emits equivalent code and it's NFC for
GlobalISel since the rules involving the relevant predicates are still
rejected by the importer.

Depends on D36618

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Subscribers: llvm-commits, igorb

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

Includes a partial revert of r315826 since this patch makes it necessary for
getPredCode() to return a std::string and getImmCode() should have the same
interface as getPredCode().

llvm-svn: 315841

7 years ago[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)
Faisal Vali [Sun, 15 Oct 2017 01:26:26 +0000 (01:26 +0000)]
[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)

This patch implements an extension to the preprocessor:

__VA_OPT__(contents) --> which expands into its contents if variadic arguments are supplied to the parent macro, or behaves as an empty token if none.

  - Currently this feature is only enabled for C++2a (this could be enabled, with some careful tweaks, for other dialects with the appropriate extension or compatibility warnings)

  - The patch was reviewed here: https://reviews.llvm.org/D35782 and asides from the above (and moving some of the definition and expansion recognition logic into the corresponding state machines), I believe I incorporated all of Richard's suggestions.

A few technicalities (most of which were clarified through private correspondence between rsmith, hubert and thomas) are worth mentioning.  Given:

    #define F(a,...) a #__VA_OPT__(a ## a)  a ## __VA_OPT__(__VA_ARGS__)

    - The call F(,) Does not supply any tokens for the variadic arguments and hence VA_OPT behaves as a placeholder.
    - When expanding VA_OPT (for e.g. F(,1) token pasting occurs eagerly within its contents if the contents need to be stringified.
    - A hash or a hashhash prior to VA_OPT does not inhibit expansion of arguments if they are the first token within VA_OPT.
    - When a variadic argument is supplied, argument substitution occurs within the contents as does stringification - and these resulting tokens are inserted back into the macro expansions token stream just prior to the entire stream being rescanned and concatenated.

See wg21.link/P0306 for further details on the feature.

Acknowledgment: This patch would have been poorer if not for Richard Smith's usual thoughtful analysis and feedback.
llvm-svn: 315840

7 years ago[Hexagon] Mark RangeTree::dump() with LLVM_DUMP_METHOD.
Davide Italiano [Sat, 14 Oct 2017 23:46:01 +0000 (23:46 +0000)]
[Hexagon] Mark RangeTree::dump() with LLVM_DUMP_METHOD.

GCC otherwise emits a "defined but not used" warning on the
member function.

llvm-svn: 315838

7 years agoAMDGPU: Temporary disable pal metadata check line in llvm-readobj test
Konstantin Zhuravlyov [Sat, 14 Oct 2017 23:42:11 +0000 (23:42 +0000)]
AMDGPU: Temporary disable pal metadata check line in llvm-readobj test

It fails on mips

llvm-svn: 315837

7 years agoRevert "Mark test as unsupported until r315808 is fixed"
Konstantin Zhuravlyov [Sat, 14 Oct 2017 22:24:31 +0000 (22:24 +0000)]
Revert "Mark test as unsupported until r315808 is fixed"

Test is fixed in r315830

llvm-svn: 315831

7 years agoAMDGPU: Don't use TargetStreamer if it has not been initialized
Konstantin Zhuravlyov [Sat, 14 Oct 2017 22:16:26 +0000 (22:16 +0000)]
AMDGPU: Don't use TargetStreamer if it has not been initialized

Fixes cfe/trunk/test/Misc/backend-resource-limit-diagnostics.cl
test after r315808

We may hit few other similar issues, but I want to discuss good
solution offline.

llvm-svn: 315830

7 years agoMark test as unsupported until r315808 is fixed
Bruno Cardoso Lopes [Sat, 14 Oct 2017 22:14:23 +0000 (22:14 +0000)]
Mark test as unsupported until r315808 is fixed

This is causing:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/43381

llvm-svn: 315829

7 years ago[X86] Remove a bunch of dead FileCheck lines with the wrong prefix.
Craig Topper [Sat, 14 Oct 2017 21:46:55 +0000 (21:46 +0000)]
[X86] Remove a bunch of dead FileCheck lines with the wrong prefix.

llvm-svn: 315828

7 years ago[xray] Fix CMake for X-RAY tests
George Karpenkov [Sat, 14 Oct 2017 21:38:13 +0000 (21:38 +0000)]
[xray] Fix CMake for X-RAY tests

Correctly depend on llvm-xray, make sure unit tests are being run.

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

llvm-svn: 315827

7 years ago[TableGen] Avoid unnecessary std::string creations
Simon Pilgrim [Sat, 14 Oct 2017 21:27:53 +0000 (21:27 +0000)]
[TableGen] Avoid unnecessary std::string creations

Avoid unnecessary std::string creations in the TreePredicateFn getters.

llvm-svn: 315826

7 years ago[X86][SSE] Don't attempt to reduce the imul vector width of odd sized vectors (PR34947)
Simon Pilgrim [Sat, 14 Oct 2017 19:57:19 +0000 (19:57 +0000)]
[X86][SSE] Don't attempt to reduce the imul vector width of odd sized vectors (PR34947)

llvm-svn: 315825

7 years ago[X86][SSE] Test vector imul reduction on 32 and 64-bit targets
Simon Pilgrim [Sat, 14 Oct 2017 19:46:08 +0000 (19:46 +0000)]
[X86][SSE] Test vector imul reduction on 32 and 64-bit targets

llvm-svn: 315824

7 years agoRevert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"
Bruno Cardoso Lopes [Sat, 14 Oct 2017 19:31:03 +0000 (19:31 +0000)]
Revert "[AArch64][RegisterBankInfo] Use the statically computed mappings for COPY"

This reverts commit r315781, breaks:
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/9882

llvm-svn: 315823

7 years agoAMDGPU: Add AMDGPU HSA Kernel Descriptor
Konstantin Zhuravlyov [Sat, 14 Oct 2017 19:17:08 +0000 (19:17 +0000)]
AMDGPU: Add AMDGPU HSA Kernel Descriptor

  - Update docs to match llvm coding style
  - Add missing FP16_OVFL bit for gfx9
  - Fix the size of the kernel descriptor in the docs

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

llvm-svn: 315822

7 years agoAMDGPU: Bring HSA metadata on par with the specification
Konstantin Zhuravlyov [Sat, 14 Oct 2017 19:03:51 +0000 (19:03 +0000)]
AMDGPU: Bring HSA metadata on par with the specification

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

llvm-svn: 315821

7 years agollvm-readobj: Print AMDGPU note contents
Konstantin Zhuravlyov [Sat, 14 Oct 2017 18:21:42 +0000 (18:21 +0000)]
llvm-readobj: Print AMDGPU note contents

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

llvm-svn: 315819

7 years agoPull out repeated calls to VT.getVectorNumElements(). NFCI.
Simon Pilgrim [Sat, 14 Oct 2017 17:37:42 +0000 (17:37 +0000)]
Pull out repeated calls to VT.getVectorNumElements(). NFCI.

llvm-svn: 315818

7 years agoCleanup update_llc_test_checks.py notes.
Simon Pilgrim [Sat, 14 Oct 2017 17:37:03 +0000 (17:37 +0000)]
Cleanup update_llc_test_checks.py notes.

llvm-svn: 315817

7 years agoAMDGPU: Cleanup elf-notes.ll test
Konstantin Zhuravlyov [Sat, 14 Oct 2017 17:36:53 +0000 (17:36 +0000)]
AMDGPU: Cleanup elf-notes.ll test

llvm-svn: 315816

7 years agoUse DAG::getBitcast() helper. NFCI.
Simon Pilgrim [Sat, 14 Oct 2017 17:14:42 +0000 (17:14 +0000)]
Use DAG::getBitcast() helper. NFCI.

llvm-svn: 315815

7 years agolibunwind: document tested FreeBSD configs and sort OS list
Ed Maste [Sat, 14 Oct 2017 17:04:04 +0000 (17:04 +0000)]
libunwind: document tested FreeBSD configs and sort OS list

libunwind is known to work on FreeBSD i386, amd64 (x86_64) and arm64.
It is the unwinder provided by the base system on all of those
architectures.

While here sort the OS list.

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

llvm-svn: 315814

7 years agollvm-readobj: Print AMDGPU note type names
Konstantin Zhuravlyov [Sat, 14 Oct 2017 16:43:46 +0000 (16:43 +0000)]
llvm-readobj: Print AMDGPU note type names

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

llvm-svn: 315813

7 years agoAMDGPU: Improve note directive verification in assembler
Konstantin Zhuravlyov [Sat, 14 Oct 2017 16:15:28 +0000 (16:15 +0000)]
AMDGPU: Improve note directive verification in assembler

  - Do not allow amd_amdgpu_isa directives on non-amdgcn architectures
  - Do not allow amd_amdgpu_hsa_metadata on non-amdhsa OSes
  - Do not allow amd_amdgpu_pal_metadata on non-amdpal OSes

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

llvm-svn: 315812

7 years agoRe-land r315787, "[Sema] Warn about unused variables if we can constant evaluate...
Benjamin Kramer [Sat, 14 Oct 2017 15:59:34 +0000 (15:59 +0000)]
Re-land r315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

The warnings in libc++ tests were fixed in the meantime.

llvm-svn: 315811

7 years agoAMDGPU: Do not emit deprecated notes for code object v3
Konstantin Zhuravlyov [Sat, 14 Oct 2017 15:59:07 +0000 (15:59 +0000)]
AMDGPU: Do not emit deprecated notes for code object v3

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

llvm-svn: 315810

7 years agoPlacate unused variable warnings uncovered by improvements to clang's -Wunused-variable
Benjamin Kramer [Sat, 14 Oct 2017 15:52:38 +0000 (15:52 +0000)]
Placate unused variable warnings uncovered by improvements to clang's -Wunused-variable

llvm-svn: 315809

7 years agoAMDGPU: Add support for isa version note
Konstantin Zhuravlyov [Sat, 14 Oct 2017 15:40:33 +0000 (15:40 +0000)]
AMDGPU: Add support for isa version note

  - Emit NT_AMD_AMDGPU_ISA
  - Add assembler parsing for isa version directive
    - If isa version directive does not match command line arguments, then return error

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

llvm-svn: 315808

7 years ago[X86][SSE] Support combining AND(EXTRACT(SHUF(X)), C) -> EXTRACT(SHUF(X))
Simon Pilgrim [Sat, 14 Oct 2017 15:01:36 +0000 (15:01 +0000)]
[X86][SSE] Support combining AND(EXTRACT(SHUF(X)), C) -> EXTRACT(SHUF(X))

If we are applying a byte mask to a value extracted from a shuffle, see if we can combine the mask into shuffle.

Fixes the last issue with PR22415

llvm-svn: 315807

7 years agoRevert rL315787, "[Sema] Warn about unused variables if we can constant evaluate...
NAKAMURA Takumi [Sat, 14 Oct 2017 14:46:04 +0000 (14:46 +0000)]
Revert rL315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

check-libcxx dislikes it.

llvm-svn: 315806