]> granicus.if.org Git - llvm/log
llvm
5 years agogn build: Merge r360116
Nico Weber [Tue, 7 May 2019 13:07:23 +0000 (13:07 +0000)]
gn build: Merge r360116

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360141 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Tue, 7 May 2019 13:02:18 +0000 (13:02 +0000)]
gn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360140 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] BenchmarkRunner::runConfiguration(): write small snippet to memory
Roman Lebedev [Tue, 7 May 2019 12:28:08 +0000 (12:28 +0000)]
[llvm-exegesis] BenchmarkRunner::runConfiguration(): write small snippet to memory

It was previously writing this temporary snippet to file,
then reading it back, but leaving the tmp file in place.
This is both unefficient, and results in huge garbage pileup
in /tmp.

One would have thought it would have been caught during D60317..

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360138 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj] - Allow setting st_value explicitly for Symbol.
George Rimar [Tue, 7 May 2019 12:10:51 +0000 (12:10 +0000)]
[yaml2obj] - Allow setting st_value explicitly for Symbol.

In some cases it is useful to explicitly set symbol's st_name value.
For example, I am using it in a patch for LLD to remove the broken
binary from a test case and replace it with a YAML test.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360137 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[TableGen] Fix a typo"
Krasimir Georgiev [Tue, 7 May 2019 11:39:35 +0000 (11:39 +0000)]
Revert "[TableGen] Fix a typo"

Summary:
This reverts commit r360106.

The revisioin causes llvm-tblgen to hang while generating info for
RISCV.td. The root cause might be in the RISCV.td definition but I don't
know enough about this to investigate further.

Command that starts hangning after r360106:
`llvm-build/bin/llvm-tblgen -I llvm/include -I llvm/tools/clang/include -I llvm/lib/Target/RISCV -gen-instr-info llvm/lib/Target/RISCV/RISCV.td`

Reviewers: sammccall, yan_luo, craig.topper, gribozavr

Reviewed By: gribozavr

Subscribers: PkmX, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360136 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM GlobalISel] Widen G_SELECT operands
Diana Picus [Tue, 7 May 2019 11:39:30 +0000 (11:39 +0000)]
[ARM GlobalISel] Widen G_SELECT operands

...except for the condition operand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360135 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][AVX] Fold concat(packus(),packus()) -> packus(concat(),concat()) (PR34773)
Simon Pilgrim [Tue, 7 May 2019 11:17:39 +0000 (11:17 +0000)]
[X86][AVX] Fold concat(packus(),packus()) -> packus(concat(),concat()) (PR34773)

Basic "revectorization" combine, we can probably do more opcodes here but it can be a tricky cost-benefit depending on where the subvectors came from - but this case helps shuffle combining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360134 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixed "Value stored to 'Opc' is never read" warning. NFCI.
Simon Pilgrim [Tue, 7 May 2019 11:09:16 +0000 (11:09 +0000)]
Fixed "Value stored to 'Opc' is never read" warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360133 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Reduce scope of variables where possible. NFCI.
Simon Pilgrim [Tue, 7 May 2019 10:50:11 +0000 (10:50 +0000)]
[X86] Reduce scope of variables where possible. NFCI.

Fixes cppcheck warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360131 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM GlobalISel] Widen G_INTTOPTR/G_PTRTOINT
Diana Picus [Tue, 7 May 2019 10:48:01 +0000 (10:48 +0000)]
[ARM GlobalISel] Widen G_INTTOPTR/G_PTRTOINT

We actually have a couple of G_PTRTOINT to s8 when building clang, so
we should do something about them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360130 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix uninitialized variable warning. NFCI.
Simon Pilgrim [Tue, 7 May 2019 10:30:22 +0000 (10:30 +0000)]
Fix uninitialized variable warning. NFCI.

This also fixes a scan-build "array subscript is undefined" warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360128 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM GlobalISel] Widen G_GEP index operand
Diana Picus [Tue, 7 May 2019 10:11:57 +0000 (10:11 +0000)]
[ARM GlobalISel] Widen G_GEP index operand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360127 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit access
Orlando Cazalet-Hyams [Tue, 7 May 2019 09:30:55 +0000 (09:30 +0000)]
Test commit access

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360125 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()
Roman Lebedev [Tue, 7 May 2019 09:21:13 +0000 (09:21 +0000)]
[llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()

This *APPEARS* to fix a *very* infuriating issue of Yaml's being corrupted,
partially written, truncated. Or at least i'm not seeing the issue
on a new benchmark sweep.

The issue is somewhat rare, happens maybe once in 1000 benchmarks.
Which means there are up to hundreds of broken benchmarks
for a full x86 sweep in a single mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360124 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Verify that SOP2/SOPC instructions have at most one immediate operand
Nicolai Haehnle [Tue, 7 May 2019 09:19:09 +0000 (09:19 +0000)]
AMDGPU: Verify that SOP2/SOPC instructions have at most one immediate operand

Summary:
No test case because I don't know of a way to trigger this, but I
accidentally caused this to fail while working on a different change.

Change-Id: I8015aa447fe27163cc4e4902205a203bd44bf7e3

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360123 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FastISel][X86] If selectFNeg fails, fall back to SelectionDAG not treating it as...
Craig Topper [Tue, 7 May 2019 04:25:24 +0000 (04:25 +0000)]
[FastISel][X86] If selectFNeg fails, fall back to SelectionDAG not treating it as an fsub.

