llvm
5 years ago[x86] add test for horizontal math bug (PR43225); NFC
Sanjay Patel [Thu, 5 Sep 2019 16:58:18 +0000 (16:58 +0000)]
[x86] add test for horizontal math bug (PR43225); NFC

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

5 years ago[MemorySSA] Verify MSSAUpdater exists.
Alina Sbirlea [Thu, 5 Sep 2019 16:58:15 +0000 (16:58 +0000)]
[MemorySSA] Verify MSSAUpdater exists.

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

5 years ago[PGO][CHR] Speed up following long, interlinked use-def chains.
Hiroshi Yamauchi [Thu, 5 Sep 2019 16:56:55 +0000 (16:56 +0000)]
[PGO][CHR] Speed up following long, interlinked use-def chains.

Summary:
Avoid visiting an instruction more than once by using a map.

This is similar to https://reviews.llvm.org/rL361416.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Update MemorySSA when removing debug.value calls.
Alina Sbirlea [Thu, 5 Sep 2019 16:25:24 +0000 (16:25 +0000)]
[MemorySSA] Update MemorySSA when removing debug.value calls.

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

5 years ago[Hexagon] Fix type in HexagonTargetLowering::ReplaceNodeResults
Krzysztof Parzyszek [Thu, 5 Sep 2019 16:19:47 +0000 (16:19 +0000)]
[Hexagon] Fix type in HexagonTargetLowering::ReplaceNodeResults

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

5 years ago[Alignment][NFC] Change internal representation of TargetLowering.h
Guillaume Chatelet [Thu, 5 Sep 2019 15:44:33 +0000 (15:44 +0000)]
[Alignment][NFC] Change internal representation of TargetLowering.h

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[ARM] Add support for the s,j,x,N,O inline asm constraints
David Candler [Thu, 5 Sep 2019 15:17:25 +0000 (15:17 +0000)]
[ARM] Add support for the s,j,x,N,O inline asm constraints

A number of inline assembly constraints are currently supported by LLVM, but rejected as invalid by Clang:

Target independent constraints:

s: An integer constant, but allowing only relocatable values

ARM specific constraints:

j: An immediate integer between 0 and 65535 (valid for MOVW)
x: A 32, 64, or 128-bit floating-point/SIMD register: s0-s15, d0-d7, or q0-q3
N: An immediate integer between 0 and 31 (Thumb1 only)
O: An immediate integer which is a multiple of 4 between -508 and 508. (Thumb1 only)

This patch adds support to Clang for the missing constraints along with some checks to ensure that the constraints are used with the correct target and Thumb mode, and that immediates are within valid ranges (at least where possible). The constraints are already implemented in LLVM, but just a couple of minor corrections to checks (V8M Baseline includes MOVW so should work with 'j', 'N' and 'O' shouldn't be valid in Thumb2) so that Clang and LLVM are in line with each other and the documentation.

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

Change-Id: I18076619e319bac35fbb60f590c069145c9d9a0a

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

5 years ago[X86][SSE] EltsFromConsecutiveLoads - ignore non-zero offset base loads (PR43227)
Simon Pilgrim [Thu, 5 Sep 2019 15:07:07 +0000 (15:07 +0000)]
[X86][SSE] EltsFromConsecutiveLoads - ignore non-zero offset base loads (PR43227)

As discussed on D64551 and PR43227, we don't correctly handle cases where the base load has a non-zero byte offset.

Until we can properly handle this, we must bail from EltsFromConsecutiveLoads.

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

5 years ago[yaml2obj] Write the section header table after section contents
Fangrui Song [Thu, 5 Sep 2019 14:25:57 +0000 (14:25 +0000)]
[yaml2obj] Write the section header table after section contents

Linkers (ld.bfd/gold/lld) place the section header table at the very
end. This allows tools to strip it, which is optional in executable/shared objects.
In addition, if we add or section, the size of the section header table
will change. Placing the section header table in the end keeps section
offsets unchanged.

yaml2obj currently places the section header table immediately after the
program header. Follow what linkers do to make offset updating easier.

Reviewed By: grimar

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

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

5 years ago[LLVM][Alignment][NFC] Fixing wrong documentation
Guillaume Chatelet [Thu, 5 Sep 2019 14:17:08 +0000 (14:17 +0000)]
[LLVM][Alignment][NFC] Fixing wrong documentation

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

5 years ago[llvm-readelf] - Allow dumping dynamic symbols when there is no program headers.
George Rimar [Thu, 5 Sep 2019 14:02:58 +0000 (14:02 +0000)]
[llvm-readelf] - Allow dumping dynamic symbols when there is no program headers.

D62179 introduced a regression. llvm-readelf lose the ability to dump the dynamic symbols
when there is .dynamic section with a DT_SYMTAB, but there are no program headers:
https://reviews.llvm.org/D62179#1652778

Below is a program flow before the D62179 change:

1) Find SHT_DYNSYM.
2) Find there is no PT_DYNAMIC => don't try to parse it.
3) Print dynamic symbols using information about them found on step (1).

And after the change it became:

1) Find SHT_DYNSYM.
2) Find there is no PT_DYNAMIC => find SHT_DYNAMIC.
3) Parse dynamic table, but fail to handle the DT_SYMTAB because of the absence of the PT_LOAD. Report the "Virtual address is not in any segment" error.

This patch fixes the issue. For doing this it checks that the value of DT_SYMTAB was
mapped to a segment. If not - it ignores it.

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

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

