platform/upstream/llvm.git
6 years ago[WebAssembly] Remove unused header
Sam Clegg [Tue, 20 Feb 2018 21:08:28 +0000 (21:08 +0000)]
[WebAssembly] Remove unused header

llvm-svn: 325624

6 years ago[PatternMatch] enhance m_SignMask() to ignore undef elements in vectors
Sanjay Patel [Tue, 20 Feb 2018 21:02:40 +0000 (21:02 +0000)]
[PatternMatch] enhance m_SignMask() to ignore undef elements in vectors

llvm-svn: 325623

6 years ago[InstSimplify] add tests for m_SignMask with undef vector elements; NFC
Sanjay Patel [Tue, 20 Feb 2018 20:53:35 +0000 (20:53 +0000)]
[InstSimplify] add tests for m_SignMask with undef vector elements; NFC

llvm-svn: 325622

6 years ago[AArch64] Refactor instructions using SIMD immediates
Evandro Menezes [Tue, 20 Feb 2018 20:31:45 +0000 (20:31 +0000)]
[AArch64] Refactor instructions using SIMD immediates

Get rid of icky goto loops and make the code easier to maintain.  Otherwise,
NFC.

Restore r324903 and fix PR36369.

Differentail revision: https://reviews.llvm.org/D43364

llvm-svn: 325621

6 years ago[lld/LTO] Remove unused Path parameter to AddBufferFn
Teresa Johnson [Tue, 20 Feb 2018 20:21:59 +0000 (20:21 +0000)]
[lld/LTO] Remove unused Path parameter to AddBufferFn

Summary:
With D43396, no clients use the Path parameter anymore.
This is the lld side fix with D43400.

Depends on D43396 and D43400.

Reviewers: pcc

Subscribers: emaste, inglorion, arichardson, llvm-commits

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

llvm-svn: 325620

6 years ago[LTO] Remove unused Path parameter to AddBufferFn
Teresa Johnson [Tue, 20 Feb 2018 20:21:53 +0000 (20:21 +0000)]
[LTO] Remove unused Path parameter to AddBufferFn

Summary:
With D43396, no clients use the Path parameter anymore.

Depends on D43396.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 325619

6 years ago[ThinLTO/gold] Avoid race with cache pruner by copying to temp files
Teresa Johnson [Tue, 20 Feb 2018 19:51:30 +0000 (19:51 +0000)]
[ThinLTO/gold] Avoid race with cache pruner by copying to temp files

Summary:
This will avoid the race condition described in the review for D37993.

I believe that the Path parameter to AddBufferFn is no longer utilized.
I would prefer to remove that as a follow up clean up patch to reduce
the diffs in this patch.

Reviewers: pcc

Reviewed By: pcc

Subscribers: inglorion, llvm-commits

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

llvm-svn: 325618

6 years ago[LV] Fix test checks, NFC.
Alexey Bataev [Tue, 20 Feb 2018 19:49:25 +0000 (19:49 +0000)]
[LV] Fix test checks, NFC.

llvm-svn: 325617

6 years ago[ARM] Lower BR_CC for f16
Sjoerd Meijer [Tue, 20 Feb 2018 19:28:05 +0000 (19:28 +0000)]
[ARM] Lower BR_CC for f16

This case wasn't handled yet.

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

llvm-svn: 325616

6 years ago[AMDGPU] Removed redundant run lines for fmuladd.f16 test. NFC.
Stanislav Mekhanoshin [Tue, 20 Feb 2018 19:19:56 +0000 (19:19 +0000)]
[AMDGPU] Removed redundant run lines for fmuladd.f16 test. NFC.

llvm-svn: 325615

6 years agofeedback
Sam Clegg [Tue, 20 Feb 2018 18:55:07 +0000 (18:55 +0000)]
feedback

llvm-svn: 325614

6 years ago[WebAssembly] Split addDefined into two different methods. NFC.
Sam Clegg [Tue, 20 Feb 2018 18:55:06 +0000 (18:55 +0000)]
[WebAssembly] Split addDefined into two different methods. NFC.

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 325613

6 years ago[llvm-objdump] Use unique_ptr to simplify memory ownership
David Blaikie [Tue, 20 Feb 2018 18:48:51 +0000 (18:48 +0000)]
[llvm-objdump] Use unique_ptr to simplify memory ownership

Followup to r325099/r325100 to simplify further.

llvm-svn: 325612

6 years ago[X86][MMX] Regenerate MMX bitcast test
Simon Pilgrim [Tue, 20 Feb 2018 18:48:29 +0000 (18:48 +0000)]
[X86][MMX] Regenerate MMX bitcast test

llvm-svn: 325611

6 years agoCorrect multiversion unsupported target behavior, add a test.
Erich Keane [Tue, 20 Feb 2018 18:44:50 +0000 (18:44 +0000)]
Correct multiversion unsupported target behavior, add a test.

Multiversioning SEMA failed to set the declaration as invalid on unsupported
targets.  This patch does that.

Additionally, I noticed that there is no test to validate this error message.
This patch adds one, and uses 'mips' as the test architecture.

llvm-svn: 325610

6 years ago[X86][3DNow] Regenerate intrinsics tests
Simon Pilgrim [Tue, 20 Feb 2018 18:44:21 +0000 (18:44 +0000)]
[X86][3DNow] Regenerate intrinsics tests

llvm-svn: 325609