Summary:
If fneg lowering for fsub -0.0, x fails we currently fall back to treating it as an fsub. This has different behavior for nans than the xor with sign bit trick we normally try to do. On X86, the xor trick for double fails fast-isel in 32-bit mode with sse2 due to 64 bit integer types not being available. With -O2 we would always use an xorpd for this case. If we use subsd, this creates an observable behavior difference between -O0 and -O2. So fall back to SelectionDAG if we can't fast-isel it, that way SelectionDAG will use the xorpd.

I believe this patch is restoring the behavior prior to r345295 from last October. This was missed then because our fast isel case in 32-bit mode aborted fast-isel earlier for another reason. But I've added new tests to cover that.

Reviewers: andrew.w.kaylor, cameron.mcinally, spatel, efriedma

Reviewed By: cameron.mcinally

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360111 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add more test coverage for reloctions against section symbols
Sam Clegg [Tue, 7 May 2019 03:53:16 +0000 (03:53 +0000)]
[WebAssembly] Add more test coverage for reloctions against section symbols

The only known user of this relocation type and symbol type is
the debug info sections, but we were not testing the `--relocatable`
output path.

This change adds a minimal test case to cover relocations against
section symbols includes `--relocatable` output.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360110 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Delete TypedDINodeRef
Fangrui Song [Tue, 7 May 2019 02:06:37 +0000 (02:06 +0000)]
[DebugInfo] Delete TypedDINodeRef

TypedDINodeRef<T> is a redundant wrapper of Metadata * that is actually a T *.

Accordingly, change DI{Node,Scope,Type}Ref uses to DI{Node,Scope,Type} * or their const variants.
This allows us to delete many resolve() calls that clutter the code.

Reviewed By: rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360108 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline...
Fangrui Song [Tue, 7 May 2019 01:39:37 +0000 (01:39 +0000)]
[SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters

Fixes the main issue in PR41693

When both modes are used, two functions are created:
`sancov.module_ctor`, `sancov.module_ctor.$LastUnique`, where
$LastUnique is the current LastUnique counter that may be different in
another module.

`sancov.module_ctor.$LastUnique` belongs to the comdat group of the same
name (due to the non-null third field of the ctor in llvm.global_ctors).

    COMDAT group section [    9] `.group' [sancov.module_ctor] contains 6 sections:
       [Index]    Name
       [   10]   .text.sancov.module_ctor
       [   11]   .rela.text.sancov.module_ctor
       [   12]   .text.sancov.module_ctor.6
       [   13]   .rela.text.sancov.module_ctor.6
       [   23]   .init_array.2
       [   24]   .rela.init_array.2

    # 2 problems:
    # 1) If sancov.module_ctor in this module is discarded, this group
    # has a relocation to a discarded section. ld.bfd and gold will
    # error. (Another issue: it is silently accepted by lld)
    # 2) The comdat group has an unstable name that may be different in
    # another translation unit. Even if the linker allows the dangling relocation
    # (with --noinhibit-exec), there will be many undesired .init_array entries
    COMDAT group section [   25] `.group' [sancov.module_ctor.6] contains 2 sections:
       [Index]    Name
       [   26]   .init_array.2
       [   27]   .rela.init_array.2

By using different module ctor names, the associated comdat group names
will also be different and thus stable across modules.

Reviewed By: morehouse, phosek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360107 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TableGen] Fix a typo
Yan Luo [Tue, 7 May 2019 01:07:46 +0000 (01:07 +0000)]
[TableGen] Fix a typo

Check "Big" instead of "Small" in the second condition.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360106 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRefactor UnaryOperator class
Cameron McInally [Tue, 7 May 2019 00:10:12 +0000 (00:10 +0000)]
Refactor UnaryOperator class

The UnaryOperator class was originally placed in llvm/IR/Instructions.h, with the other UnaryInstructions. However, I'm now thinking that it makes more sense for it to live in llvm/IR/InstrTypes.h, with BinaryOperator. It is more similar to BinaryOperator than any of the other UnaryInstructions.

NFCI

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360103 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use extended vector register classes in getRegForInlineAsmConstraint to support...
Craig Topper [Mon, 6 May 2019 23:57:42 +0000 (23:57 +0000)]
[X86] Use extended vector register classes in getRegForInlineAsmConstraint to support x/y/zmm16-31 when the type is mismatched.

The FR32/FR64/VR128/VR256 register classes don't contain the upper 16 registers. For most cases we use the default implementation which will find any register class that contains the register in question if the VT is legal for the register class. But if the VT is i32 or i64, we won't find a matching register class and will instead up in the code modified in this patch.

