platform/upstream/llvm.git
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

llvm-svn: 371073

5 years ago[clang-tidy] Fix bugprone-argument-comment bug: negative literal number is not checked.
Alexander Kornienko [Thu, 5 Sep 2019 14:13:57 +0000 (14:13 +0000)]
[clang-tidy] Fix bugprone-argument-comment bug: negative literal number is not checked.

Summary:
For example:
```
void foo(int a);
foo(-2);
```
should be fixed as:
```
foo(/*a=*/-2);
```
This change tries to fix this issue.

Reviewers: alexfh, hokein, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang, #clang-tools-extra

Patch by Yubo Xie.

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

llvm-svn: 371072

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

llvm-svn: 371071

5 years ago[libc++] Revert "Make `vector` unconditionally move elements when exceptions are...
Louis Dionne [Thu, 5 Sep 2019 13:50:28 +0000 (13:50 +0000)]
[libc++] Revert "Make `vector` unconditionally move elements when exceptions are disabled."

This reverts r370502, which broke the use case of a copy-only T (with a
deleted move constructor) when exceptions are disabled. Until we figure
out the right behavior, I'm reverting the commit.

llvm-svn: 371068

5 years ago[libc++] Add a test for resizing of a vector with copy-only elements
Louis Dionne [Thu, 5 Sep 2019 13:50:18 +0000 (13:50 +0000)]
[libc++] Add a test for resizing of a vector with copy-only elements

See https://reviews.llvm.org/D62228#1658620

llvm-svn: 371067

5 years agoAdd -m(no)-spe to clang
Justin Hibbits [Thu, 5 Sep 2019 13:38:46 +0000 (13:38 +0000)]
Add -m(no)-spe to clang

Summary:
r337347 added support for the Signal Processing Engine (SPE) to LLVM.
This follows that up with the clang side.

This adds -mspe and -mno-spe, to match GCC.

Subscribers: nemanjai, kbarton, cfe-commits

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

llvm-svn: 371066

5 years ago[mips] Make a few test cases more tolerant to exact symbol addresses. NFC
Simon Atanasyan [Thu, 5 Sep 2019 13:37:16 +0000 (13:37 +0000)]
[mips] Make a few test cases more tolerant to exact symbol addresses. NFC

llvm-svn: 371065

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

llvm-svn: 371064

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

llvm-svn: 371063

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

llvm-svn: 371061

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

llvm-svn: 371056

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

llvm-svn: 371055

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

llvm-svn: 371054

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

llvm-svn: 371051

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.

llvm-svn: 371050

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

llvm-svn: 371048

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.

llvm-svn: 371047

5 years ago[OpenCL] Add image type handling for builtins
Sven van Haastregt [Thu, 5 Sep 2019 10:01:24 +0000 (10:01 +0000)]
[OpenCL] Add image type handling for builtins

Image types were previously available, but not working.  This patch
adds image type handling.

Rename the image type definitions in the .td file to make them
consistent with other type names.  Use abstract types to represent the
unqualified types.  Instantiate access-qualified image types at the
point of use using, e.g. `ImageType<Image2d, "RO">`.

Add/update TableGen definitions for the read_image/write_image
builtin functions.

Patch by Pierre Gondois and Sven van Haastregt.

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

llvm-svn: 371046

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

llvm-svn: 371045

5 years ago[libclang] Refactored SharedParsedRegionsStorage
Dmitri Gribenko [Thu, 5 Sep 2019 09:48:39 +0000 (09:48 +0000)]
[libclang] Refactored SharedParsedRegionsStorage

Summary:
Removed the `PPRegionSetTy` typedef because it is only used 3 times, and
obscures code more than it helps.

Renamed SharedParsedRegionsStorage to ThreadSafeParsedRegions, because
that better reflects the reason for this type to exist.

Replaced the `copyTo()` method that had an out parameter with a getter.

Renamed the `merge()` method to `addParsedRegions()`.

Renamed `ParsedSrcLocationsTracker::ParsedRegions` to
`ParsedRegionsSnapshot`, which better reflects its role.

Subscribers: arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 371041

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

llvm-svn: 371039