6 years ago[WebAssembly] Remove unused header
Sam Clegg [Tue, 20 Feb 2018 18:40:05 +0000 (18:40 +0000)]
[WebAssembly] Remove unused header

This header used to be needed here for the `OutRelocation` struct
but that no longer exists.

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

llvm-svn: 325608

6 years ago[IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454)
Sanjay Patel [Tue, 20 Feb 2018 18:21:43 +0000 (18:21 +0000)]
[IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454)

The bug was introduced here:
https://reviews.llvm.org/rL296409
...but the patch doesn't use maxnum and nothing else in
trunk has tried since then, so the bug went unnoticed.

llvm-svn: 325607

6 years ago[Hexagon] Handle *Low8 register classes in early if-conversion
Krzysztof Parzyszek [Tue, 20 Feb 2018 18:19:17 +0000 (18:19 +0000)]
[Hexagon] Handle *Low8 register classes in early if-conversion

llvm-svn: 325606

6 years ago[SLP] Fix tests checks, NFC.
Alexey Bataev [Tue, 20 Feb 2018 18:11:50 +0000 (18:11 +0000)]
[SLP] Fix tests checks, NFC.

llvm-svn: 325605

6 years ago[X86] Correct SHRUNKBLEND creation to work correctly when there are multiple uses...
Craig Topper [Tue, 20 Feb 2018 17:58:17 +0000 (17:58 +0000)]
[X86] Correct SHRUNKBLEND creation to work correctly when there are multiple uses of the condition.

SimplifyDemandedBits forces the demanded mask to all 1s if the node has multiple uses, unless the AssumeSingleUse flag is set.

So previously we were only really likely to simplify something if the condition had a single use. And on the off chance we did simplify with multiple uses the demanded mask being used was all ones so there was no reason to create a shrunkblend.

This patch now checks that the condition is only used by selects first, and then sets the AssumeSingleUse flag for the simplifcation. Then we convert the selects to shrunkblend, and finally replace condition.

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

llvm-svn: 325604

6 years ago[WebAssembly] Remove InputChunk from Symbol baseclass
Sam Clegg [Tue, 20 Feb 2018 17:45:38 +0000 (17:45 +0000)]
[WebAssembly] Remove InputChunk from Symbol baseclass

Instead include InputFuction and InputSegment directly
in the subclasses that use them (DefinedFunction and
DefinedGlobal).

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

llvm-svn: 325603