If the requested register is x/y/zmm16-31 we weren't returning a register class that contains those registers and will hit an assertion in the caller.

To fix this, I've changed to use the extended register class instead. I don't believe we need a subtarget check to see if avx512 is enabled. The default implementation just pick whatever register class it finds first. I checked and we currently pick FR32X for XMM0 with an f32 type using the default implementation regardless of whether avx512 is enabled. So I assume its it is ok to do the same for i32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360102 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix bug in getCompleteTypeIndex in codeview debug info
Amy Huang [Mon, 6 May 2019 23:37:03 +0000 (23:37 +0000)]
Fix bug in getCompleteTypeIndex in codeview debug info

Summary:
When there are multiple instances of a forward decl record type, only the first one is emitted with a type index, because
the type is added to a map with a null type index. Avoid this by reordering so that forward decl types aren't added to the map.

Reviewers: rnk

Subscribers: aprantl, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360101 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Glue register copies to tail calls.
Eli Friedman [Mon, 6 May 2019 23:21:59 +0000 (23:21 +0000)]
[ARM] Glue register copies to tail calls.

This generally follows what other targets do. I don't completely
understand why the special case for tail calls existed in the first
place; even when the code was committed in r105413, call lowering didn't
work in the way described in the comments.

Stack protector lowering breaks if the register copies are not glued to
a tail call: we have to insert the stack protector check before the tail
call, and we choose the location based on the assumption that all
physical register dependencies of a tail call are adjacent to the tail
call. (See FindSplitPointForStackProtector.) This is sort of fragile,
but I don't see any reason to break that assumption.

I'm guessing nobody has seen this before just because it's hard to
convince the scheduler to actually schedule the code in a way that
breaks; even without the glue, the only computation that could actually
be scheduled after the register copies is the computation of the call
address, and the scheduler usually prefers to schedule that before the
copies anyway.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360099 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FastISel] Pass the fneg input operand to hasTrivialKill in FastISel::selectFNeg.
Craig Topper [Mon, 6 May 2019 23:09:09 +0000 (23:09 +0000)]
[FastISel] Pass the fneg input operand to hasTrivialKill in FastISel::selectFNeg.

We're trying to calculate the kill flag for OpReg which is the input so we need to pass the input here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360097 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test case to show that we don't set the kill flag properly for fast isel...
Craig Topper [Mon, 6 May 2019 23:08:17 +0000 (23:08 +0000)]
[X86] Add test case to show that we don't set the kill flag properly for fast isel handling of fneg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360096 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010 verifier changes
Stanislav Mekhanoshin [Mon, 6 May 2019 22:49:45 +0000 (22:49 +0000)]
[AMDGPU] gfx1010 verifier changes

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360095 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010: prefer V_MUL_LO_U32 over V_MUL_LO_I32
Stanislav Mekhanoshin [Mon, 6 May 2019 22:27:05 +0000 (22:27 +0000)]
[AMDGPU] gfx1010: prefer V_MUL_LO_U32 over V_MUL_LO_I32

GFX10 deprecates v_mul_lo_i32 instruction, so choose u32 form for
all targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360094 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Add tests for optimized lowerings of element.unordered.atomic memset/memcmove...
Philip Reames [Mon, 6 May 2019 22:25:59 +0000 (22:25 +0000)]
[Tests] Add tests for optimized lowerings of element.unordered.atomic memset/memcmove/memcopy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360093 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Rename tests before adding new ones
Philip Reames [Mon, 6 May 2019 22:16:55 +0000 (22:16 +0000)]
[Tests] Rename tests before adding new ones

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360092 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Autogen a test in advance of updates
Philip Reames [Mon, 6 May 2019 22:12:07 +0000 (22:12 +0000)]
[Tests] Autogen a test in advance of updates

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360091 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix pr33010, a 2 year old crashing regression
Philip Reames [Mon, 6 May 2019 22:09:31 +0000 (22:09 +0000)]
Fix pr33010, a 2 year old crashing regression

The problem was that we were creating a CMOV64rr <TargetFrameIndex>, <TargetFrameIndex>.  The entire point of a TFI is that address code is not generated, so there's no way to legalize/lower this.  Instead, simply prevent it's creation.

Arguably, we shouldn't be using *Target*FrameIndices in StatepointLowering at all, but that's a much deeper change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360090 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add more test cases for fast-isel handling of fneg.
Craig Topper [Mon, 6 May 2019 22:04:26 +0000 (22:04 +0000)]
[X86] Add more test cases for fast-isel handling of fneg.

The fneg double case is falling back to a subsd in 32-bit mode if you write a test that doesn't trigger a fast-isel abort on the return value.