5 years ago[clangd][vscode] Add a flag to enable semantic highlighting in clangd
Haojian Wu [Thu, 5 Sep 2019 09:26:03 +0000 (09:26 +0000)]
[clangd][vscode] Add a flag to enable semantic highlighting in clangd

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 371038

5 years ago[clangd][vscode] Make SemanticHighlightingFeature more self-contained.
Haojian Wu [Thu, 5 Sep 2019 09:14:04 +0000 (09:14 +0000)]
[clangd][vscode] Make SemanticHighlightingFeature more self-contained.

Summary:
so that we don't have too many usage from the client side (just a single
occurrance for register), this also aligns with how other builtin feature
being implemented in vscode.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 371036

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

llvm-svn: 371035

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

llvm-svn: 371033

5 years ago[Sema] Refactor LookupVisibleDecls. NFC
Ilya Biryukov [Thu, 5 Sep 2019 08:59:06 +0000 (08:59 +0000)]
[Sema] Refactor LookupVisibleDecls. NFC

Summary:
We accumulated some configuration parameters for LookupVisibleDecls that
are being passed unchanged to recursive calls, e.g. LoadExternal and
IncludeDependentBases.

At the same time, there is a bunch of parameters that can change in the
recursive invocations.

It is hard to tell the difference between those groups, making the code
hard to follow.

This change introduces a helper struct and factors out the non-changing
bits into fields, making recursive calls in the implementation code easier
to read.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: riccibruno, doug.gregor, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 371032

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

llvm-svn: 371030

5 years ago[lldb][NFC] Stabilize gui/basic test by waiting on prompt
Raphael Isemann [Thu, 5 Sep 2019 08:45:20 +0000 (08:45 +0000)]
[lldb][NFC] Stabilize gui/basic test by waiting on prompt

We should wait on the GUI to exit before tearing down the test.

llvm-svn: 371028

5 years agoRevert r361885 "[Driver] Fix -working-directory issues"
Hans Wennborg [Thu, 5 Sep 2019 08:43:00 +0000 (08:43 +0000)]
Revert r361885 "[Driver] Fix -working-directory issues"

This made clang unable to open files using relative paths on network shares on
Windows (PR43204). On the bug it was pointed out that createPhysicalFileSystem()
is not terribly mature, and using it is risky. Reverting for now until there's
a clear way forward.

> Currently the `-working-directory` option does not actually impact the working
> directory for all of the clang driver, it only impacts how files are looked up
> to make sure they exist.  This means that that clang passes the wrong paths
> to -fdebug-compilation-dir and -coverage-notes-file.
>
> This patch fixes that by changing all the places in the driver where we convert
> to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
> the VFS.  This also changes the default VFS for `Driver` to use a virtualized
> working directory, instead of changing the process's working directory.
>
> Differential Revision: https://reviews.llvm.org/D62271

This also revertes the part of r369938 which checked that -working-directory works.

llvm-svn: 371027

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.

llvm-svn: 371025

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

llvm-svn: 371024

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

llvm-svn: 371023

5 years ago[clang-tidy] Fix definitions in headers check to respect qualifiers
Kadir Cetinkaya [Thu, 5 Sep 2019 08:11:21 +0000 (08:11 +0000)]
[clang-tidy] Fix definitions in headers check to respect qualifiers

Summary:
The check was generating a fix without taking qualifiers in return type
into account. This patch changes the insertion location to be before qualifers.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 371022

5 years agoRename of constants in ASTImporterVisibilityTest. NFC.
Balazs Keri [Thu, 5 Sep 2019 07:59:45 +0000 (07:59 +0000)]
Rename of constants in ASTImporterVisibilityTest. NFC.

Reviewers: martong, a.sidorin, shafik

Reviewed By: shafik

Subscribers: shafik, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 371021

5 years ago[dotest] Remove top-level Makefile
Pavel Labath [Thu, 5 Sep 2019 07:38:55 +0000 (07:38 +0000)]
[dotest] Remove top-level Makefile

This appears to be a really ancient  way of running the test suite. It
is also completely disfunctional now, and probably has been for a long
time.

llvm-svn: 371020

5 years ago[dotest] Centralize initialization commands even more
Pavel Labath [Thu, 5 Sep 2019 07:35:45 +0000 (07:35 +0000)]
[dotest] Centralize initialization commands even more