6 years ago[SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify...
Craig Topper [Tue, 20 Feb 2018 17:41:05 +0000 (17:41 +0000)]
[SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify DAGCombiner and simplifySetCC code and fix a bug.

DAGCombiner and SimplifySetCC both use getPointerTy for shift amounts pre-legalization. DAGCombiner uses a single helper function to hide this. SimplifySetCC does it in multiple places.

This patch adds a defaulted parameter to getShiftAmountTy that can make it return getPointerTy for scalar types. Use this parameter to simplify the SimplifySetCC and DAGCombiner.

Additionally, there were two places in SimplifySetCC that were creating shifts using the target's preferred shift amount pre-legalization. If the target uses a narrow type and the type is illegal, this can cause SimplfiySetCC to create a shift with an amount that can't represent all possible shift values for the type. To fix this we should use pointer type there too.

Alternatively we could make getScalarShiftAmountTy for each target return a safe value for large types as proposed in D43445. And maybe we should still do that, but fixing the SimplifySetCC code keeps other targets from tripping over this in the future.

Fixes PR36250.

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

llvm-svn: 325602

6 years ago[X86] Promote 16-bit cmovs to 32-bits
Craig Topper [Tue, 20 Feb 2018 17:41:00 +0000 (17:41 +0000)]
[X86] Promote 16-bit cmovs to 32-bits

This allows us to avoid an opsize prefix. And forcing some move immediates to i32 avoids a length changing prefix on those instructions.

This mostly replaces the existing combine we had for zext/sext+cmov of constants. I left in a case for sign extending a 32 bit cmov of constants to 64 bits.

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

llvm-svn: 325601

6 years ago[dsymutil] Correctly handle DW_TAG_label
Jonas Devlieghere [Tue, 20 Feb 2018 17:34:29 +0000 (17:34 +0000)]
[dsymutil] Correctly handle DW_TAG_label

This patch contains logic for handling DW_TAG_label that's present in
darwin's dsymutil implementation, but not yet upstream.

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

llvm-svn: 325600

6 years ago[vim] Recognize more FileCheck comments
Mikhail Maltsev [Tue, 20 Feb 2018 17:27:44 +0000 (17:27 +0000)]
[vim] Recognize more FileCheck comments

Summary:
Currently vim syntax highlighting recognizes 'CHECK:' as a special
comment, but not CHECK-DAG, CHECK-NOT and other CHECKs. This patch
adds rules for these comments.

Reviewers: chandlerc, compnerd, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, llvm-commits

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

llvm-svn: 325599

6 years ago[WebAssembly] Check signatures of weakly defined funtions too
Sam Clegg [Tue, 20 Feb 2018 17:20:44 +0000 (17:20 +0000)]
[WebAssembly] Check signatures of weakly defined funtions too

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 325598

6 years ago[InstCombine] remove unneeded dyn_cast to prevent unused variable warning
Sanjay Patel [Tue, 20 Feb 2018 17:14:53 +0000 (17:14 +0000)]
[InstCombine] remove unneeded dyn_cast to prevent unused variable warning

llvm-svn: 325597

6 years ago[clangd] Fix formatting in XRefs.cpp
Simon Marchi [Tue, 20 Feb 2018 16:57:47 +0000 (16:57 +0000)]
[clangd] Fix formatting in XRefs.cpp

This is also to test my commit access.

llvm-svn: 325596

6 years ago[InstCombine] remove compound fdiv pattern folds
Sanjay Patel [Tue, 20 Feb 2018 16:52:17 +0000 (16:52 +0000)]
[InstCombine] remove compound fdiv pattern folds

These are fdiv-with-constant-divisor, so they already become
reciprocal multiplies. The last gap for vector ops should be
closed with rL325590.

It's possible that we're missing folds for some edge cases
with denormal intermediate constants after deleting these,
but there are no tests for those patterns, and it would be
better to handle denormals more consistently (and less
conservatively) as noted in TODO comments.

llvm-svn: 325595

6 years agoPR36442: Correct description of -fsplit-dwarf-inlining
David Blaikie [Tue, 20 Feb 2018 16:35:08 +0000 (16:35 +0000)]
PR36442: Correct description of -fsplit-dwarf-inlining

llvm-svn: 325594

6 years agoStop linking sanitized applications with -lutil and -lkvm on NetBSD
Kamil Rytarowski [Tue, 20 Feb 2018 16:27:28 +0000 (16:27 +0000)]
Stop linking sanitized applications with -lutil and -lkvm on NetBSD

The proper approach is to rebuild libutil and libkvm with a desired sanitizer.
An alternative approach to reimplement these functions (and other ones like
curses(3), editline(3) etc) does not scale and enforces linkage every single
binary with these libraries.

llvm-svn: 325593

6 years ago[InstCombine] fold fdiv with non-splat divisor to fmul: X/C --> X * (1/C)
Sanjay Patel [Tue, 20 Feb 2018 16:08:15 +0000 (16:08 +0000)]
[InstCombine] fold fdiv with non-splat divisor to fmul: X/C --> X * (1/C)

llvm-svn: 325590

6 years ago[mips] Correct the definition of cvt.d.w
Simon Dardis [Tue, 20 Feb 2018 15:55:17 +0000 (15:55 +0000)]
[mips] Correct the definition of cvt.d.w

An upcoming patch D41434, changes the ordering of the matcher table
for assembly. This patch corrects the definition of the normal MIPS
cvt.d.w not to be available in microMIPS.

llvm-svn: 325589

6 years agoAdd new interceptor: strmode(3)
Kamil Rytarowski [Tue, 20 Feb 2018 15:53:30 +0000 (15:53 +0000)]
Add new interceptor: strmode(3)

Summary:
strmode - convert inode status information into a symbolic string

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325588

6 years agoAdd new interceptor: fgetln(3)
Kamil Rytarowski [Tue, 20 Feb 2018 15:52:08 +0000 (15:52 +0000)]
Add new interceptor: fgetln(3)

Summary:
fgetln - get a line from a stream

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg

Reviewed By: vitalybuka

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325587

6 years agoStop intercepting forkpty(3) and openpty(3) on NetBSD
Kamil Rytarowski [Tue, 20 Feb 2018 15:43:07 +0000 (15:43 +0000)]
Stop intercepting forkpty(3) and openpty(3) on NetBSD

Summary:
forkpty(3) and openpty(3) are part of `-lutil` and we don't intend to reimplement
this system library in sanitizers. Everybody using these functions will need to use
a precompiled library against MSan or other desired sanitizer.

Restrict these functions to Linux-only.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325585

6 years ago[DEBUGINFO] Add support for emission of the inlined strings.
Alexey Bataev [Tue, 20 Feb 2018 15:28:08 +0000 (15:28 +0000)]
[DEBUGINFO] Add support for emission of the inlined strings.

Summary:
Patch adds an option for emission of inlined strings rather than
.debug_str section.

Reviewers: echristo, jlebar

Subscribers: eraman, llvm-commits, JDevlieghere

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

llvm-svn: 325583

6 years ago[PowerPC] Reduce stack frame for fastcc functions by only allocating parameter save...
Lei Huang [Tue, 20 Feb 2018 15:09:45 +0000 (15:09 +0000)]
[PowerPC] Reduce stack frame for fastcc functions by only allocating parameter save area when needed

Current implementation always allocates the parameter save area conservatively
for fastcc functions. There is no reason to allocate the parameter save area if
all the parameters can be passed via registers.

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

llvm-svn: 325581

6 years ago[Hexagon] Fix alignment calculation of stack objects in Hexagon bit tracker
Krzysztof Parzyszek [Tue, 20 Feb 2018 14:29:43 +0000 (14:29 +0000)]
[Hexagon] Fix alignment calculation of stack objects in Hexagon bit tracker

llvm-svn: 325580

6 years ago[X86] Regenerate XOR tests
Simon Pilgrim [Tue, 20 Feb 2018 14:08:39 +0000 (14:08 +0000)]
[X86] Regenerate XOR tests

llvm-svn: 325579

6 years ago[VectorLegalizer] Fix uint64_t typo in ExpandUINT_TO_FLOAT (PR36391)
Simon Pilgrim [Tue, 20 Feb 2018 13:24:24 +0000 (13:24 +0000)]
[VectorLegalizer] Fix uint64_t typo in ExpandUINT_TO_FLOAT (PR36391)

ExpandUINT_TO_FLOAT can accept vXi32 or vXi64 inputs, so we need to use a uint64_t shift to generate the 2^(BW/2) constant.

No test case unfortunately as no upstream target uses this, but its affecting a downstream target.

llvm-svn: 325578

6 years agoRevert r325375 "[MS] Make constexpr static data members implicitly inline"
Hans Wennborg [Tue, 20 Feb 2018 12:43:02 +0000 (12:43 +0000)]
Revert r325375 "[MS] Make constexpr static data members implicitly inline"

This broke Clang bootstrap on Windows, PR36453.

> This handles them exactly the same way that we handle const integral
> static data members with inline definitions, which is what MSVC does.
>
> As a follow-up, now that we have a way to mark variables inline in the
> AST, we should consider marking them implicitly inline there instead of
> only treating them as inline in CodeGen. Unfortunately, this breaks a
> lot of dllimport test cases, so that is future work for now.
>
> Fixes PR36125.

llvm-svn: 325576

6 years ago[CodeGen] Fix generation of TBAA tags for may-alias accesses
Ivan A. Kosarev [Tue, 20 Feb 2018 12:33:04 +0000 (12:33 +0000)]
[CodeGen] Fix generation of TBAA tags for may-alias accesses

This patch fixes creating TBAA access descriptors for
may_alias-marked access types. Currently, for such types we
generate ordinary descriptors with char as its access type. The
patch changes this to produce proper may-alias descriptors.

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

llvm-svn: 325575

6 years ago[clangd] Dump stack on crash
Sam McCall [Tue, 20 Feb 2018 11:46:39 +0000 (11:46 +0000)]
[clangd] Dump stack on crash

llvm-svn: 325574

6 years ago[ARM] Mark -1 as cheap in xor's for thumb1
David Green [Tue, 20 Feb 2018 11:07:35 +0000 (11:07 +0000)]
[ARM] Mark -1 as cheap in xor's for thumb1

We can always convert xor %a, -1 into MVN, even in thumb 1 where the -1
would not otherwise be considered a cheap constant. This prevents the
-1's from being pulled out into constants and potentially hoisted.

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

llvm-svn: 325573

6 years ago[clang-tidy] Replace the usage of std::uncaught_exception with std::uncaught_exceptions
Gabor Horvath [Tue, 20 Feb 2018 10:48:38 +0000 (10:48 +0000)]
[clang-tidy] Replace the usage of std::uncaught_exception with std::uncaught_exceptions

Patch by: Daniel Kolozsvari!

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

llvm-svn: 325572

6 years agoclang-cl: Make /d1PP an alias for -dD (PR36446)
Hans Wennborg [Tue, 20 Feb 2018 10:47:14 +0000 (10:47 +0000)]
clang-cl: Make /d1PP an alias for -dD (PR36446)

llvm-svn: 325571

6 years agoAvoid dirtying the source tree in breakpoint command tests
Pavel Labath [Tue, 20 Feb 2018 10:24:37 +0000 (10:24 +0000)]
Avoid dirtying the source tree in breakpoint command tests

Summary:
The paralelization patch exposed a bunch of cases where we were still
touching the source tree (as these tests were now stepping on each
others toes and being flaky).

This patch removes such issues from breakpoint command tests. Since the
only reason they were creating files was to indirectly test whether the
breakpoint commands got executed (and plumbing the full build tree path
to all places that needed it would be messy) I decided to modify the
tests to check for a different side effect instead: modification of a
global variable. This also makes the code simpler as checking the value
of the global variable is easier, and there is nothing to clean up.

As the tests aren't really doing anything debug-info related, I took the
opportunity to also mark them as NO_DEBUG_INFO_TESTCASEs.

Reviewers: jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325570

6 years ago[llvm-mc] - Produce R_X86_64_PLT32 for "call/jmp foo".
George Rimar [Tue, 20 Feb 2018 10:17:57 +0000 (10:17 +0000)]
[llvm-mc] - Produce R_X86_64_PLT32 for "call/jmp foo".

For instructions like call foo and jmp foo patch changes
relocation produced from R_X86_64_PC32 to R_X86_64_PLT32.
Relocation can be used as a marker for 32-bit PC-relative branches.
Linker will reduce PLT32 relocation to PC32 if function is defined locally.

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

llvm-svn: 325569

6 years agoHandle typeof() expressions
Jonas Devlieghere [Tue, 20 Feb 2018 10:15:08 +0000 (10:15 +0000)]
Handle typeof() expressions

Before this patch, LLDB was not able to evaluate expressions that
resulted in a value with a typeof- or decltype-type. This patch fixes
that.

Before:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 =

After:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 = 1

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

rdar://37461520

llvm-svn: 325568

6 years ago[AMDGPU] stop buffer_store being moved illegally
Tim Renouf [Tue, 20 Feb 2018 10:03:38 +0000 (10:03 +0000)]
[AMDGPU] stop buffer_store being moved illegally

Summary:
The machine instruction scheduler was illegally moving a buffer store
past a buffer load with the same descriptor and offset. Fixed by marking
buffer ops as mayAlias and isAliased. This may be overly conservative,
and we may need to revisit.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits

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

Change-Id: Iff3173d9e0653e830474546276ab9d30318b8ef7
llvm-svn: 325567

6 years agoclang-format plugin: Add missing semicolon in list of file extensions (PR36383)
Hans Wennborg [Tue, 20 Feb 2018 09:26:38 +0000 (09:26 +0000)]
clang-format plugin: Add missing semicolon in list of file extensions (PR36383)

llvm-svn: 325566

6 years ago[MC] - Don't crash on unclosed frame.
George Rimar [Tue, 20 Feb 2018 09:04:13 +0000 (09:04 +0000)]
[MC] - Don't crash on unclosed frame.

llvm-mc can crash when
there is cfi_startproc without cfi_end_proc:

.text
.globl foo
foo:
 .cfi_startproc

Testcase shows the issue, patch fixes it.

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

llvm-svn: 325564

6 years ago[X86][CET]: Adding full coverage of MC encoding for the CET instructions.<NFC>
Gadi Haber [Tue, 20 Feb 2018 08:00:31 +0000 (08:00 +0000)]
[X86][CET]: Adding full coverage of MC encoding for the CET instructions.<NFC>

NFC.
Adding MC regressions tests to cover the CET instructions.
This patch is part of a larger task to cover MC encoding of all X86 isa sets started in revision: https://reviews.llvm.org/D39952

Reviewers: zvi, craig.topper, RKSimon, AndreiGrischenko, oren_ben_simhon
Differential Revision: https://reviews.llvm.org/D41329

Change-Id: I9c133d4ba07508ce8fd738a1230edd586e2c2f1b
llvm-svn: 325561

6 years ago[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.
Craig Topper [Tue, 20 Feb 2018 07:28:18 +0000 (07:28 +0000)]
[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.

We now use a vselect node in IR around an unmasked builtin. This makes it consistent with the 128 and 256 bit versions.

llvm-svn: 325560

6 years ago[X86] Add 512-bit unmasked pmulhrsw/pmulhw/pmulhuw intrinsics. Remove and auto upgrad...
Craig Topper [Tue, 20 Feb 2018 07:28:14 +0000 (07:28 +0000)]
[X86] Add 512-bit unmasked pmulhrsw/pmulhw/pmulhuw intrinsics. Remove and auto upgrade 128/256/512 bit masked pmulhrsw/pmulhw/pmulhuw intrinsics.

The 128 and 256 bit versions were already not used by clang. This adds an equivalent unmasked 512 bit version. Then autoupgrades all sizes to use unmasked intrinsics plus select.

llvm-svn: 325559

6 years agoUse isl::manage_copy to simplify calls to isl::manage(isl_.._copy())
Tobias Grosser [Tue, 20 Feb 2018 07:26:58 +0000 (07:26 +0000)]
Use isl::manage_copy to simplify calls to isl::manage(isl_.._copy())

As part of this cleanup a couple of unnecessary isl::manage(obj.copy()) pattern
are eliminated as well.

We checked for all potential cleanups by scanning for:

  "grep -R isl::manage\( lib/ | grep copy"

llvm-svn: 325558

6 years agoUpdate isl to isl-0.18-1047-g4a20ef8
Tobias Grosser [Tue, 20 Feb 2018 07:26:42 +0000 (07:26 +0000)]
Update isl to isl-0.18-1047-g4a20ef8

This update:

  - Removes several deprecated functions (e.g., isl_band).
  - Improves the pretty-printing of sets by detecting modulos and "false"
    equalities.
  - Minor improvements to coalescing and increased robustness of the isl
    scheduler.

This update does not yet include isl commit isl-0.18-90-gd00cb45
(isl_pw_*_alloc: add missing check for compatible spaces, Wed Sep 6 12:18:04
2017 +0200), as this additional check is too tight and unfortunately causes
two test case failures in Polly. A patch has been submitted to isl and will be
included in the next isl update for Polly.

llvm-svn: 325557

6 years agoFix broken isl-noexceptions.h path in update-isl script
Tobias Grosser [Tue, 20 Feb 2018 07:24:58 +0000 (07:24 +0000)]
Fix broken isl-noexceptions.h path in update-isl script

llvm-svn: 325556

6 years agoUpdate isl C++ bindings to latest version of isl
Tobias Grosser [Tue, 20 Feb 2018 07:24:55 +0000 (07:24 +0000)]
Update isl C++ bindings to latest version of isl

llvm-svn: 325555

6 years agoDo not call band_list().dump()
Tobias Grosser [Tue, 20 Feb 2018 07:24:40 +0000 (07:24 +0000)]
Do not call band_list().dump()

This is in preparation for the removal of band_list from isl.

llvm-svn: 325554

6 years ago[Sema] Fix -Wunused-variable
Sam McCall [Tue, 20 Feb 2018 07:21:56 +0000 (07:21 +0000)]
[Sema] Fix -Wunused-variable

llvm-svn: 325553

6 years ago[X86] Remove GCCBuiltin from a bunch of intrinsics that aren't used by clang and...
Craig Topper [Tue, 20 Feb 2018 05:49:22 +0000 (05:49 +0000)]
[X86] Remove GCCBuiltin from a bunch of intrinsics that aren't used by clang and should be removed.

llvm-svn: 325552

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Tue, 20 Feb 2018 05:41:26 +0000 (05:41 +0000)]
Report fatal error in the case of out of memory

This is the second part of recommit of r325224. The previous part was
committed in r325426, which deals with C++ memory allocation. Solution
for C memory allocation involved functions `llvm::malloc` and similar.
This was a fragile solution because it caused ambiguity errors in some
cases. In this commit the new functions have names like `llvm::safe_malloc`.

The relevant part of original comment is below, updated for new function
names.

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

In some cases memory is allocated by a call to some of C allocation
functions, malloc, calloc and realloc. They are used for interoperability
with C code, when allocated object has variable size and when it is
necessary to avoid call of constructors. In many calls the result is not
checked for null pointer. To simplify checks, new functions are defined
in the namespace 'llvm': `safe_malloc`, `safe_calloc` and `safe_realloc`.
They behave as corresponding standard functions but produce fatal error if
allocation fails. This change replaces the standard functions like 'malloc'
in the cases when the result of the allocation function is not checked
for null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statement is added.

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

llvm-svn: 325551

6 years ago[AArch64][GlobalISel] When copying from a gpr32 to an fpr16 reg, convert to fpr32...
Amara Emerson [Tue, 20 Feb 2018 05:11:57 +0000 (05:11 +0000)]
[AArch64][GlobalISel] When copying from a gpr32 to an fpr16 reg, convert to fpr32 first.

This is a follow on commit to r[x] where we fix the other direction of copy.
For this case, after converting the source from gpr32 -> fpr32, we use a
subregister copy, which is essentially what EXTRACT_SUBREG does in SDAG land.

https://reviews.llvm.org/D43444

llvm-svn: 325550

6 years agoDo not create a temporary data structure for relocations.
Rui Ueyama [Tue, 20 Feb 2018 04:26:26 +0000 (04:26 +0000)]
Do not create a temporary data structure for relocations.

This patch removes `OutRelocations` vector from the InputChunk and
directly consume `Relocations` vector instead. This should make the linker
faster because we don't create a temporary data structure, and it matches
the lld's design principle that we don't create temporary data structures
for object files but instead directly consume mmap'ed data whenever possible.

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

llvm-svn: 325549

6 years ago[X86] Mark XOP vpmac* and vpmadc intrinsics as being commutative so that tablegen...
Craig Topper [Tue, 20 Feb 2018 03:58:14 +0000 (03:58 +0000)]
[X86] Mark XOP vpmac* and vpmadc intrinsics as being commutative so that tablegen will generate patterns with the load in operand 0.

This allows loads to be folded during isel without the peephole pass.

llvm-svn: 325548

6 years ago[X86] Make XOP VPCOM instructions commutable to fold loads during isel.
Craig Topper [Tue, 20 Feb 2018 03:58:13 +0000 (03:58 +0000)]
[X86] Make XOP VPCOM instructions commutable to fold loads during isel.

llvm-svn: 325547

6 years ago[X86] Make a helper function for commuting AVX512 VPCMP immediates since we do it...
Craig Topper [Tue, 20 Feb 2018 03:58:11 +0000 (03:58 +0000)]
[X86] Make a helper function for commuting AVX512 VPCMP immediates since we do it in two places.

llvm-svn: 325546

6 years agoFix some -Wexceptions false positives.
Richard Smith [Tue, 20 Feb 2018 02:32:30 +0000 (02:32 +0000)]
Fix some -Wexceptions false positives.

Reimplement the "noexcept function actually throws" warning to properly handle
nested try-blocks. In passing, change 'throw;' handling to treat any enclosing
try block as being sufficient to suppress the warning rather than requiring a
'catch (...)'; the warning is intended to be conservatively-correct.

llvm-svn: 325545

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Feb 2018 02:16:28 +0000 (02:16 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 325544

6 years ago[GISel]: Add pattern matchers for G_BITCAST/PTRTOINT/INTTOPTR
Aditya Nandakumar [Mon, 19 Feb 2018 23:11:53 +0000 (23:11 +0000)]
[GISel]: Add pattern matchers for G_BITCAST/PTRTOINT/INTTOPTR

Adds pattern matchers for the above along with unit tests for the same.
https://reviews.llvm.org/D43479

llvm-svn: 325542

6 years ago[InstCombine] use CreateWithCopiedFlags to reduce code; NFCI
Sanjay Patel [Mon, 19 Feb 2018 23:09:03 +0000 (23:09 +0000)]
[InstCombine] use CreateWithCopiedFlags to reduce code; NFCI

Also, move the folds with constants closer to make it easier to follow.

llvm-svn: 325541

6 years agoFix test failure on target where size_t is long long.
Richard Smith [Mon, 19 Feb 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure on target where size_t is long long.

llvm-svn: 325540

6 years agoRevert "[mem2reg] Use range loops (NFCI)"
Brian Gesiak [Mon, 19 Feb 2018 22:48:51 +0000 (22:48 +0000)]
Revert "[mem2reg] Use range loops (NFCI)"

This reverts commit r325532.

llvm-svn: 325539

6 years agoMerge two small functions and add comments.
Rui Ueyama [Mon, 19 Feb 2018 22:44:18 +0000 (22:44 +0000)]
Merge two small functions and add comments.

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

llvm-svn: 325538

6 years agoRemoved a variable that is used only once.
Rui Ueyama [Mon, 19 Feb 2018 22:39:52 +0000 (22:39 +0000)]
Removed a variable that is used only once.

llvm-svn: 325537

6 years ago[WebAssembly] Expand a lambda that is used only once.
Rui Ueyama [Mon, 19 Feb 2018 22:34:47 +0000 (22:34 +0000)]
[WebAssembly] Expand a lambda that is used only once.

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

llvm-svn: 325536

6 years ago[WebAssembly] Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.
Rui Ueyama [Mon, 19 Feb 2018 22:29:48 +0000 (22:29 +0000)]
[WebAssembly] Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.

Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.

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

llvm-svn: 325535

6 years ago[X86] Use vpmovq2m/vpmovd2m for truncate to vXi1 when possible.
Craig Topper [Mon, 19 Feb 2018 22:07:31 +0000 (22:07 +0000)]
[X86] Use vpmovq2m/vpmovd2m for truncate to vXi1 when possible.

Previously we used vptestmd, but the scheduling data for SKX says vpmovq2m/vpmovd2m is lower latency. We already used vpmovb2m/vpmovw2m for byte/word truncates. So this is more consistent anyway.

llvm-svn: 325534

6 years ago[InstCombine] allow fdiv with constant dividend folds with less than full -ffast...
Sanjay Patel [Mon, 19 Feb 2018 21:46:52 +0000 (21:46 +0000)]
[InstCombine] allow fdiv with constant dividend folds with less than full -ffast-math

It's possible that we could allow this either 'arcp' or 'reassoc' alone, but this
should be conservatively better than what we have right now. GCC allows this with
only -freciprocal-math.

The last test is changed to show a case that is expected to fold, but we need D43398.

llvm-svn: 325533

6 years ago[mem2reg] Use range loops (NFCI)
Brian Gesiak [Mon, 19 Feb 2018 21:44:52 +0000 (21:44 +0000)]
[mem2reg] Use range loops (NFCI)

Summary:
Several for loops in PromoteMemoryToRegister.cpp leave their increment
expression empty, instead incrementing the iterator within the for loop
body. I believe this is because these loops were previously implemented
as while loops; see https://reviews.llvm.org/rL188327.

Incrementing the iterator within the body of the for loop instead of
in its increment expression makes it seem like the iterator will be
modified or conditionally incremented within the loop, but that is not
the case in these loops.

Instead, use range loops.

Test Plan: `check-llvm`

Reviewers: davide, bkramer

Reviewed By: davide, bkramer

Subscribers: llvm-commits

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

llvm-svn: 325532

6 years ago[InstCombine] refactor fdiv with constant dividend folds; NFC
Sanjay Patel [Mon, 19 Feb 2018 21:17:58 +0000 (21:17 +0000)]
[InstCombine] refactor fdiv with constant dividend folds; NFC

The last fold that used to be here was not necessary. That's a
combination of 2 folds (and there's a regression test to show that).

The transforms are guarded by isFast(), but that should be loosened.

llvm-svn: 325531

6 years ago[InstCombine] move fdiv tests; NFC
Sanjay Patel [Mon, 19 Feb 2018 21:13:39 +0000 (21:13 +0000)]
[InstCombine] move fdiv tests; NFC

Also, use vector constants just to prove that already works.

llvm-svn: 325530

6 years ago[Coroutines] Move debug statement before assert
Brian Gesiak [Mon, 19 Feb 2018 20:50:09 +0000 (20:50 +0000)]
[Coroutines] Move debug statement before assert

Summary:
Move a debug statement to above where an assertion is hit, so that the debug
statement can be inspected before a stack trace.

Test Plan: `check-llvm`

llvm-svn: 325529

6 years ago[llvm-objcopy] Use the full filename in --add-gnu-debuglink
Alexander Richardson [Mon, 19 Feb 2018 19:53:44 +0000 (19:53 +0000)]
[llvm-objcopy] Use the full filename in --add-gnu-debuglink

Summary:
The current implementation was writing the file name without the extension
whereas GNU objcopy writes the full filename. With this change GDB will now
load the .debug file instead of silently ignoring it.

Reviewers: jakehehrlich, jhenderson

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 325528

6 years ago[X86] Stop swapping the operands of AVX512 setge.
Craig Topper [Mon, 19 Feb 2018 19:23:35 +0000 (19:23 +0000)]
[X86] Stop swapping the operands of AVX512 setge.

We swapped the operands and used setle, but I don't see any reason to do that. I think this is a holdover from SSE where we swap and the invert to use pcmpgt. But with AVX512 we don't want an invert so we won't use pcmpgt. So there's no need to swap.

llvm-svn: 325527

6 years ago[X86] Reduce the number of isel pattern variations needed for VPTESTM/VPTESTNM matching.
Craig Topper [Mon, 19 Feb 2018 19:23:31 +0000 (19:23 +0000)]
[X86] Reduce the number of isel pattern variations needed for VPTESTM/VPTESTNM matching.

Canonicalize EQ/NE PCMPM to have build vector all zeros on the RHS so we don't have to pattern match it in both locations. This significantly reduces the number of isel patterns needed since we also had to multiply it out with loads being in either operand of the 'and' input node and in the 'and' masking node.

This removes over 24000 bytes from the isel table.

llvm-svn: 325526

6 years agobitcode support change for fast flags compatibility
Steven Wu [Mon, 19 Feb 2018 19:22:28 +0000 (19:22 +0000)]
bitcode support change for fast flags compatibility

Summary: The discussion and as per need, each vendor needs a way to keep the old fast flags and the new fast flags in the auto upgrade path of the IR upgrader.  This revision addresses that issue.

Patched by Michael Berg

Reviewers: qcolombet, hans, steven_wu

Reviewed By: qcolombet, steven_wu

Subscribers: dexonsmith, vsk, mehdi_amini, andrewrk, MatzeB, wristow, spatel

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

llvm-svn: 325525

6 years ago[AMDGPU] Make note of existing waitcnt instrs; this is add-on work related to suppres...
Mark Searles [Mon, 19 Feb 2018 19:19:59 +0000 (19:19 +0000)]
[AMDGPU] Make note of existing waitcnt instrs; this is add-on work related to suppression of redundant waitcnt instrs. It is necessary to make note of these existing waitcnt instrs so that we do not fall into an infinite loop when handling loops. Also, [NFC] some minor code clean-up.

llvm-svn: 325524

6 years ago[clangd] Fixes for #include insertion.
Eric Liu [Mon, 19 Feb 2018 18:48:44 +0000 (18:48 +0000)]
[clangd] Fixes for #include insertion.

Summary:
o Avoid inserting a header include into the header itself.
o Avoid inserting non-header files (by not indexing symbols in main
files at all).
o Canonicalize include paths for symbols in dynamic index.

Reviewers: sammccall, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325523

6 years ago[clangd] Do not reuse preamble if compile args changed
Ilya Biryukov [Mon, 19 Feb 2018 18:18:49 +0000 (18:18 +0000)]
[clangd] Do not reuse preamble if compile args changed

Reviewers: hokein, ioeric, sammccall, simark

Reviewed By: simark

Subscribers: klimek, jkorous-apple, cfe-commits, simark

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

llvm-svn: 325522

6 years ago[SelectionDAG] ComputeKnownBits - add support for SMIN+SMAX clamp patterns
Simon Pilgrim [Mon, 19 Feb 2018 18:08:16 +0000 (18:08 +0000)]
[SelectionDAG] ComputeKnownBits - add support for SMIN+SMAX clamp patterns

If we have a clamp pattern, SMIN(SMAX(X, LO),HI) or SMAX(SMIN(X, HI),LO) then we can deduce that the number of signbits (zeros/ones) will be at least the minimum of the LO and HI constants.

ComputeKnownBits equivalent of D43338.

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

llvm-svn: 325521

6 years agoAdd several more attributes to be parsed in C with [[]] when -fdouble-square-bracket...
Aaron Ballman [Mon, 19 Feb 2018 17:32:07 +0000 (17:32 +0000)]
Add several more attributes to be parsed in C with [[]] when -fdouble-square-bracket-attributes is specified.

Also flags a few attributes that should not be available with the C spelling as they only matter in C++.

llvm-svn: 325520

6 years agoTwo more dosep-paralellization fallout fixes
Pavel Labath [Mon, 19 Feb 2018 17:23:13 +0000 (17:23 +0000)]
Two more dosep-paralellization fallout fixes

The first issue is about the flaky test rerun logic. This was grouping
tests by subdir and passing them into walk_and_invoke in the incorrect
form. This part can be just deleted as its not needed anymore.

The second problem (which I noticed while investigating the first one)
was that the "-p" switch was not working in multiprocessing mode. This
happened because we were returning None from process_file instead of a
tuple full of empty values for tests that did not match the -p regex.

Both of these would be caught earlier if python was a more strongly
typed language. :/

llvm-svn: 325519

6 years ago[AMDGPU] Increased vector length for global/constant loads.
Mark Searles [Mon, 19 Feb 2018 16:42:49 +0000 (16:42 +0000)]
[AMDGPU] Increased vector length for global/constant loads.

Summary: GCN ISA supports instructions that can read 16 consecutive dwords from memory through the scalar data cache; loadstoreVectorizer should take advantage of the wider vector length and pack 16/8 elements of dwords/quadwords.

Author: FarhanaAleen

Reviewed By: rampitec

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 325518

6 years ago[Dominators] Update DominatorTree compare in case roots are different
David Green [Mon, 19 Feb 2018 16:28:24 +0000 (16:28 +0000)]
[Dominators] Update DominatorTree compare in case roots are different

The compare function, unusually, returns false on same, true on
different. This fixes the conditions for different roots.

Reviewed as a part of D41298.

llvm-svn: 325517

6 years ago[CodeGen] Refactor AppleAccelTable
Pavel Labath [Mon, 19 Feb 2018 16:12:20 +0000 (16:12 +0000)]
[CodeGen] Refactor AppleAccelTable

Summary:
This commit separates the abstract accelerator table data structure
from the code for writing out an on-disk representation of a specific
accelerator table format. The idea is that former (now called
AccelTable<T>) can be reused for the DWARF v5 accelerator tables
as-is, without any further customizations.

Some bits of the emission code (now living in the EmissionContext class)
can be reused for DWARF v5 as well, but the subtle differences in the
layout of various subtables mean the sharing is not always possible.
(Also, the individual emit*** functions are fairly simple so there's a
tradeoff between making a bigger general-purpose function, and two
smaller targeted functions.)

Another advantage of this setup is that more of the serialization logic
can be hidden in the .cpp file -- I have moved declarations of the
header and all the emission functions there.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: echristo, clayborg, vleschuk, llvm-commits

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

llvm-svn: 325516

6 years ago[TTI CostModel] change default cost of FP ops to 1 (PR36280)
Sanjay Patel [Mon, 19 Feb 2018 16:11:44 +0000 (16:11 +0000)]
[TTI CostModel] change default cost of FP ops to 1 (PR36280)

This change was mentioned at least as far back as:
https://bugs.llvm.org/show_bug.cgi?id=26837#c26
...and I found a real program that is harmed by this:
Himeno running on AMD Jaguar gets 6% slower with SLP vectorization:
https://bugs.llvm.org/show_bug.cgi?id=36280
...but the change here appears to solve that bug only accidentally.

The div/rem costs for x86 look very wrong in some cases, but that's already true,
so we can fix those in follow-up patches. There's also evidence that more cost model
changes are needed to solve SLP problems as shown in D42981, but that's an independent
problem (though the solution may be adjusted after this change is made).

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

llvm-svn: 325515