The subsd lowering has different behavior with respect to nans than using an xor. This is inconsisent with what we would do in SelectionDAG
and can lead to differences between -O0 and -O2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360088 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] gfx1010 memory legalizer
Stanislav Mekhanoshin [Mon, 6 May 2019 21:57:02 +0000 (21:57 +0000)]
[AMDGPU] gfx1010 memory legalizer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360087 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Jordan Rupprecht [Mon, 6 May 2019 21:55:05 +0000 (21:55 +0000)]
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal test. Will followup with more details offline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360086 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.
Craig Topper [Mon, 6 May 2019 21:39:51 +0000 (21:39 +0000)]
[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.

We require d/q suffixes on the memory form of these instructions to disambiguate the memory size.
We don't require it on the register forms, but need to support parsing both with and without it.

Previously we always printed the d/q suffix on the register forms, but it's redundant and
inconsistent with gcc and objdump.

After this patch we should support the d/q for parsing, but not print it when its unneeded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360085 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Default to SEH exception handling on MinGW
Martin Storsjo [Mon, 6 May 2019 21:18:15 +0000 (21:18 +0000)]
[AArch64] Default to SEH exception handling on MinGW

The SEH implementation is pretty mature at this point.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360080 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] sink FP negation of operands through select
Sanjay Patel [Mon, 6 May 2019 20:34:05 +0000 (20:34 +0000)]
[InstCombine] sink FP negation of operands through select

We don't always get this:

Cond ? -X : -Y --> -(Cond ? X : Y)

...even with the legacy IR form of fneg in the case with extra uses,
and we miss matching with the newer 'fneg' instruction because we
are expecting binops through the rest of the path.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360075 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r360063.
Peter Collingbourne [Mon, 6 May 2019 20:09:12 +0000 (20:09 +0000)]
gn build: Merge r360063.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360074 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPull out repeated CI->getCalledFunction() calls. NFCI.
Simon Pilgrim [Mon, 6 May 2019 19:51:54 +0000 (19:51 +0000)]
Pull out repeated CI->getCalledFunction() calls. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360070 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG][X86] Support inline assembly returning an mmx register into a type...
Craig Topper [Mon, 6 May 2019 19:50:14 +0000 (19:50 +0000)]
[SelectionDAG][X86] Support inline assembly returning an mmx register into a type with fewer than 64 bits.

It's possible to use the 'y' mmx constraint with a type narrower than 64-bits.

This patch supports this by bitcasting the mmx type to 64-bits and then
truncating to the desired type.

There are probably other missing type combinations we need to support, but this
is the case we have a bug report for.

Fixes PR41748.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360069 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Handle <1 x T> vector return types properly.
Amara Emerson [Mon, 6 May 2019 19:41:01 +0000 (19:41 +0000)]
[GlobalISel] Handle <1 x T> vector return types properly.

After support for dealing with types that need to be extended in some way was
added in r358032 we didn't correctly handle <1 x T> return types. These types
don't have a GISel direct representation, instead we just see them as scalars.
When we need to pad them into <2 x T> types however we need to use a
G_BUILD_VECTOR instead of trying to do a G_CONCAT_VECTOR.

This fixes PR41738.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360068 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r359392 and r358887
Craig Topper [Mon, 6 May 2019 19:29:24 +0000 (19:29 +0000)]
Revert r359392 and r358887

Reverts "[X86] Remove (V)MOV64toSDrr/m and (V)MOVDI2SSrr/m. Use 128-bit result MOVD/MOVQ and COPY_TO_REGCLASS instead"
Reverts "[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling"

Eric Christopher and Jorge Gorbe Moya reported some issues with these patches to me off list.

Removing the CodeGenOnly instructions has changed how fneg is handled during fast-isel with sse/sse2. We're now emitting fsub -0.0, x instead
moving to the integer domain(in a GPR), xoring the sign bit, and then moving back to xmm. This is because the fast isel table no longer
contains an entry for (f32/f64 bitcast (i32/i64)) so the target independent fneg code fails. The use of fsub changes the behavior of nan with
respect to -O2 codegen which will always use a pxor. NOTE: We still have a difference with double with -m32 since the move to GPR doesn't work
there. I'll file a separate PR for that and add test cases.

Since removing the CodeGenOnly instructions was fixing PR41619, I'm reverting r358887 which exposed that PR. Though I wouldn't be surprised
if that bug can still be hit independent of that.

This should hopefully get Google back to green. I'll work with Simon and other X86 folks to figure out how to move forward again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360066 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix more Windows bots after r360015.
Paul Robinson [Mon, 6 May 2019 19:12:25 +0000 (19:12 +0000)]
Fix more Windows bots after r360015.
Depending on the environment, the directory separator might
appear as \ or \\ on different bots.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17446/steps/test-check-all/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360065 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove duplicate assignments. NFCI.
Simon Pilgrim [Mon, 6 May 2019 19:10:55 +0000 (19:10 +0000)]
Remove duplicate assignments. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360064 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd libc++ to link XRay test cases if libc++ is used to build CLANG
Xing Xue [Mon, 6 May 2019 17:45:21 +0000 (17:45 +0000)]
Add libc++ to link XRay test cases if libc++ is used to build CLANG