5 years ago[ARM] Fixup the creation of VPT blocks
David Green [Thu, 5 Sep 2019 13:37:04 +0000 (13:37 +0000)]
[ARM] Fixup the creation of VPT blocks

This attempts to just fix the creation of VPT blocks, fixing up the iterating,
which instructions are considered in the bundle, and making sure that we do not
overrun the end of the block.

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

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

5 years ago[LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align
Guillaume Chatelet [Thu, 5 Sep 2019 13:09:42 +0000 (13:09 +0000)]
[LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align

Summary:
This is patch is part of a serie to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86][SSE] Add (failing) test case for PR43227
Simon Pilgrim [Thu, 5 Sep 2019 12:36:11 +0000 (12:36 +0000)]
[X86][SSE] Add (failing) test case for PR43227

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

5 years ago[MIPS GlobalISel] Select G_FENCE
Petar Avramovic [Thu, 5 Sep 2019 11:20:32 +0000 (11:20 +0000)]
[MIPS GlobalISel] Select G_FENCE

G_FENCE comes form fence instruction. For MIPS fence is generated in
AtomicExpandPass when atomic instruction gets surrounded with fence
instruction when needed.
G_FENCE arguments don't have LLT, because of that there is no job for
legalizer and regbankselect. Instruction select G_FENCE for MIPS32.

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

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

5 years ago[MIPS GlobalISel] Select llvm.trap intrinsic
Petar Avramovic [Thu, 5 Sep 2019 11:16:37 +0000 (11:16 +0000)]
[MIPS GlobalISel] Select llvm.trap intrinsic

Select G_INTRINSIC_W_SIDE_EFFECTS for Intrinsic::trap for MIPS32
via legalizeIntrinsic.

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

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

5 years ago[MIPS GlobalISel] Lower SRet pointer arguments
Petar Avramovic [Thu, 5 Sep 2019 11:12:01 +0000 (11:12 +0000)]
[MIPS GlobalISel] Lower SRet pointer arguments

Instead of returning structure by value clang usually adds pointer
to that structure as an argument. Pointers don't require special
handling no matter the SRet flag. Remove unsuccessful exit from
lowerCall for arguments with SRet flag if they are pointers.

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

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

5 years agoRevert rL370996 from llvm/trunk: [AArch64][GlobalISel] Teach AArch64CallLowering...
Simon Pilgrim [Thu, 5 Sep 2019 10:38:39 +0000 (10:38 +0000)]
Revert rL370996 from llvm/trunk: [AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls

This adds support for basic sibling call lowering in AArch64. The intent here is
to only handle tail calls which do not change the ABI (hence, sibling calls.)

At this point, it is very restricted. It does not handle

- Vararg calls.
- Calls with outgoing arguments.
- Calls whose calling conventions differ from the caller's calling convention.
- Tail/sibling calls with BTI enabled.

This patch adds

- `AArch64CallLowering::isEligibleForTailCallOptimization`, which is equivalent
   to the same function in AArch64ISelLowering.cpp (albeit with the restrictions
   above.)
- `mayTailCallThisCC` and `canGuaranteeTCO`, which are identical to those in
   AArch64ISelLowering.cpp.
- `getCallOpcode`, which is exactly what it sounds like.

Tail/sibling calls are lowered by checking if they pass target-independent tail
call positioning checks, and checking if they satisfy
`isEligibleForTailCallOptimization`. If they do, then a tail call instruction is
emitted instead of a normal call. If we have a sibling call (which is always the
case in this patch), then we do not emit any stack adjustment operations. When
we go to lower a return, we check if we've already emitted a tail call. If so,
then we skip the return lowering.

For testing, this patch

- Adds call-translator-tail-call.ll to test which tail calls we currently lower,
  which ones we don't, and which ones we shouldn't.
- Updates branch-target-enforcement-indirect-calls.ll to show that we fall back
  as expected.

Differential Revision: https://reviews.llvm.org/D67189
........
This fails on EXPENSIVE_CHECKS builds due to a -verify-machineinstrs test failure in CodeGen/AArch64/dllimport.ll

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

5 years ago[X86] X86SpeculativeLoadHardeningPass::canHardenRegister - fix out of bounds warning.
Simon Pilgrim [Thu, 5 Sep 2019 10:26:38 +0000 (10:26 +0000)]
[X86] X86SpeculativeLoadHardeningPass::canHardenRegister - fix out of bounds warning.

Fixes clang static-analyzer warning.

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

5 years ago[SystemZ] Recognize INLINEASM_BR in backend
Jonas Paulsson [Thu, 5 Sep 2019 10:20:05 +0000 (10:20 +0000)]
[SystemZ]  Recognize INLINEASM_BR in backend

Handle the remaining cases also by handling asm goto in
SystemZInstrInfo::getBranchInfo().

Review: Ulrich Weigand
https://reviews.llvm.org/D67151

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

5 years ago[X86] X86InstrInfo::optimizeCompareInstr - fix potential null dereference.
Simon Pilgrim [Thu, 5 Sep 2019 10:18:24 +0000 (10:18 +0000)]
[X86] X86InstrInfo::optimizeCompareInstr - fix potential null dereference.

Fixes clang static-analyzer warning.

Technically the MachineInstr *Sub might still be null if we're comparing zero (IsCmpZero == true), although this probably won't happen as SrcReg2 is probably == 0.

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

5 years ago[LLVM][Alignment] Make functions using log of alignment explicit
Guillaume Chatelet [Thu, 5 Sep 2019 10:00:22 +0000 (10:00 +0000)]
[LLVM][Alignment] Make functions using log of alignment explicit

Summary:
This patch renames functions that takes or returns alignment as log2, this patch will help with the transition to llvm::Align.
The renaming makes it explicit that we deal with log(alignment) instead of a power of two alignment.
A few renames uncovered dubious assignments:

 - `MirParser`/`MirPrinter` was expecting powers of two but `MachineFunction` and `MachineBasicBlock` were using deal with log2(align). This patch fixes it and updates the documentation.
 - `MachineBlockPlacement` exposes two flags (`align-all-blocks` and `align-all-nofallthru-blocks`) supposedly interpreted as power of two alignments, internally these values are interpreted as log2(align). This patch updates the documentation,
 - `MachineFunctionexposes` exposes `align-all-functions` also interpreted as power of two alignment, internally this value is interpreted as log2(align). This patch updates the documentation,

Reviewers: lattner, thegameg, courbet

Subscribers: dschuff, arsenm, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, Jim, s.egerton, llvm-commits, courbet

Tags: #llvm

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

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

5 years agoFix time-trace breaking flame graph assumptions
Russell Gallop [Thu, 5 Sep 2019 09:26:04 +0000 (09:26 +0000)]
Fix time-trace breaking flame graph assumptions

-ftime-trace could break flame-graph assumptions on Windows, with an
inner scope overrunning outer scopes. This was due to the way that times
were truncated. Changed this so time_points for the flame-graph are
truncated instead of durations, preserving the relative order of event
starts and ends.

I have tried to retain the extra precision for the totals, which count
thousands or millions of events.

Added assert to check this property holds in future.

Fixes PR43043

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

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

5 years agoWin: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)
Hans Wennborg [Thu, 5 Sep 2019 09:07:05 +0000 (09:07 +0000)]
Win: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)