Summary:
In r367234 we introduced a central place to hold the set up commands for
the various ways we have of launching lldb. However, a number of
commands still remained outside of that.

This patch moves the remaining set up commands into this function, which
allows us to remove manual clang module path setting code in
TestBatchMode.

One unfortunate victim of this approach is TestSTTYBeforeAndAfter which,
due to how it launches lldb (pexpect->expect->lldb), fails get the
quoting right. It would be possible to fix the quoting there, it would be a bit
icky, and none of the commands in this list are really relevant for what this
test is doing, so I just remove the commands outright.

Reviewers: JDevlieghere, jankratochvil

Subscribers: lldb-commits

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

llvm-svn: 371019

5 years agoObliterate LLDB_CONFIGURATION_BUILDANDINTEGRATION
Pavel Labath [Thu, 5 Sep 2019 07:09:31 +0000 (07:09 +0000)]
Obliterate LLDB_CONFIGURATION_BUILDANDINTEGRATION

Summary:
With the XCode project gone, there doesn't seem to be anything setting
this macro anymore -- and the macro wasn't doing much anyway.

Reviewers: jingham, sgraenitz

Subscribers: emaste, lldb-commits

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

llvm-svn: 371018

5 years agoBreakpad: Basic support for STACK WIN unwinding
Pavel Labath [Thu, 5 Sep 2019 07:05:15 +0000 (07:05 +0000)]
Breakpad: Basic support for STACK WIN unwinding

Summary:
This patch makes it possible to unwind via breakpad STACK WIN records.
It is "basic" because two important features are missing:
- support for the .raSearch keyword
- support for multiple STACK WIN records within a single function
Right now, we just reject the .raSearch records, and always pick the
first record for the whole function
SymbolFileBreakpad, and so I think it can serve as a good example of
what is needed of the symbol file and unwinding machinery to make this
work.

However, it is already useful for unwinding in some situations, and it
sets up the general framework for the parsing of these kinds of records,
which reduces the size of the followup patches implementing the two
other components.

Reviewers: amccarth, rnk, markmentovai

Subscribers: lldb-commits

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

llvm-svn: 371017

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

llvm-svn: 371016

5 years ago[dotest] Delete trivial inline test makefiles
Pavel Labath [Thu, 5 Sep 2019 06:55:23 +0000 (06:55 +0000)]
[dotest] Delete trivial inline test makefiles

inline tests are able to generate these automatically

llvm-svn: 371015

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

llvm-svn: 371014

5 years agoAlign output segments correctly
Rui Ueyama [Thu, 5 Sep 2019 05:30:24 +0000 (05:30 +0000)]
Align output segments correctly

Previously, segments were aligned according to their first section's
alignment requirements. That was not correct, but segments are also
aligned to a page boundary, and a page boundary is usually much larger
than a section alignment requirement, so no one noticed this bug before.

Now, lld has --nmagic option which sets maxPageSize to 1 to effectively
disable page alignment, which reveals the issue.

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

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

llvm-svn: 371013

5 years agoAMDGPU: Add builtins for is_shared/is_private
Matt Arsenault [Thu, 5 Sep 2019 03:00:43 +0000 (03:00 +0000)]
AMDGPU: Add builtins for is_shared/is_private

llvm-svn: 371010

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.

llvm-svn: 371009

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.

llvm-svn: 371008

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

llvm-svn: 371007

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

llvm-svn: 371006

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.

llvm-svn: 371005

5 years ago[c++20] Fix some ambiguities in our mangling of lambdas with explicit
Richard Smith [Thu, 5 Sep 2019 01:23:47 +0000 (01:23 +0000)]
[c++20] Fix some ambiguities in our mangling of lambdas with explicit
template parameters.

This finishes the implementation of the proposal described in
https://github.com/itanium-cxx-abi/cxx-abi/issues/31. (We already
implemented the <lambda-sig> extensions, but didn't take them into
account when computing mangling numbers, and didn't deal properly with
expanded parameter packs, and didn't disambiguate between different
levels of template parameters in manglings.)

llvm-svn: 371004

5 years agoRevert "Revert "[builtins] Rounding mode support for addxf3/subxf3""
Yi Kong [Thu, 5 Sep 2019 01:05:05 +0000 (01:05 +0000)]
Revert "Revert "[builtins] Rounding mode support for addxf3/subxf3""