Summary: When libc++ is used to build CLANG, its XRay libraries libclang_rt.xray-*.a have dependencies on libc++. Therefore, libc++ is needed to link and run XRay test cases. For Linux -rpath is also needed to specify where to load libc++. This change sets macro LLVM_LIBCXX_USED to 1 if libc++ is actually used in the build. XRay tests then check the flag and add -L<llvm_shlib_dir> -lc++ and -Wl,-rpath=<llvm_shlib_dir> if needed.

Reviewers: hubert.reinterpretcast, amyk, dberris, jasonliu, sfertile, EricWF

Subscribers: dberris, mgorny, jsji, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360060 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Mon, 6 May 2019 17:39:18 +0000 (17:39 +0000)]
[InstCombine] reduce code duplication; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360059 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for fneg+sel; NFC
Sanjay Patel [Mon, 6 May 2019 17:29:22 +0000 (17:29 +0000)]
[InstCombine] add tests for fneg+sel; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360058 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: More TODO tweaking
Nico Weber [Mon, 6 May 2019 17:17:41 +0000 (17:17 +0000)]
gn build: More TODO tweaking

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360057 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Update TODO now that libcxx libcxxabi libunwind clang-tools-extra are done
Nico Weber [Mon, 6 May 2019 17:15:19 +0000 (17:15 +0000)]
gn build: Update TODO now that libcxx libcxxabi libunwind clang-tools-extra are done

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360056 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantRange] Add srem() support
Nikita Popov [Mon, 6 May 2019 16:59:37 +0000 (16:59 +0000)]
[ConstantRange] Add srem() support

Add support for srem() to ConstantRange so we can use it in LVI. For
srem the sign of the result matches the sign of the LHS. For the RHS
only the absolute value is important. Apart from that the logic is
like urem.

Just like for urem this is only an approximate implementation. The tests
check a few specific cases and run an exhaustive test for conservative
correctness (but not exactness).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360055 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SDAG][AArch64] Boolean and/or reduce to umax/min reduce (PR41635)
Nikita Popov [Mon, 6 May 2019 16:17:17 +0000 (16:17 +0000)]
[SDAG][AArch64] Boolean and/or reduce to umax/min reduce (PR41635)

This addresses one half of https://bugs.llvm.org/show_bug.cgi?id=41635
by combining a VECREDUCE_AND/OR into VECREDUCE_UMIN/UMAX (if latter is
legal but former is not) for zero-or-all-ones boolean reductions (which
are detected based on sign bits).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360054 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd FNeg support to InstructionSimplify
Cameron McInally [Mon, 6 May 2019 16:05:10 +0000 (16:05 +0000)]
Add FNeg support to InstructionSimplify

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360053 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Mon, 6 May 2019 16:03:53 +0000 (16:03 +0000)]
[InstCombine] regenerate test checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360052 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] reduce code duplication; NFCI
Sanjay Patel [Mon, 6 May 2019 15:35:02 +0000 (15:35 +0000)]
[InstCombine] reduce code duplication; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360051 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoModernize repmovsb implementation of x86 memcpy and allow runtime sizes.
Guillaume Chatelet [Mon, 6 May 2019 15:10:19 +0000 (15:10 +0000)]
Modernize repmovsb implementation of x86 memcpy and allow runtime sizes.

Summary: This is a prerequisite to RFC http://lists.llvm.org/pipermail/llvm-dev/2019-April/131973.html

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

Fix typo.

Turn this patch into an NFC.

Addressing comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360050 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r360018
Nico Weber [Mon, 6 May 2019 15:06:43 +0000 (15:06 +0000)]
gn build: Merge r360018

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360049 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Fix uninitialized members in constructor warnings. NFCI.
Simon Pilgrim [Mon, 6 May 2019 14:48:02 +0000 (14:48 +0000)]
[X86] Fix uninitialized members in constructor warnings. NFCI.

Initialize all member variables in X86ATTInstPrinter and X86DAGToDAGISel constructors to fix cppcheck warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360047 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix CMake Invalid Escape Sequence
Alexandre Ganea [Mon, 6 May 2019 14:07:01 +0000 (14:07 +0000)]
Fix CMake Invalid Escape Sequence

Patch by xoviat

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360045 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix compilation warnings when compiling with GCC 7.3
Alexandre Ganea [Mon, 6 May 2019 13:41:54 +0000 (13:41 +0000)]
Fix compilation warnings when compiling with GCC 7.3

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360044 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] Fix erroneous condition for converting uint-to-fp vector conversion
Nemanja Ivanovic [Mon, 6 May 2019 13:35:49 +0000 (13:35 +0000)]
[PowerPC] Fix erroneous condition for converting uint-to-fp vector conversion

A condition for exiting the legalization of v4i32 conversion to v2f64 through
extract/convert/build erroneously checks for the extract having type i32.
This is not adequate as smaller extracts are actually legalized to i32 as well.
Furthermore, an early exit is missing which means that we only check that
both extracts are from the same vector if that check fails.
As a result, both cases in the included test case fail - the first gets a
select error and the second generates incorrect code.