After r361885, realPathFromHandle() ends up getting called on the working
directory on each Clang invocation. This unveiled that the code didn't work for
paths on network shares.

For example, if one maps the local dir c:\src\tmp to x:

  net use x: \\localhost\c$\tmp

and run e.g. "clang -c foo.cc" in x:\, realPathFromHandle will get
\\?\UNC\localhost\c$\src\tmp\ back from GetFinalPathNameByHandleW, and would
strip off the initial \\?\ prefix, ending up with a path that doesn't work.

This patch makes the prefix stripping a little smarter to handle this case.

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

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

5 years ago[lib/ObjectYAML] - Cleanup the private interface of ELFState<ELFT>. NFCI.
George Rimar [Thu, 5 Sep 2019 08:59:28 +0000 (08:59 +0000)]
[lib/ObjectYAML] - Cleanup the private interface of ELFState<ELFT>. NFCI.

In D62809 I accidentally added "ELFState<ELFT> &State" as the
first parameter to two methods. There is no reason for having that.
I removed this argument and also moved finalizeStrings declaration to
remove an excessive 'private:' tag.

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

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

5 years agoRecommit r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:52:26 +0000 (08:52 +0000)]
Recommit r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol."

Fix: added missing return "return 0;"

Original commit message:
This eliminates one of the error(1) call in this lib.
It is different from the others because happens on a fields mapping stage
and can be easily fixed.

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

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

5 years agoRevert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:39:44 +0000 (08:39 +0000)]
Revert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol." (2)

Forgot to revert the cpp file.

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

5 years agoRevert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other...
George Rimar [Thu, 5 Sep 2019 08:38:29 +0000 (08:38 +0000)]
Revert r371023 "[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol."

It broke BBots:

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/36387/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17117/steps/test/logs/stdio

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