Test failure fixed.

This reverts commit e204d244badb2e9765a1020f41c773f63da208f4.

llvm-svn: 371003

5 years ago[analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.
Artem Dergachev [Thu, 5 Sep 2019 00:44:56 +0000 (00:44 +0000)]
[analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.

Current code assumes flags in CompilerLinkerOptionMap don't use =,
which isn't always true.

Patch by Chris Laplante!

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

llvm-svn: 371002

5 years agoReformat the beginning of the testing doc to make clear how to run all the tests.
Marshall Clow [Thu, 5 Sep 2019 00:38:36 +0000 (00:38 +0000)]
Reformat the beginning of the testing doc to make clear how to run all the tests.

llvm-svn: 371001

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.

llvm-svn: 371000

5 years ago[Disassembler] Simplify a few methods (2/2) (NFC)
Jonas Devlieghere [Wed, 4 Sep 2019 23:05:32 +0000 (23:05 +0000)]
[Disassembler] Simplify a few methods (2/2) (NFC)

Use early returns to highlight preconditions and make the code easier to
follow.

llvm-svn: 370998

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

llvm-svn: 370996

5 years ago[Disassembler] Simplify a few methods (NFC)
Jonas Devlieghere [Wed, 4 Sep 2019 22:38:20 +0000 (22:38 +0000)]
[Disassembler] Simplify a few methods (NFC)

Use early returns to highlight preconditions and make the code easier to
follow.

llvm-svn: 370994

5 years agoFor PR43213, track whether template parameters are implicit through
Richard Smith [Wed, 4 Sep 2019 22:14:50 +0000 (22:14 +0000)]
For PR43213, track whether template parameters are implicit through
template instantiation so we know whether to mangle them in
lambda-expressions.

llvm-svn: 370991

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

llvm-svn: 370988

5 years ago[www] Fix hyperlink syntax in attribute reference.
Richard Smith [Wed, 4 Sep 2019 21:31:22 +0000 (21:31 +0000)]
[www] Fix hyperlink syntax in attribute reference.

llvm-svn: 370987

5 years ago[www] Update attribute reference for 'constinit'.
Richard Smith [Wed, 4 Sep 2019 21:31:21 +0000 (21:31 +0000)]
[www] Update attribute reference for 'constinit'.

llvm-svn: 370986

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

llvm-svn: 370985

5 years ago[test] Escape path to match the literal string
Jonas Devlieghere [Wed, 4 Sep 2019 21:18:46 +0000 (21:18 +0000)]
[test] Escape path to match the literal string

This test was failing when you had things like `+` in your build path.

llvm-svn: 370983

5 years agoDiagnose _Atomic as a C11 extension.
Aaron Ballman [Wed, 4 Sep 2019 21:01:57 +0000 (21:01 +0000)]
Diagnose _Atomic as a C11 extension.

llvm-svn: 370982

5 years ago[DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.
Yuanfang Chen [Wed, 4 Sep 2019 20:58:15 +0000 (20:58 +0000)]
[DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.

This essentially reverts changes from r361400 while keeping behavior for
CodeView.

Reviewers: akhuang, rnk, probinson

Reviewed by: rnk

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 370981

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

llvm-svn: 370980

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

llvm-svn: 370979

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

llvm-svn: 370976

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

llvm-svn: 370975

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

llvm-svn: 370974

5 years ago[c++20] P1143R2: Add support for the C++20 'constinit' keyword.
Richard Smith [Wed, 4 Sep 2019 20:30:37 +0000 (20:30 +0000)]
[c++20] P1143R2: Add support for the C++20 'constinit' keyword.

This is mostly the same as the
[[clang::require_constant_initialization]] attribute, but has a couple
of additional syntactic and semantic restrictions.

In passing, I added a warning for the attribute form being added after
we have already seen the initialization of the variable (but before we
see the definition); that case previously slipped between the cracks and
the attribute was silently ignored.

llvm-svn: 370972

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

llvm-svn: 370971

5 years agoGenerate parent context id from Decl* instead of DeclContext*.
Aaron Ballman [Wed, 4 Sep 2019 20:30:00 +0000 (20:30 +0000)]
Generate parent context id from Decl* instead of DeclContext*.

Because of multiple inheritance, a DeclContext pointer does not produce
the same pointer representation as a Decl pointer that references the
same AST Node.

When dumping the parentDeclContextId field of a node, convert the pointer
to Decl* first, so the id can be used to find the AST node it references.

Patch by Bert Belder.

llvm-svn: 370970

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.

llvm-svn: 370969

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.

llvm-svn: 370968

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()`.

llvm-svn: 370966

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

llvm-svn: 370965

5 years agoRevert "[test] Address TestConcurrentMany*.py flakiness on macOS"
Jonas Devlieghere [Wed, 4 Sep 2019 19:36:29 +0000 (19:36 +0000)]
Revert "[test] Address TestConcurrentMany*.py flakiness on macOS"

This reverts my change to pseudo_barrier.h which isn't necessary anymore
after Fred's fix to debugserver and caused TestThreadStepOut to fail.

llvm-svn: 370963

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

llvm-svn: 370957

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.

llvm-svn: 370956

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

llvm-svn: 370955

5 years ago[Python] Implement __next__ for value_iter
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:13 +0000 (18:59 +0000)]
[Python] Implement __next__ for value_iter

Python 3 iteration calls the next() method instead of next() and
value_iter only implemented the Python 2 version.

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

llvm-svn: 370954

5 years ago[Python] Implement truth testing for lldb.value
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:10 +0000 (18:59 +0000)]
[Python] Implement truth testing for lldb.value

Python 3 calls __bool__() instead of __len__() and lldb.value only
implemented the __len__ method. This adds the __bool__() implementation.

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

llvm-svn: 370953

5 years ago[Python] Fix whitespace before making changes (NFC)
Jonas Devlieghere [Wed, 4 Sep 2019 18:59:06 +0000 (18:59 +0000)]
[Python] Fix whitespace before making changes (NFC)

llvm-svn: 370952

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.

llvm-svn: 370951

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.

llvm-svn: 370950

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

llvm-svn: 370948

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.

llvm-svn: 370947

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

llvm-svn: 370945

5 years ago[OpenMP] Change initialization of __kmp_global
Jonas Hahnfeld [Wed, 4 Sep 2019 17:47:37 +0000 (17:47 +0000)]
[OpenMP] Change initialization of __kmp_global

There's no need to initialize variables with static storage duration
because they're implicitly initialized to zero. See
https://en.cppreference.com/w/c/language/initialization#Implicit_initialization

I think that's already relied upon because the supplied 0 only sets
'kmp_time_global_t g_time;' in 'struct kmp_base_global'. The other fields
are not set in the code, but implicitly initialized by the compiler.

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

llvm-svn: 370943

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.

llvm-svn: 370942

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

llvm-svn: 370941

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

llvm-svn: 370939

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

llvm-svn: 370937

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

llvm-svn: 370936

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

llvm-svn: 370934

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.

llvm-svn: 370933

5 years agoUpstream macCatalyst support in debugserver and the macOS dynamic loader
Adrian Prantl [Wed, 4 Sep 2019 17:23:15 +0000 (17:23 +0000)]
Upstream macCatalyst support in debugserver and the macOS dynamic loader
plugin.

Unfortunately the test is currently XFAILed because of missing changes
to the clang driver.

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

llvm-svn: 370931

5 years ago[OpenMP][Docs] Provide implementation status details
Johannes Doerfert [Wed, 4 Sep 2019 17:15:37 +0000 (17:15 +0000)]
[OpenMP][Docs] Provide implementation status details

This adds a more fine-grained list of OpenMP features with their
implementation status and associated reviews/commits.

Reviewers: kkwli0, ABataev, RaviNarayanaswamy, gtbercea, Hahnfeld

Subscribers: bollu, guansong, jfb, hfinkel, cfe-commits

Tags: #clang

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

llvm-svn: 370930

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.

llvm-svn: 370929

5 years agoAvoid assemble step in verbose-output-quoting.c
Yuanfang Chen [Wed, 4 Sep 2019 17:10:18 +0000 (17:10 +0000)]
Avoid assemble step in verbose-output-quoting.c

Reviewers: hans

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 370928