The culprit commit is r274535.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360043 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoX86DAGToDAGISel::tryVPTESTM - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Mon, 6 May 2019 11:52:16 +0000 (11:52 +0000)]
X86DAGToDAGISel::tryVPTESTM - fix uninitialized variable warning. NFCI.

findBroadcastedOp should always initialize the value if it returns true but static-analyzer isn't great at recognising this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360037 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test] Remove redundant bracket in rL360035
Fangrui Song [Mon, 6 May 2019 11:43:19 +0000 (11:43 +0000)]
[test] Remove redundant bracket in rL360035

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360036 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry fix Windows bot after rL360015
Fangrui Song [Mon, 6 May 2019 11:39:49 +0000 (11:39 +0000)]
Try fix Windows bot after rL360015

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360035 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry fix Windows bot after rL360015
Fangrui Song [Mon, 6 May 2019 11:37:20 +0000 (11:37 +0000)]
Try fix Windows bot after rL360015

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/25599/steps/test/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360034 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-c-test] Make include-all.c do what its name says it does
Anders Waldenborg [Mon, 6 May 2019 11:31:45 +0000 (11:31 +0000)]
[llvm-c-test] Make include-all.c do what its name says it does

The purpose of this file is to make sure that all includes in llvm-c
works when included from a C source file (i.e no C++isms sneaked in).
To do this it must actually include all the include files.

Reviewed By: whitequark
Differential Revision: https://reviews.llvm.org/D61567

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360033 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.
Simon Pilgrim [Mon, 6 May 2019 10:25:11 +0000 (10:25 +0000)]
[LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.

Properly initialize store type to null then ensure we find a real store type in the chain.

Fixes scan-build null dereference warning and makes the code clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360031 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Move X86 tests under the X86 directory
Fangrui Song [Mon, 6 May 2019 10:21:17 +0000 (10:21 +0000)]
[CodeGen] Move X86 tests under the X86 directory

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360029 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.
Simon Pilgrim [Mon, 6 May 2019 10:15:34 +0000 (10:15 +0000)]
[X86] X86InstrInfo::findThreeSrcCommutedOpIndices - fix unread variable warning.

scan-build was reporting that CommutableOpIdx1 never used its original initialized value - move it down to where its first used to make the real initialization more obvious (and matches the comment that's there).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360028 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] lowerVectorShuffle - use any_of to detect out of bounds shuffle indices. NFCI.
Simon Pilgrim [Mon, 6 May 2019 10:11:24 +0000 (10:11 +0000)]
[X86] lowerVectorShuffle - use any_of to detect out of bounds shuffle indices. NFCI.

Fixes cppcheck local shadow warning as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360027 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Analysis] Remove duplicated std::move from LocRange constructor
Simon Pilgrim [Mon, 6 May 2019 10:04:23 +0000 (10:04 +0000)]
[Analysis] Remove duplicated std::move from LocRange constructor

scan-build was reporting that we were referencing a moved variable - in fact we were moving it twice.....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360025 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Update memcpy tests
Guillaume Chatelet [Mon, 6 May 2019 09:46:50 +0000 (09:46 +0000)]
[NFC] Update memcpy tests

Summary: Runs utils/update_llc_test_checks.py on a few memcpy files

Reviewers: courbet

Subscribers: llvm-commits

Tags: #llvm

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

Remove cfi noise by adding nounwind

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360023 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Move files to correct directories after D60552
Fangrui Song [Mon, 6 May 2019 09:24:36 +0000 (09:24 +0000)]
[X86] Move files to correct directories after D60552

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360022 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimplifyLibCalls] Simplify bcmp too.
Clement Courbet [Mon, 6 May 2019 09:15:22 +0000 (09:15 +0000)]
[SimplifyLibCalls] Simplify bcmp too.

Summary: Fixes PR40699.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360021 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] This is a test for the commit access.
Pengfei Wang [Mon, 6 May 2019 08:31:18 +0000 (08:31 +0000)]
[NFC] This is a test for the commit access.

Summary: Signed-off-by: Pengfei Wang <pengfei.wang@intel.com>

Reviewers: LuoYuanke

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360019 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEnable AVX512_BF16 instructions, which are supported for BFLOAT16 in Cooper Lake
Luo, Yuanke [Mon, 6 May 2019 08:22:37 +0000 (08:22 +0000)]
Enable AVX512_BF16 instructions, which are supported for BFLOAT16 in Cooper Lake

Summary:
1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
2. Enable VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS  instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
VCVTNE2PS2BF16: Convert Two Packed Single Data to One Packed BF16 Data.
VCVTNEPS2BF16: Convert Packed Single Data to Packed BF16 Data.
VDPBF16PS: Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
For more details about BF16 isa, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Author: LiuTianle

Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, RKSimon, spatel