5 years ago[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.
George Rimar [Thu, 5 Sep 2019 08:28:43 +0000 (08:28 +0000)]
[lib/ObjectYAML] - Stop calling error(1) when mapping the st_other field of a symbol.

This eliminates one of the error(1) call in this lib.
It is different from the others because happens on a fields mapping stage
and can be easily fixed.

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

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

5 years ago[DWARF] Fix referencing Range List Tables from CUs for DWARF64.
Igor Kudrin [Thu, 5 Sep 2019 07:02:28 +0000 (07:02 +0000)]
[DWARF] Fix referencing Range List Tables from CUs for DWARF64.

As DW_AT_rnglists_base points after the header and headers have
different sizes for DWARF32 and DWARF64, we have to use the format
of the CU to adjust the offset correctly in order to extract
the referenced range list table.

The patch also changes the type of RangeSectionBase because in DWARF64
it is 8-bytes long.

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

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

5 years ago[DWARF] Support DWARF64 in DWARFListTableHeader.
Igor Kudrin [Thu, 5 Sep 2019 06:49:05 +0000 (06:49 +0000)]
[DWARF] Support DWARF64 in DWARFListTableHeader.

This enables 64-bit DWARF support for parsing range and location list tables.

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

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

5 years agoAMDGPU: Add intrinsics for address space identification
Matt Arsenault [Thu, 5 Sep 2019 02:20:39 +0000 (02:20 +0000)]
AMDGPU: Add intrinsics for address space identification

The library currently uses ptrtoint and directly checks the queue ptr
for this, which counts as a pointer capture.

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

5 years agoAMDGPU/GlobalISel: Restore insert point when getting aperture
Matt Arsenault [Thu, 5 Sep 2019 02:20:32 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Restore insert point when getting aperture

Avoids SSA violations in a future patch.

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

5 years agoAMDGPU/GlobalISel: Fix placeholder value used for addrspacecast
Matt Arsenault [Thu, 5 Sep 2019 02:20:29 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Fix placeholder value used for addrspacecast

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

5 years agoAMDGPU/GlobalISel: Fix assert on load from constant address
Matt Arsenault [Thu, 5 Sep 2019 02:20:25 +0000 (02:20 +0000)]
AMDGPU/GlobalISel: Fix assert on load from constant address

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

5 years ago[mir-canon][NFC] Adding -verify-machineinstrs to mir-canon tests.
Puyan Lotfi [Thu, 5 Sep 2019 02:10:41 +0000 (02:10 +0000)]
[mir-canon][NFC] Adding -verify-machineinstrs to mir-canon tests.

In the review process for some of the refactoring of MIRCanonicalizationPass it
was noted that some of the tests didn't have verifier enabled. Enabling here.

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

5 years agoUse -mtriple to fix AMDGPU test sensitive to object file format
Reid Kleckner [Thu, 5 Sep 2019 00:34:01 +0000 (00:34 +0000)]
Use -mtriple to fix AMDGPU test sensitive to object file format

GOTPCREL32 doesn't exist on COFF, so it isn't used when this test runs
on Windows.

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

5 years ago[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls
Jessica Paquette [Wed, 4 Sep 2019 22:54:52 +0000 (22:54 +0000)]
[AArch64][GlobalISel] Teach AArch64CallLowering to handle basic sibling calls

This adds support for basic sibling call lowering in AArch64. The intent here is
to only handle tail calls which do not change the ABI (hence, sibling calls.)

At this point, it is very restricted. It does not handle

- Vararg calls.
- Calls with outgoing arguments.
- Calls whose calling conventions differ from the caller's calling convention.
- Tail/sibling calls with BTI enabled.

This patch adds

- `AArch64CallLowering::isEligibleForTailCallOptimization`, which is equivalent
   to the same function in AArch64ISelLowering.cpp (albeit with the restrictions
   above.)
- `mayTailCallThisCC` and `canGuaranteeTCO`, which are identical to those in
   AArch64ISelLowering.cpp.
- `getCallOpcode`, which is exactly what it sounds like.

Tail/sibling calls are lowered by checking if they pass target-independent tail
call positioning checks, and checking if they satisfy
`isEligibleForTailCallOptimization`. If they do, then a tail call instruction is
emitted instead of a normal call. If we have a sibling call (which is always the
case in this patch), then we do not emit any stack adjustment operations. When
we go to lower a return, we check if we've already emitted a tail call. If so,
then we skip the return lowering.

For testing, this patch

- Adds call-translator-tail-call.ll to test which tail calls we currently lower,
  which ones we don't, and which ones we shouldn't.
- Updates branch-target-enforcement-indirect-calls.ll to show that we fall back
  as expected.

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

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

5 years agogn build: Merge r370985
Nico Weber [Wed, 4 Sep 2019 21:34:21 +0000 (21:34 +0000)]
gn build: Merge r370985

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

5 years ago[mir-canon][NFC] Move MIR vreg renaming code to separate file for better reuse.
Puyan Lotfi [Wed, 4 Sep 2019 21:29:10 +0000 (21:29 +0000)]
[mir-canon][NFC] Move MIR vreg renaming code to separate file for better reuse.

Moving MIRCanonicalizerPass vreg renaming code to MIRVRegNamerUtils so that it
can be reused in another pass (ie planing to write a standalone mir-namer pass).

I'm going to write a mir-namer pass so that next time someone has to author a
test in MIR, they can use it to cleanup the naming and make it more readable by
having the numbered vregs swapped out with named vregs.

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

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

5 years agoAMDGPU/GlobalISel: Select G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 20:46:31 +0000 (20:46 +0000)]
AMDGPU/GlobalISel: Select G_BITREVERSE

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

5 years agoGlobalISel: Add basic legalization for G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 20:46:15 +0000 (20:46 +0000)]
GlobalISel: Add basic legalization for G_BITREVERSE

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

5 years ago[Attributor][Stats] Use the right statistics macro
Johannes Doerfert [Wed, 4 Sep 2019 20:34:57 +0000 (20:34 +0000)]
[Attributor][Stats] Use the right statistics macro

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

5 years ago[Attributor][Fix] Make sure we do not delete live code
Johannes Doerfert [Wed, 4 Sep 2019 20:34:52 +0000 (20:34 +0000)]
[Attributor][Fix] Make sure we do not delete live code

Summary: Liveness needs to mark edges, not blocks as dead.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[LLD] [COFF] Implement MinGW default manifest handling
Martin Storsjo [Wed, 4 Sep 2019 20:34:00 +0000 (20:34 +0000)]
[LLD] [COFF] Implement MinGW default manifest handling

In mingw environments, resources are normally compiled to resource
object files directly, instead of letting the linker convert them to
COFF format.

Since some time, GCC supports the notion of a default manifest object.
When invoking the linker, GCC looks for the default manifest object
file, and if found in the expected path, it is added to linker commands.

The default manifest is one that indicates support for the latest known
versions of windows, to implicitly unlock the modern behaviours of certain
APIs.

Not all mingw/gcc distributions include this file, but e.g. in msys2,
the default manifest object is distributed in a separate package (which
can be but might not always be installed).

This means that even if user projects only use one single resource
object file, the linker can end up with two resource object files,
and thus needs to support merging them.

The default manifest has a language id of zero, and GNU ld has got
logic for dropping a manifest with a zero language id, if there's
another manifest present with a nonzero language id. If there are
multiple manifests with a nonzero language id, the merging process
errors out.

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

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

5 years ago[NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes
Leonard Chan [Wed, 4 Sep 2019 20:30:29 +0000 (20:30 +0000)]
[NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes

This patch merges the sancov module and funciton passes into one module pass.

The reason for this is because we ran into an out of memory error when
attempting to run asan fuzzer on some protobufs (pc.cc files). I traced the OOM
error to the destructor of SanitizerCoverage where we only call
appendTo[Compiler]Used which calls appendToUsedList. I'm not sure where precisely
in appendToUsedList causes the OOM, but I am able to confirm that it's calling
this function *repeatedly* that causes the OOM. (I hacked sancov a bit such that
I can still create and destroy a new sancov on every function run, but only call
appendToUsedList after all functions in the module have finished. This passes, but
when I make it such that appendToUsedList is called on every sancov destruction,
we hit OOM.)

I don't think the OOM is from just adding to the SmallSet and SmallVector inside
appendToUsedList since in either case for a given module, they'll have the same
max size. I suspect that when the existing llvm.compiler.used global is erased,
the memory behind it isn't freed. I could be wrong on this though.

This patch works around the OOM issue by just calling appendToUsedList at the
end of every module run instead of function run. The same amount of constants
still get added to llvm.compiler.used, abd we make the pass usage and logic
simpler by not having any inter-pass dependencies.

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

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

5 years ago[llvm-rtdyld][llvm-jitlink] Rename struct member to remove ambiguity.
Lang Hames [Wed, 4 Sep 2019 20:26:26 +0000 (20:26 +0000)]
[llvm-rtdyld][llvm-jitlink] Rename struct member to remove ambiguity.

This ambiguity (struct member name matching struct name) was causing errors on
a few of the MSVC bots. Hopefully this should fix it.

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

5 years ago[llvm-rtdyld] Add timers to match llvm-jitlink.
Lang Hames [Wed, 4 Sep 2019 20:26:25 +0000 (20:26 +0000)]
[llvm-rtdyld] Add timers to match llvm-jitlink.

When using llvm-rtdyld to execute code, -show-times will now show the time
taken to load the object files, apply relocations, and execute the
rtdyld-linked code.

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

5 years ago[InstCombine] Add more test cases (NFC)
Evandro Menezes [Wed, 4 Sep 2019 20:01:09 +0000 (20:01 +0000)]
[InstCombine] Add more test cases (NFC)

Add more test cases simplifying `log()`.

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

5 years ago[WebAssembly] Initialize memory in start function
Thomas Lively [Wed, 4 Sep 2019 19:50:39 +0000 (19:50 +0000)]
[WebAssembly] Initialize memory in start function

Summary:
 - `__wasm_init_memory` is now the WebAssembly start function instead
   of being called from `__wasm_call_ctors` or called directly by the
   runtime.
 - Adds a new synthetic data symbol `__wasm_init_memory_flag` that is
   atomically incremented from zero to one by the thread responsible
   for initializing memory.
 - All threads now unconditionally perform data.drop on all passive
   segments.
 - Removes --passive-segments and --active-segments flags and controls
   segment type based on --shared-memory instead. The deleted flags
   were only present to ameliorate the upgrade path in Emscripten.

Reviewers: sbc100, aheejin

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

Tags: #llvm

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

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

5 years ago[MemorySSA] Re-enable MemorySSA use.
Alina Sbirlea [Wed, 4 Sep 2019 19:16:04 +0000 (19:16 +0000)]
[MemorySSA] Re-enable MemorySSA use.

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

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

5 years ago[Attributor][Fix] Ensure the attribute names are created properly
Johannes Doerfert [Wed, 4 Sep 2019 19:01:08 +0000 (19:01 +0000)]
[Attributor][Fix] Ensure the attribute names are created properly

The names of the attributes were not always created properly which
caused problems with the yaml output.

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

5 years ago[globalisel] Support trivial COPY in GISelKnownBits
Daniel Sanders [Wed, 4 Sep 2019 18:59:43 +0000 (18:59 +0000)]
[globalisel] Support trivial COPY in GISelKnownBits

Summary: Allow GISelKnownBits to look through the trivial case of TargetOpcode::COPY

Reviewers: aditya_nandakumar

Subscribers: rovka, hiraditya, volkan, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[JITLink] Fix the show-timers option on llvm-jitlink.
Lang Hames [Wed, 4 Sep 2019 18:38:29 +0000 (18:38 +0000)]
[JITLink] Fix the show-timers option on llvm-jitlink.

No longer constantly shows times (even when -show-times=false). When shown,
times are now correctly grouped.

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

5 years ago[docs] Add some comments to the inline LLJIT example.
Lang Hames [Wed, 4 Sep 2019 18:38:26 +0000 (18:38 +0000)]
[docs] Add some comments to the inline LLJIT example.

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

5 years ago[NFC] Switch last couple of invariant_load checks to use hasMetadata
Philip Reames [Wed, 4 Sep 2019 18:27:31 +0000 (18:27 +0000)]
[NFC] Switch last couple of invariant_load checks to use hasMetadata

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

5 years ago[TargetLibraryInfo] Define enumerator for no library function (NFC)
Evandro Menezes [Wed, 4 Sep 2019 18:15:58 +0000 (18:15 +0000)]
[TargetLibraryInfo] Define enumerator for no library function (NFC)

Add a null enumerator do designate no library function.

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

5 years ago[InstCombine] sub(xor(x, y), or(x, y)) -> neg(and(x, y))
David Bolvansky [Wed, 4 Sep 2019 18:03:21 +0000 (18:03 +0000)]
[InstCombine] sub(xor(x, y), or(x, y)) -> neg(and(x, y))

Summary:
```
Name: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
%or = or i32 %y, %x
%xor = xor i32 %x, %y
%sub = sub i32 %xor, %or
  =>
%sub1 = and i32 %x, %y
%sub = sub i32 0, %sub1

Optimization: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
Done: 1
Optimization is correct!
```

https://rise4fun.com/Alive/8OI

Reviewers: lebedev.ri

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years agoUpdate CodeGen to use hasMetadata as appropriate [NFC]
Philip Reames [Wed, 4 Sep 2019 17:46:55 +0000 (17:46 +0000)]
Update CodeGen to use hasMetadata as appropriate [NFC]

My intial grepping for rL370933 missed a directory worth of cases.

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

5 years ago[NFC] Added tests for new fold
David Bolvansky [Wed, 4 Sep 2019 17:37:06 +0000 (17:37 +0000)]
[NFC] Added tests for new fold

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

5 years ago[NFC] Adjust test filename
David Bolvansky [Wed, 4 Sep 2019 17:33:53 +0000 (17:33 +0000)]
[NFC] Adjust test filename

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

5 years ago[X86] Pre-commit test cases and test run line changes for D67087
Craig Topper [Wed, 4 Sep 2019 17:33:38 +0000 (17:33 +0000)]
[X86] Pre-commit test cases and test run line changes for D67087

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

5 years agoAdd encode and decode methods to InlineInfo and document encoding format to the GSYM...
Greg Clayton [Wed, 4 Sep 2019 17:32:51 +0000 (17:32 +0000)]
Add encode and decode methods to InlineInfo and document encoding format to the GSYM file format.

This patch adds the ability to encode and decode InlineInfo objects and adds test coverage. Error handling is introduced in the encoding and decoding which will be used from here on out for remaining patches.

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

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

5 years ago[InstCombine] Fold sub (and A, B) (or A, B)) to neg (xor A, B)
David Bolvansky [Wed, 4 Sep 2019 17:30:53 +0000 (17:30 +0000)]
[InstCombine] Fold sub (and A, B) (or A, B)) to neg (xor A, B)

Summary:
```
Name: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %and, %or
  =>
%sub1 = xor i32 %x, %y
%sub = sub i32 0, %sub1

Optimization: sub(and(x, y), or(x, y)) -> neg(xor(x, y))
Done: 1
Optimization is correct!
```

https://rise4fun.com/Alive/VI6

Found by @lebedev.ri. Also author of the proof.

Reviewers: lebedev.ri, spatel

Reviewed By: lebedev.ri

Subscribers: llvm-commits, lebedev.ri

Tags: #llvm

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

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

5 years ago[Instruction] Add hasMetadata(Kind) helper [NFC]
Philip Reames [Wed, 4 Sep 2019 17:28:48 +0000 (17:28 +0000)]
[Instruction] Add hasMetadata(Kind) helper [NFC]

It's a common idiom, so let's add the obvious wrapper for metadata kinds which are basically booleans.

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

5 years agoAMDGPU: Handle frame index expansion with no free SGPRs pre gfx9
Matt Arsenault [Wed, 4 Sep 2019 17:12:57 +0000 (17:12 +0000)]
AMDGPU: Handle frame index expansion with no free SGPRs pre gfx9

Since an add instruction must produce an unused carry out, this
requires additional SGPRs. This can be avoided by keeping the entire
offset computation in SGPRs. If one SGPR is still available, this only
costs one extra mov. If none are available, the entire computation can
be done in place and reversed.

This does assume the use is a VGPR operand. This was already assumed,
and we currently only select frame indexes to VALU instructions. This
should probably be fixed at some point to handle more possible MIR.

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

5 years agoGlobalISel: Add G_BITREVERSE
Matt Arsenault [Wed, 4 Sep 2019 17:06:53 +0000 (17:06 +0000)]
GlobalISel: Add G_BITREVERSE

This is the first failing pattern for AMDGPU and is trivial to handle.

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

5 years ago[Attributor][NFC] Add assertion to guard against accidental misuse
Johannes Doerfert [Wed, 4 Sep 2019 16:36:54 +0000 (16:36 +0000)]
[Attributor][NFC] Add assertion to guard against accidental misuse

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

5 years ago[Attributor] Look at internal functions only on-demand
Johannes Doerfert [Wed, 4 Sep 2019 16:35:20 +0000 (16:35 +0000)]
[Attributor] Look at internal functions only on-demand

Summary:
Instead of building attributes for internal functions which we do not
update as long as we assume they are dead, we now do not create
attributes until we assume the internal function to be live. This
improves the number of required iterations, as well as the number of
required updates, in real code. On our tests, the results are mixed.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Use the white list for attributes consistently
Johannes Doerfert [Wed, 4 Sep 2019 16:26:20 +0000 (16:26 +0000)]
[Attributor] Use the white list for attributes consistently

Summary:
We create attributes on-demand so we need to check the white list
on-demand. This also unifies the location at which we create,
initialize, and eventually invalidate new abstract attributes.

The tests show mixed results, a few more call site attributes are
determined which can cause more iterations.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU/GlobalISel: Make 16-bit constants legal
Matt Arsenault [Wed, 4 Sep 2019 16:19:45 +0000 (16:19 +0000)]
AMDGPU/GlobalISel: Make 16-bit constants legal

This is mostly for the benefit of patterns which use 16-bit constants.

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

5 years agoGlobalISel/TableGen: Don't skip REG_SEQUENCE based on patterns
Matt Arsenault [Wed, 4 Sep 2019 16:19:34 +0000 (16:19 +0000)]
GlobalISel/TableGen: Don't skip REG_SEQUENCE based on patterns

This partially adds support for patterns with REG_SEQUENCE. The source
patterns are now accepted, but the pattern is still rejected due to
missing support for the instruction renderer.

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

5 years agoGlobalISel: Define GINodeEquiv for undef
Matt Arsenault [Wed, 4 Sep 2019 16:19:29 +0000 (16:19 +0000)]
GlobalISel: Define GINodeEquiv for undef

AMDGPU uses this for undef vector elements in some patterns which will
be enabled in a future patch.

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

5 years ago[Attributor] Deal more explicit with non-exact definitions
Johannes Doerfert [Wed, 4 Sep 2019 16:16:13 +0000 (16:16 +0000)]
[Attributor] Deal more explicit with non-exact definitions

Summary:
Before we tried to rule out non-exact definitions early but that lead to
on-demand attributes created for them anyway. As a consequence we needed
to look at the definition in the initialize of each attribute again.
This patch centralized this lookup and tightens the condition under
which we give up on non-exact definitions.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu...
Craig Topper [Wed, 4 Sep 2019 16:01:43 +0000 (16:01 +0000)]
[X86] Add support for avx512bf16 for __builtin_cpu_supports and compiler-rt's cpu indicator.

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

5 years ago[Attributor] Ensure AAIsDead correctly overrides getIRPosition
Simon Pilgrim [Wed, 4 Sep 2019 16:01:09 +0000 (16:01 +0000)]
[Attributor] Ensure AAIsDead correctly overrides getIRPosition

As commented on D65712, the getIRPosition methods weren't correctly being overridden.

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

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

5 years ago[Hexagon] Improve generated code for test-if-bit-clear, one more time
Krzysztof Parzyszek [Wed, 4 Sep 2019 15:22:36 +0000 (15:22 +0000)]
[Hexagon] Improve generated code for test-if-bit-clear, one more time

Adjust isel patterns after recent commit. Fixes https://llvm.org/PR43194.

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

5 years ago[InstSimplify] guard against unreachable code (PR43218)
Sanjay Patel [Wed, 4 Sep 2019 15:12:55 +0000 (15:12 +0000)]
[InstSimplify] guard against unreachable code (PR43218)

This would crash:
https://bugs.llvm.org/show_bug.cgi?id=43218

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

5 years ago[Debuginfo][SROA] Need to handle dbg.value in SROA pass.
Alexey Lapshin [Wed, 4 Sep 2019 14:19:49 +0000 (14:19 +0000)]
[Debuginfo][SROA] Need to handle dbg.value in SROA pass.

SROA pass processes debug info incorrecly if applied twice.
Specifically, after SROA works first time, instcombine converts dbg.declare
intrinsics into dbg.value. Inlining creates new opportunities for SROA,
so it is called again. This time it does not handle correctly previously
inserted dbg.value intrinsics.

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

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

5 years ago[InstCombine] add tests for insert/extract with identity shuffles; NFC
Sanjay Patel [Wed, 4 Sep 2019 13:38:49 +0000 (13:38 +0000)]
[InstCombine] add tests for insert/extract with identity shuffles; NFC

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

5 years ago[ModuloSchedule] Fix no-asserts build
James Molloy [Wed, 4 Sep 2019 12:57:23 +0000 (12:57 +0000)]
[ModuloSchedule] Fix no-asserts build

Apologies, due to a git SNAFU this fix (dump doesn't exist and silence unused variables) stayed in my index rather than applying to rL370893.

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

5 years ago[ModuloSchedule] Introduce PeelingModuloScheduleExpander
James Molloy [Wed, 4 Sep 2019 12:54:24 +0000 (12:54 +0000)]
[ModuloSchedule] Introduce PeelingModuloScheduleExpander

This is the beginnings of a reimplementation of ModuloScheduleExpander. It works
by generating a single-block correct pipelined kernel and then peeling out the
prolog and epilogs.

This patch implements kernel generation as well as a validator that will
confirm the number of phis added is the same as the ModuloScheduleExpander.

Prolog and epilog peeling will come in a different patch.

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

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

5 years agoFix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.
Simon Pilgrim [Wed, 4 Sep 2019 12:51:40 +0000 (12:51 +0000)]
Fix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.

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

5 years ago[NFC] Added a negative test for new fold
David Bolvansky [Wed, 4 Sep 2019 12:46:25 +0000 (12:46 +0000)]
[NFC] Added a negative test for new fold

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

5 years ago[NFC] Fixed test
David Bolvansky [Wed, 4 Sep 2019 12:43:14 +0000 (12:43 +0000)]
[NFC] Fixed test

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

5 years ago[NFC] Adjust tests for new fold
David Bolvansky [Wed, 4 Sep 2019 12:22:28 +0000 (12:22 +0000)]
[NFC] Adjust tests for new fold

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

5 years ago[NFC] Added tests for new fold
David Bolvansky [Wed, 4 Sep 2019 12:18:53 +0000 (12:18 +0000)]
[NFC] Added tests for new fold

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

5 years ago[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)
David Bolvansky [Wed, 4 Sep 2019 12:00:33 +0000 (12:00 +0000)]
[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)

Summary:
```
Name: sub or and to xor
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %or, %and
  =>
%sub = xor i32 %x, %y

Optimization: sub or and to xor
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/eJu

Reviewers: spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoFix address sizes in the dwarfdump-debug-loc-error-cases test
Pavel Labath [Wed, 4 Sep 2019 11:47:20 +0000 (11:47 +0000)]
Fix address sizes in the dwarfdump-debug-loc-error-cases test

the test is building a 64-bit executable, so the addresses should be
64-bit too. The test was still passing even with smaller address size,
but it was hitting the "unexpected end of data" error sooner than it
should.

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

5 years ago[NFC] Added a new test for D67153
David Bolvansky [Wed, 4 Sep 2019 11:44:00 +0000 (11:44 +0000)]
[NFC] Added a new test for D67153

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

5 years ago[NFC] Added tests for 'SUB of OR and AND to XOR' fold
David Bolvansky [Wed, 4 Sep 2019 11:17:08 +0000 (11:17 +0000)]
[NFC] Added tests for 'SUB of OR and AND to XOR' fold

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

5 years ago[DebugInfo] LiveDebugValues: locations with different exprs should not be merged
Jeremy Morse [Wed, 4 Sep 2019 11:09:05 +0000 (11:09 +0000)]
[DebugInfo] LiveDebugValues: locations with different exprs should not be merged

When comparing variable locations, LiveDebugValues currently considers only
the machine location, ignoring any DIExpression applied to it. This is a
problem because that DIExpression can do pretty much anything to the machine
location, for example dereferencing it.

This patch adds DIExpressions to that comparison; now variables based on the
same register/memory-location but with different expressions will compare
differently, and be dropped if we attempt to merge them between blocks. This
reduces variable coverage-range a little, but only because we were producing
broken locations.

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

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

5 years agogn build: Merge r370862
Nico Weber [Wed, 4 Sep 2019 11:08:09 +0000 (11:08 +0000)]
gn build: Merge r370862

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

5 years agoRevert "[Clang Interpreter] Initial patch for the constexpr interpreter"
Roman Lebedev [Wed, 4 Sep 2019 10:57:06 +0000 (10:57 +0000)]
Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"

Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency
graphs. (clangInterp depends on clangAST which depends on clangInterp)

This reverts r370839, which is an yet another recommit of D64146.

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

5 years ago[cmake] Remove MSVC C4180 override
Simon Pilgrim [Wed, 4 Sep 2019 10:26:39 +0000 (10:26 +0000)]
[cmake] Remove MSVC C4180 override

Tested on VS2017 and VS2019 llvm/clang builds with WX enabled - its no longer necessary to disable this warning.

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

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

5 years ago[LiveDebugValues][NFC] Silence an unused variable warning
Jeremy Morse [Wed, 4 Sep 2019 10:18:03 +0000 (10:18 +0000)]
[LiveDebugValues][NFC] Silence an unused variable warning

On release builds, 'MI' isn't used by anything (it's already inserted into a
block by BuildMI), while on non-release builds it's used by a LLVM_DEBUG
statement. Mark as explicitly used to avoid the warning.

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

5 years agoDWARF: Fix a regression in location list dumping
Pavel Labath [Wed, 4 Sep 2019 10:09:12 +0000 (10:09 +0000)]
DWARF: Fix a regression in location list dumping

Summary:
While fixing the handling of some error cases, r370363 introduced new
problems -- assertion failures due to unchecked errors (my excuse is that a very
early version of that patch used Optional<T> instead of Expected).

This patch adds proper handling of parsing errors encountered when
dumping location lists from inside DWARF DIEs, and adds a bunch of
additional tests.

I reorder the arguments of the location list dumping functions to make
them consistent, and also be able to dump the two kinds of location
lists generically.

Reviewers: JDevlieghere, dblaikie, probinson

Subscribers: aprantl, llvm-commits

Tags: #llvm

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

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

5 years ago[cmake] Remove MSVC C4258 override
Simon Pilgrim [Wed, 4 Sep 2019 10:01:31 +0000 (10:01 +0000)]
[cmake] Remove MSVC C4258 override

Tested on VS2017 and VS2019 llvm/clang builds with WX enabled - its no longer necessary to disable this warning.

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

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

5 years ago[llvm-dwarfdump] Fix spelling in the comments. NFC
Djordje Todorovic [Wed, 4 Sep 2019 09:44:09 +0000 (09:44 +0000)]
[llvm-dwarfdump] Fix spelling in the comments. NFC

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

5 years ago[llvm-objcopy] Add objcopy::elf::Object::allocSections to simplify loops on SHF_ALLOC...
Fangrui Song [Wed, 4 Sep 2019 09:35:32 +0000 (09:35 +0000)]
[llvm-objcopy] Add objcopy::elf::Object::allocSections to simplify loops on SHF_ALLOC sections

Reviewed By: jhenderson

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

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