Reviewed By: craig.topper

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360017 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDWARF v5: fix directory index in the line table
Fangrui Song [Mon, 6 May 2019 08:03:46 +0000 (08:03 +0000)]
DWARF v5: fix directory index in the line table

Summary:
Prior to DWARF v5, a directory index of 0 represents DW_AT_comp_dir.

In DWARF v5, the index starts with 0 and Entry.DirIdx is the index into
Prologue.IncludeDirectories.

Reviewed By: labath

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360015 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.
Markus Lavin [Mon, 6 May 2019 07:20:56 +0000 (07:20 +0000)]
[DebugInfo] GlobalOpt DW_OP_deref_size instead of DW_OP_deref.

Optimization pass lib/Transforms/IPO/GlobalOpt.cpp needs to insert
DW_OP_deref_size instead of DW_OP_deref to be compatible with big-endian
targets for same reasons as in D59687.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360013 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-c] Make LLVMGetStringErrorTypeId a proper prototype
Anders Waldenborg [Mon, 6 May 2019 06:42:06 +0000 (06:42 +0000)]
[llvm-c] Make LLVMGetStringErrorTypeId a proper prototype

In C a function declaration with an empty argument list isn't a real
prototype, it will allow calling the function with any number of
arguments. It will also cause warnings when used in C code compiled with
'-Wstrict-prototypes'

Reviewed By: whitequark
Differential Revision: https://reviews.llvm.org/D61568

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360012 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_...
Craig Topper [Mon, 6 May 2019 04:01:49 +0000 (04:01 +0000)]
[SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_fatal_error.

Based on PR41748, not all cases are handled in this function.

llvm_unreachable is treated as an optimization hint than can prune code paths
in a release build. This causes weird behavior when PR41748 is encountered on a
release build. It appears to generate an fp_round instruction from the floating
point code.

Making this a report_fatal_error prevents incorrect optimization of the code
and will instead generate a message to file a bug report.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360008 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them
Petr Hosek [Mon, 6 May 2019 01:25:31 +0000 (01:25 +0000)]
[libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not defining them

When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360004 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them
Petr Hosek [Mon, 6 May 2019 01:22:28 +0000 (01:22 +0000)]
[libcxx] Don't use -fvisibility-global-new-delete-hidden when not defining them

When builing the hermetic static library, the compiler switch
-fvisibility-global-new-delete-hidden is necessary to get the new and
delete operator definitions made correctly. However, when those
definitions are not included in the library, then this switch does harm.
With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF
symbols makes it an error to leave them undefined or defined via dynamic
linking that should generate PLTs for -shared linking (lld makes this a
hard error even without -z defs). Though leaving the symbols undefined
would usually work in practice if the linker were to allow it (and the
user didn't pass -z defs), this actually indicates a real problem that
could bite some target configurations more subtly at runtime. For
example, x86-32 ELF -fpic code generation uses hidden visibility on
declarations in the caller's scope as a signal that the call will never
be resolved to a PLT entry and so doesn't have to meet the special ABI
requirements for PLT calls (setting %ebx). Since these functions might
actually be resolved to PLT entries at link time (we don't know what the
user is linking in when the hermetic library doesn't provide all the
symbols itself), it's not safe for the compiler to treat their
declarations at call sites as having hidden visibility.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360003 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Pull out repeated Subtarget feature tests. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:45:20 +0000 (20:45 +0000)]
[X86] Pull out repeated Subtarget feature tests. NFCI.

Avoids a scan-build "uninitialized value" warning in X86FastISel::X86SelectFPExtOrFPTrunc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360001 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:23:45 +0000 (20:23 +0000)]
[TargetLowering] getValueType - use dyn_cast directly to find VectorType. NFCI.

Matches what we do in other getValueType functions and fixes a null dereference warning in scan-build.

Also cleans up the rest of the function - use auto and standardize the variable names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360000 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TTI][X86] Make getAddressComputationCost cost value const. NFCI.
Simon Pilgrim [Sun, 5 May 2019 20:03:51 +0000 (20:03 +0000)]
[TTI][X86] Make getAddressComputationCost cost value const. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359999 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb
Roman Lebedev [Sun, 5 May 2019 18:59:45 +0000 (18:59 +0000)]
[NFC] BasicBlock: generalize replaceSuccessorsPhiUsesWith(), take Old bb

Thus it does not assume that the old basic block is the basic block
for which we are looking at successors.

Not reviewed, but seems rather trivial, in line with the rest of
previous few patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359997 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it
Roman Lebedev [Sun, 5 May 2019 18:59:39 +0000 (18:59 +0000)]
[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it

Summary:
It is a common thing to loop over every `PHINode` in some `BasicBlock`
and change old `BasicBlock` incoming block to a new `BasicBlock` incoming block.
`replaceSuccessorsPhiUsesWith()` already had code to do that,
it just wasn't a function.
So outline it into a new function, and use it.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359996 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:30 +0000 (18:59 +0000)]
[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it

Summary:
There is `PHINode::getBasicBlockIndex()`, `PHINode::setIncomingBlock()`
and `PHINode::getNumOperands()`, but no function to replace every
specified `BasicBlock*` predecessor with some other specified `BasicBlock*`.
Clearly, there are a lot of places that could use that functionality.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359995 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Instruction: introduce replaceSuccessorWith() function, use it
Roman Lebedev [Sun, 5 May 2019 18:59:22 +0000 (18:59 +0000)]
[NFC] Instruction: introduce replaceSuccessorWith() function, use it

Summary:
There is `Instruction::getNumSuccessors()`, `Instruction::getSuccessor()`
and `Instruction::setSuccessor()`, but no function to replace every
specified `BasicBlock*` successor with some other specified `BasicBlock*`.
I've found one place where it should clearly be used.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359994 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction
Roman Lebedev [Sun, 5 May 2019 18:59:12 +0000 (18:59 +0000)]
[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction

Summary:
If `deleteDeadLoop()` is called on such a loop, that has "bad" exit block,
one that e.g. has no terminator instruction, the `DIBuilder::insertDbgValueIntrinsic()`
will be told to insert the Dbg Value Intrinsic after `nullptr`
(since there is no first non-PHI instruction), which will cause it to not insert
those instructions into any basic block. The instructions will be parent-less,
and IR verifier will complain. It is rather obvious to track down the root cause
when that happens, so let's just assert it never happens.

Reviewers: sanjoy, davide, vsk

Reviewed By: vsk

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359993 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMove getOpcode() call into if statement. NFCI.
Simon Pilgrim [Sun, 5 May 2019 18:34:38 +0000 (18:34 +0000)]
Move getOpcode() call into if statement. NFCI.

Avoids a cppcheck "Local variable name shadows outer variable" warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359991 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPrecommit an FNeg InstructionSimplify test.
Cameron McInally [Sun, 5 May 2019 18:22:09 +0000 (18:22 +0000)]
Precommit an FNeg InstructionSimplify test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359990 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLPVectorizer] Prefer pre-increments. NFCI.
Simon Pilgrim [Sun, 5 May 2019 17:53:09 +0000 (17:53 +0000)]
[SLPVectorizer] Prefer pre-increments. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359989 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLParser] Remove unused variable after r359987. NFC
Craig Topper [Sun, 5 May 2019 17:46:17 +0000 (17:46 +0000)]
[LLParser] Remove unused variable after r359987. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359988 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on...
Craig Topper [Sun, 5 May 2019 17:19:23 +0000 (17:19 +0000)]
[LLParser] Remove unnecessary error check making sure NUW/NSW flags aren't set on a non-integer operation.

Summary: This check appears to be a leftover from when add/sub/mul could be either integer or fp. The NSW/NUW flags are only set for add/sub/mul/shl earlier. And we check that those operations only have integer types just below this. So it seems unnecessary to explicitly error for NUW/NSW being used on a add/sub/mul that have the wrong type that would later error for that.

Reviewers: spatel, dblaikie, jyknight, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits, hiraditya

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359987 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp.
Craig Topper [Sun, 5 May 2019 17:19:19 +0000 (17:19 +0000)]
[LLParser] Simplify type checking in ParseArithmetic and ParseUnaryOp.

Summary:
These methods previously took a 0, 1, or 2 to indicate what types were allowed, but the 0 encoding which meant both fp and integer types has been unused for years. Its leftover from when add/sub/mul used to be shared between int and fp

Simplify it by changing it to just a bool to distinquish int and fp.

Reviewers: spatel, dblaikie, jyknight, arsenm

Reviewed By: spatel

Subscribers: wdng, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359986 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Constants] Simplify type checking switch in ConstantExpr::get.
Craig Topper [Sun, 5 May 2019 17:19:16 +0000 (17:19 +0000)]
[Constants] Simplify type checking switch in ConstantExpr::get.

Summary:
Remove duplicate checks that both operands have the same type. This is checked
before the switch.

Use 'integer' or 'floating-point' instead of 'arithmetic' type. I think this
might be a leftover to the days when floating point and integer operations
shared the same opcodes.

Reviewers: spatel, RKSimon, dblaikie

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359985 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MCA] Notify event listeners when instructions transition to the Pending state. NFCI
Andrea Di Biagio [Sun, 5 May 2019 16:07:27 +0000 (16:07 +0000)]
[MCA] Notify event listeners when instructions transition to the Pending state. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359983 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd FNeg IR constant folding support
Cameron McInally [Sun, 5 May 2019 16:07:09 +0000 (16:07 +0000)]
Add FNeg IR constant folding support

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359982 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Make X86RegisterInfo(const Triple &TT) constructor explicit.
Simon Pilgrim [Sun, 5 May 2019 12:51:47 +0000 (12:51 +0000)]
[X86] Make X86RegisterInfo(const Triple &TT) constructor explicit.

Fixes cppcheck warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359981 91177308-0d34-0410-b5e6-96231b3b80d8