platform/upstream/llvm.git
4 years ago Reapply af57dbf12e54 "Add support for options -frounding-math, ftrapping...
Melanie Blower [Mon, 2 Dec 2019 19:22:52 +0000 (11:22 -0800)]
    Reapply af57dbf12e54 "Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="

        Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048
        The original patch is modified to set the strictfp IR attribute
        explicitly in CodeGen instead of as a side effect of IRBuilder

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

4 years agoRevert "Add some missing includes to MicrosoftDemangle.cpp (PR44217)"
David Blaikie [Wed, 4 Dec 2019 19:09:18 +0000 (11:09 -0800)]
Revert "Add some missing includes to MicrosoftDemangle.cpp (PR44217)"

This reverts commit 9b962d83ece841e43fd2823375dc6ddc94c1b178.

This didn't address the underlying issue (in MicrosoftDemangleNodes.h)
that was fixed 6 months ago anyway.

4 years agoRevert "[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic...
Tozer [Wed, 4 Dec 2019 18:47:08 +0000 (18:47 +0000)]
Revert "[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks"

This reverts commit 72ce759928e6dfee6a9efa310b966c19722352ba.

Reverted due to build failure.

4 years agoReland [AArch64][MachineOutliner] Return address signing for outlined functions
David Tellenbach [Tue, 3 Dec 2019 16:37:56 +0000 (17:37 +0100)]
Reland [AArch64][MachineOutliner] Return address signing for outlined functions

Summary:
Reland after fixing a bug that allowed outlining of SP modifying instructions
that invalidated return address signing.

During AArch64 frame lowering instructions to enable return address
signing are inserted into functions if needed. Functions generated during
machine outlining don't run through target frame lowering and hence are
missing such instructions.

This patch introduces the following changes:

1. If not all functions that potentially participate in function outlining agree
   on their return address signing scope and their return address signing key,
   outlining is disabled for these functions.
2. If not all functions that potentially participate in function outlining agree
   on their support for v8.3A features, outlining is disabled for these
   functions.
3. If an outlining candidate would outline instructions that modify sp in a way
   that invalidates return address signing, outlining is disabled for that
   particular candidate.
4. If all candidate functions agree on the signing scope, signing key and their
   support for v8.3 features, the outlined function behaves as if it had the
   same scope and key attributes and as if it would provide the same v8.3A
   support as the original functions.

Reviewers: ostannard, paquette

Reviewed By: ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[Coverage] Revise format to reduce binary size"
Vedant Kumar [Wed, 4 Dec 2019 18:35:14 +0000 (10:35 -0800)]
Revert "[Coverage] Revise format to reduce binary size"

This reverts commit e18531595bba495946aa52c0a16b9f9238cff8bc.

On Windows, there is an error:

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/54963/steps/stage%201%20check/logs/stdio

error: C:\b\slave\sanitizer-windows\build\stage1\projects\compiler-rt\test\profile\Profile-x86_64\Output\instrprof-merging.cpp.tmp.v1.o: Failed to load coverage: Malformed coverage data

4 years ago[dsymutil] Remove recursion from lookForChildDIEsToKeep (2/2) (NFC)
Jonas Devlieghere [Wed, 4 Dec 2019 03:41:04 +0000 (19:41 -0800)]
[dsymutil] Remove recursion from lookForChildDIEsToKeep (2/2) (NFC)

The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this
has always been the case, it became a bigger issue when we parallelized
dsymutil, because threads get only a fraction of the stack space.

This patch removes the final recursive call from lookForDIEsToKeep. The
call was used to look at the current DIE's parent chain and mark
everything as kept.

This was tested by running dsymutil on clang built in debug (both with
and without modules) and comparing the MD5 hash of the generated dSYM
companion file.

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

4 years ago[dsymutil] Remove recursion from lookForChildDIEsToKeep (1/2) (NFC)
Jonas Devlieghere [Tue, 3 Dec 2019 19:10:04 +0000 (11:10 -0800)]
[dsymutil] Remove recursion from lookForChildDIEsToKeep (1/2) (NFC)

The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this
has always been the case, it became a bigger issue when we parallelized
dsymutil, because threads get only a fraction of the stack space.

In an attempt to tackle this issue, we removed part of the recursion in
r338536 by introducing a worklist. Processing of child DIEs was no
longer recursive. However, we still received bug reports where we'd run
out of stack space.

This patch removes another recursive call from lookForDIEsToKeep. The
call was used to look at DIEs that reference the current DIE. To make
this possible, we inlined keepDIEAndDependencies and added this work to
the existing worklist. Because the function is not tail recursive, we
needed to add two more types of worklist entries to perform the
subsequent work.

This was tested by running dsymutil on clang built in debug (both with
and without modules) and comparing the MD5 hash of the generated dSYM
companion file.

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

4 years ago[Coverage] Revise format to reduce binary size
Vedant Kumar [Mon, 21 Oct 2019 18:48:38 +0000 (11:48 -0700)]
[Coverage] Revise format to reduce binary size

Revise the coverage mapping format to reduce binary size by:

1. Naming function records and marking them `linkonce_odr`, and
2. Compressing filenames.

This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
and speeds up end-to-end single-threaded report generation by 10%. For
reference the compressed name data in llc is 81MB (__llvm_prf_names).

Rationale for changes to the format:

- With the current format, most coverage function records are discarded.
  E.g., more than 97% of the records in llc are *duplicate* placeholders
  for functions visible-but-not-used in TUs. Placeholders *are* used to
  show under-covered functions, but duplicate placeholders waste space.

- We reached general consensus about giving (1) a try at the 2017 code
  coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
  duplicates is simpler than alternatives like teaching build systems
  about a coverage-aware database/module/etc on the side.

- Revising the format is expensive due to the backwards compatibility
  requirement, so we might as well compress filenames while we're at it.
  This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).

See CoverageMappingFormat.rst for the details on what exactly has
changed.

Fixes PR34533 [2], hopefully.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
[2] https://bugs.llvm.org/show_bug.cgi?id=34533

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

4 years ago[Gold Tests] Add missing target flag to X86 test
Troy Johnson [Wed, 4 Dec 2019 17:50:44 +0000 (11:50 -0600)]
[Gold Tests] Add missing target flag to X86 test

This test was failing on non-X86 targets because the gold invocation did not
have the necessary -m flag.

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

4 years ago[LoopInterchange] Improve inner exit loop safety checks.
Florian Hahn [Wed, 4 Dec 2019 17:26:29 +0000 (17:26 +0000)]
[LoopInterchange] Improve inner exit loop safety checks.

The PHI node checks for inner loop exits are too permissive currently.
As indicated by an existing comment, we should only allow LCSSA PHI
nodes that are part of reductions or are only used outside of the loop
nest. We ensure this by checking the users of the LCSSA PHIs.
Specifically, it is not safe to use an exiting value from the inner loop in the latch of the outer
loop.

It also moves the inner loop exit check before the outer loop exit
check.

Fixes PR43473.

Reviewers: efriedma, mcrosier

Reviewed By: efriedma

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

4 years ago[llvm][Transform] Remove unused variable. [NFCI]
Francesco Petrogalli [Wed, 4 Dec 2019 17:12:48 +0000 (17:12 +0000)]
[llvm][Transform] Remove unused variable. [NFCI]

The variable prevents compiling when using -Werror=unused-variable.

4 years ago[HIP] Remove opencl.amdgcn.lib
Yaxun (Sam) Liu [Tue, 3 Dec 2019 21:07:46 +0000 (16:07 -0500)]
[HIP] Remove opencl.amdgcn.lib

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

4 years ago[PGO][PGSO] Distinguish queries from unit tests and explicitly enable for the existin...
Hiroshi Yamauchi [Tue, 3 Dec 2019 23:02:37 +0000 (15:02 -0800)]
[PGO][PGSO] Distinguish queries from unit tests and explicitly enable for the existing IR passes only. NFC.

Summary:
This is one more prep step necessary before the code gen pass instrumentation
code could go in.

Reviewers: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SVE][AArch64] Adding patterns for while intrinsics.
Mikhail Gudim [Wed, 4 Dec 2019 15:20:56 +0000 (10:20 -0500)]
[SVE][AArch64] Adding patterns for while intrinsics.

4 years agoSmall nit in SelectionDAG.h . NFC
Amaury Séchet [Wed, 4 Dec 2019 16:37:00 +0000 (17:37 +0100)]
Small nit in SelectionDAG.h . NFC

4 years ago[LVI] Restructure caching
Nikita Popov [Sat, 16 Nov 2019 15:22:18 +0000 (16:22 +0100)]
[LVI] Restructure caching

Variant on D70103. The caching is switched to always use a BB to
cache entry map, which then contains per-value caches. A separate
set contains value handles with a deletion callback. This allows us
to properly invalidate overdefined values.

A possible alternative would be to always cache by value first and
have per-BB maps/sets in the each cache entry. In that case we could
use a ValueMap and would avoid the separate value handle set. I went
with the BB indexing at the top level to make it easier to integrate
D69914, but possibly that's not the right choice.

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

4 years ago[XCOFF][AIX] Emit TOC entries for object file generation
jasonliu [Wed, 4 Dec 2019 16:22:57 +0000 (16:22 +0000)]
[XCOFF][AIX] Emit TOC entries for object file generation

Summary:
Implement emitTCEntry for PPCTargetXCOFFStreamer.
Add TC csects to TOCCsects for object file writing.

Note:

1. I did not include any raw data testing for this object file generation
because TC entries raw data will all be 0 without relocation implemented.
I will add raw data testing as part of relocation testing later.
2. I removed "Symbol->setFragment(F);" for common symbols because we
 don't need it, and if we have it then we would hit assertions below:
Assertion `(SymbolContents == SymContentsUnset ||
            SymbolContents == SymContentsOffset) &&
            "Cannot get offset for a common/variable symbol"' failed.
3.Fixed incorrect TOC-base alignment.

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

4 years ago[libomptarget] Build a minimal deviceRTL for amdgcn
JonChesterfield [Wed, 4 Dec 2019 16:43:16 +0000 (16:43 +0000)]
[libomptarget] Build a minimal deviceRTL for amdgcn

Summary:
[libomptarget] Build a minimal deviceRTL for amdgcn

Repeat of D70414, with an include path fixed. Diff for sanity checking.

The CMakeLists.txt file is functionally identical to the one used in the aomp fork.
Whitespace changes were made based on nvptx/CMakeLists.txt, plus the
copyright notice updated to match (Greg was the original author so would
like his sign off on that here).

This change will build a small subset of the deviceRTL if an appropriate toolchain is
available, e.g. a local install of rocm. Support.h is moved from nvptx as a dependency
of debug.h.

Reviewers: ABataev, jdoerfert

Reviewed By: ABataev

Subscribers: jvesely, mgorny, jfb, openmp-commits, jdoerfert

Tags: #openmp

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

4 years agoAdd some missing includes to MicrosoftDemangle.cpp (PR44217)
David Blaikie [Wed, 4 Dec 2019 15:48:30 +0000 (07:48 -0800)]
Add some missing includes to MicrosoftDemangle.cpp (PR44217)

4 years ago[llvm-ar][test] Add to thin archive test coverage
gbreynoo [Wed, 4 Dec 2019 16:17:42 +0000 (16:17 +0000)]
[llvm-ar][test] Add to thin archive test coverage

This diff adds test coverage for thin archives including additions to
existing tests. In some cases I have updated the formats of these tests
to better match other tests in the archive.

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

4 years ago[lldb] Simplify debug_{rnglists,ranges}.s tests
Pavel Labath [Wed, 4 Dec 2019 14:54:59 +0000 (15:54 +0100)]
[lldb] Simplify debug_{rnglists,ranges}.s tests

Remove things irrelevant to the test.

4 years ago[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks
stozer [Wed, 4 Dec 2019 09:44:02 +0000 (09:44 +0000)]
[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks

When basic blocks are killed, either due to being empty or to being an if.then
or if.else block whose complement contains identical instructions, some of the
debug intrinsics in that block are lost. This patch sinks those intrinsics
into the single successor block, setting them Undef if necessary to
prevent debug info from falling out-of-date.

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

4 years agoReapply "[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles"
Kadir Cetinkaya [Wed, 4 Dec 2019 15:34:56 +0000 (16:34 +0100)]
Reapply "[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles"

Attemps to fix windows buildbots.

4 years ago[ELF] Support for PT_GNU_PROPERTY in header and tools
Peter Smith [Fri, 29 Nov 2019 19:12:49 +0000 (19:12 +0000)]
[ELF] Support for PT_GNU_PROPERTY in header and tools

The PT_GNU_PROPERTY is generated by a linker to describe the
.note.gnu.property section. The Linux kernel uses this program header to
locate the .note.gnu.property section.

It is described in "The Linux gABI extension"

Include support for llvm-readelf, llvm-readobj and the yaml reader and
writers.

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

4 years agoAutomaticaly generate copysign-constant-magnitude.ll . NFC
Amaury Séchet [Wed, 4 Dec 2019 15:05:30 +0000 (16:05 +0100)]
Automaticaly generate copysign-constant-magnitude.ll . NFC

4 years agoRevert "[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles"
Kadir Cetinkaya [Wed, 4 Dec 2019 14:50:27 +0000 (15:50 +0100)]
Revert "[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles"

This reverts commit 75656005dbc8866e1888932a68a830b0df403560.

4 years agoChange Target::FindBreakpointsByName to return Expected<vector>
Joseph Tremoulet [Fri, 22 Nov 2019 17:59:46 +0000 (12:59 -0500)]
Change Target::FindBreakpointsByName to return Expected<vector>

Summary:
Using a BreakpointList corrupts the breakpoints' IDs because
BreakpointList::Add sets the ID, so use a vector instead, and
update the signature to return the vector wrapped in an
llvm::Expected which can propagate any error from the inner
call to StringIsBreakpointName.

Note that, despite the similar name, SBTarget::FindBreakpointsByName
doesn't suffer the same problem, because it uses a SBBreakpointList,
which is more like a BreakpointIDList than a BreakpointList under the
covers.

Add a check to TestBreakpointNames that, without this fix, notices the
ID getting mutated and fails.

Reviewers: jingham, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[clang-change-namespace] Change file pattern to be an anchored regex
Kadir Cetinkaya [Wed, 4 Dec 2019 14:48:21 +0000 (15:48 +0100)]
[clang-change-namespace] Change file pattern to be an anchored regex

4 years ago[opencl] Fix address space deduction on array variables.
Michael Liao [Mon, 2 Dec 2019 18:13:52 +0000 (13:13 -0500)]
[opencl] Fix address space deduction on array variables.

Summary:

- The deduced address space needs applying to its element type as well.

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits

Tags: #clang

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

4 years ago[ARM][MVE][Intrinsics] Add VMULH/VRMULH intrinsics.
Mark Murray [Mon, 2 Dec 2019 15:22:24 +0000 (15:22 +0000)]
[ARM][MVE][Intrinsics] Add VMULH/VRMULH intrinsics.

Summary: Add MVE VMULH/VRMULH intrinsics and unit tests.

Reviewers: simon_tatham, ostannard, dmgreen

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agogn build: Merge 45ef055d4ff
LLVM GN Syncbot [Wed, 4 Dec 2019 14:21:10 +0000 (14:21 +0000)]
gn build: Merge 45ef055d4ff

4 years ago[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles
Kadir Cetinkaya [Fri, 29 Nov 2019 14:37:14 +0000 (15:37 +0100)]
[llvm][Support] Take in CurrentDirectory as a parameter in ExpandResponseFiles

Summary:
This is a follow-up to D70769 and D70222, which allows propagation of
current directory down to ExpandResponseFiles for handling of relative paths.

Previously clients had to mutate FS to achieve that, which is not thread-safe
and can even be thread-hostile in the case of real file system.

Reviewers: sammccall

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[clang][Tooling] Add support for .rsp files in compile_commands.json
Kadir Cetinkaya [Fri, 29 Nov 2019 11:14:25 +0000 (12:14 +0100)]
[clang][Tooling] Add support for .rsp files in compile_commands.json

Summary:
Add support for .rsp files.

Fixes https://github.com/clangd/clangd/issues/81

Patch By: liu hui(@lh123)

Reviewers: sammccall, ilya-biryukov, hokein, kadircet

Reviewed By: kadircet

Subscribers: merge_guards_bot, mgorny, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang-tools-extra, #clang

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

4 years ago[Support] add vfs support for ExpandResponseFiles
Kadir Cetinkaya [Fri, 29 Nov 2019 11:14:24 +0000 (12:14 +0100)]
[Support] add vfs support for ExpandResponseFiles

Summary: add vfs support for `ExpandResponseFiles`.

Patch By: liu hui(@lh123)

Reviewers: kadircet, espindola, alexshap, rupprecht, jhenderson

Reviewed By: kadircet

Subscribers: mgorny, sammccall, merge_guards_bot, emaste, sbc100, arichardson, hiraditya, aheejin, jakehehrlich, MaskRay, rupprecht, seiya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[clangd] register cuda language activation event and activate for .cuh files
ptaylor [Wed, 4 Dec 2019 13:58:23 +0000 (14:58 +0100)]
[clangd] register cuda language activation event and activate for .cuh files

Patch by Paul Taylor!

Reviewers: hokein

Reviewed By: hokein

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

Tags: #clang

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

4 years ago[lldb] Fix macOS build by replacing nullptr with FileSpec()
Raphael Isemann [Wed, 4 Dec 2019 13:36:14 +0000 (14:36 +0100)]
[lldb] Fix macOS build by replacing nullptr with FileSpec()

Before we had a implicit conversion from nullptr to FileSpec
which was thankfully removed.

4 years ago[NFC][InstCombine] Update sub-of-negatible.ll test
Roman Lebedev [Wed, 4 Dec 2019 12:48:19 +0000 (15:48 +0300)]
[NFC][InstCombine] Update sub-of-negatible.ll test

4 years ago[OpenCL] Allow addr space qualifiers on lambda call expressions
Anastasia Stulova [Tue, 3 Dec 2019 17:24:33 +0000 (17:24 +0000)]
[OpenCL] Allow addr space qualifiers on lambda call expressions

The addr space qualifier can be added optionally for lambdas after
the attributes. They will alter the default addr space of lambda
call operator that is in generic address space by default for OpenCL.

Syntax:

[ captures ] ( params ) specifiers exception attr opencl_addrspace
                    -> ret { body }

Example:

[&] (int i) mutable __global { ... };

On the call into lambda a compatibility check will be performed to
determine whether address space of lambda object and its call operator
are compatible. This will follow regular addr space conversion rules
and there will be no difference to how addr spaces work in method
qualifiers.

Tags: #clang

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

4 years agoActually delay processing DelayedDllExportClasses until the outermost class is finish...
Hans Wennborg [Mon, 2 Dec 2019 15:25:23 +0000 (16:25 +0100)]
Actually delay processing DelayedDllExportClasses until the outermost class is finished (PR40006)

This was already the intention of DelayedDllExportClasses, but code such as
this would break it:

template<typename> struct Tmpl {};
struct Outer {
    struct Inner {
        __declspec(dllexport) Inner() = default;
        unsigned int x = 0;
    };
    Tmpl<Inner> y;
};

ActOnFinishCXXNonNestedClass() would get called when the instantiation of
Templ<Inner> is finished, even though the compiler is still not finished with
Outer, causing the compile fail.

This hooks into Sema::{Push,Pop}ParsingClass() to avoid calling
ActOnFinishCXXNonNestedClass() for template instantiations while a class is
being parsed.

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

4 years ago[AArch64][SVE] Implement reversal intrinsics
Cullen Rhodes [Wed, 4 Dec 2019 11:36:30 +0000 (11:36 +0000)]
[AArch64][SVE] Implement reversal intrinsics

Summary:
Adds intrinsics for the following:

    * rbit
    * revb
    * revh
    * revw

Patterns are also defined to map the 'llvm.bswap.*' intrinsic to the SVE
revb instruction.

Reviewers: sdesmalen, huntergr, dancgr, rengolin, efriedma, rovka

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU][MC] Remove duplicate code introduced in r359316.
Jay Foad [Wed, 4 Dec 2019 11:40:09 +0000 (11:40 +0000)]
[AMDGPU][MC] Remove duplicate code introduced in r359316.

4 years ago[clangd] Remove the hanging lit exit-signal.test.
Haojian Wu [Wed, 4 Dec 2019 11:29:53 +0000 (12:29 +0100)]
[clangd] Remove the hanging lit exit-signal.test.

The test was introduced in
https://github.com/llvm/llvm-project/commit/19ac0eaf07e60173baa7ee77fa11568c30b87455.

The test keeps hanging after running "check-clangd", remove it now
and will add it back later after investigations.

4 years ago[SimpleLoopUnswitch] Invalidate the topmost loop with ExitBB as exiting.
Florian Hahn [Wed, 4 Dec 2019 11:24:10 +0000 (11:24 +0000)]
[SimpleLoopUnswitch] Invalidate the topmost loop with ExitBB as exiting.

SCEV caches the exiting blocks when computing exit counts. In
SimpleLoopUnswitch, we split the exit block of the loop to unswitch.

Currently we only invalidate the loop containing that exit block, but if
that block is the exiting block for a parent loop, we have stale cache
entries. We have to invalidate the top-most loop that contains the exit
block as exiting block. We might also be able to skip invalidating the
loop containing the exit block, if the exit block is not an exiting
block of that loop.

There are also 2 more places in SimpleLoopUnswitch, that use a similar
problematic approach to get the loop to invalidate. If the patch makes
sense, I will also update those places to a similar approach (they deal
with multiple exit blocks, so we cannot directly re-use
getTopMostExitingLoop).

Fixes PR43972.

Reviewers: skatkov, reames, asbirlea, chandlerc

Reviewed By: asbirlea

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

4 years agoAllow negative offsets in MipsMCInstLower::LowerOperand
Alex Richardson [Wed, 4 Dec 2019 10:06:24 +0000 (10:06 +0000)]
Allow negative offsets in MipsMCInstLower::LowerOperand

Summary:
We rely on this in our CHERI backend to address the GOT by generating a
$pc-relative addresses. For this we emit the following code sequence:

lui $1, %pcrel_hi(_CHERI_CAPABILITY_TABLE_-8)
daddiu $1, $1, %pcrel_lo(_CHERI_CAPABILITY_TABLE_-4)
cgetpccincoffset $c1, $1

However, without this change the addend is implicitly converted to
UINT32_MAX and an invalid pointer value is generated.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: merge_guards_bot, sdardis, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

4 years agoHandle BUNDLE instructions in MipsAsmPrinter
Alex Richardson [Wed, 4 Dec 2019 10:06:12 +0000 (10:06 +0000)]
Handle BUNDLE instructions in MipsAsmPrinter

Summary:
In our CHERI fork we use BUNDLE instructions to ensure that a
three-instruction sequence to generate a program-counter-relative value is
emitted without reordering or insertions (since that would break the 32-bit
offset computation).

Currently MipsAsmPrinter asserts when it encounters a pseudo instruction.
To handle BUNDLE we can simply skip the instruction which will then make
EmitInstruction() process the contents of the bundle in order.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: merge_guards_bot, sdardis, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

4 years agoMipsDelaySlotFiller: Don't move BUNDLE instructions into the delay slot
Alex Richardson [Wed, 4 Dec 2019 10:06:02 +0000 (10:06 +0000)]
MipsDelaySlotFiller: Don't move BUNDLE instructions into the delay slot

Summary:
In our CHERI fork we use BUNDLE instructions to ensure that a
three-instruction sequence to generate a program-counter-relative value is
emitted without reordering or insertions (since that would break the 32-bit
offset computation). This sequence is created in MipsExpandPseudo and we use
finalizeBundle() to create the BUNDLE instruction.

However, the delay slot filler currently breaks this pattern since the BUNDLE
will be removed and so all instructions are moved into the delay slot.
Since the delay slot only executes the first instruction, this results in
incorrect computations (and run-time crashes) if the branch is taken.

The original test cases uses CHERI instructions, so for the test case here
I simple filled a BUNDLE with a no-op DADDiu $sp_64, -16 and DADDiu $sp_64, 16.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: merge_guards_bot, sdardis, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

4 years agoAdd debug output to MipsDelaySlotFiller pass
Alex Richardson [Wed, 4 Dec 2019 10:05:02 +0000 (10:05 +0000)]
Add debug output to MipsDelaySlotFiller pass

Summary:
I was tracking down a code-generation bug in this pass and found that the
added output was useful. It is also helpful to find out why a delay slot
could not be filled even though there is clearly a valid instruction (which
appears to mostly be caused by CFI instructions).

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: merge_guards_bot, sdardis, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Add no delayed templates to outline tests
Kadir Cetinkaya [Wed, 4 Dec 2019 11:19:08 +0000 (12:19 +0100)]
[clangd] Add no delayed templates to outline tests

4 years ago[AArch64TTI] Compute imm materialization cost for AArch64 intrinsics
Florian Hahn [Wed, 4 Dec 2019 10:49:24 +0000 (10:49 +0000)]
[AArch64TTI] Compute imm materialization cost for AArch64 intrinsics

Currently, getIntImmCost returns TCC_Free for almost all intrinsics.
For most AArch64 specific intrinsics however, it looks like integer
constants cannot be folded into most of them (at least the ones I checked).

Unless we know that we can fold integer operands with the intrinsic, we
handle more cases correctly by returning the cost to materialize the
immediate than return TCC_Free.

Reviewers: SjoerdMeijer, dmgreen, t.p.northover, ributzka

Reviewed By: SjoerdMeijer

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

4 years ago[NFC] Use default case in EVT::getEVTString
Cullen Rhodes [Wed, 4 Dec 2019 09:55:26 +0000 (09:55 +0000)]
[NFC] Use default case in EVT::getEVTString

Summary:
The default case handles the majority of MVTs so most of the individual
cases can be removed. Also added a case for floating point types.

Reviewed By: sdesmalen

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

4 years agoAMDGPU: Avoid folding 2 constant operands into an SALU operation
David Stuttard [Mon, 2 Dec 2019 13:01:26 +0000 (13:01 +0000)]
AMDGPU: Avoid folding 2 constant operands into an SALU operation

Summary:
Catch the (admittedly unusual) case where SIFoldOperands attempts to fold 2
constant operands into the same SALU operation, with neither operand able to be
encoded as an inline constant.

Change-Id: Ibc48d662c9ffd8bbacd154976b0b1c257ace0927

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[yaml2obj] - Make DynamicSymbols to be Optional<> too.
Georgii Rymar [Tue, 3 Dec 2019 12:48:29 +0000 (15:48 +0300)]
[yaml2obj] - Make DynamicSymbols to be Optional<> too.

We already have Symbols property to list regular symbols and
it is currently Optional<>. This patch makes DynamicSymbols to be optional
too. With this there is no need to define a dummy symbol anymore to trigger
creation of the .dynsym and it is now possible to define an empty .dynsym using
just the following line:

DynamicSymbols: []
(it is important to have when you do not want to have dynamic symbols,
but want to have a .dynsym)

Now the code is consistent and it helped to fix a bug: previously we
did not report an error when both Content/Size and an empty
Symbols/DynamicSymbols list were specified.

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

4 years ago[lldb] Remove some (almost) unused Stream::operator<<'s
Pavel Labath [Tue, 26 Nov 2019 13:45:15 +0000 (14:45 +0100)]
[lldb] Remove some (almost) unused Stream::operator<<'s

llvm::raw_ostream provides equivalent functionality.

4 years ago[APFloat] Prevent construction of APFloat with Semantics and FP value
Ehud Katz [Wed, 4 Dec 2019 09:57:38 +0000 (11:57 +0200)]
[APFloat] Prevent construction of APFloat with Semantics and FP value

Constructor invocations such as `APFloat(APFloat::IEEEdouble(), 0.0)`
may seem like they accept a FP (floating point) value, but the overload
they reach is actually the `integerPart` one, not a `float` or `double`
overload (which only exists when `fltSemantics` isn't passed).

This may lead to possible loss of data, by the conversion from `float`
or `double` to `integerPart`.

To prevent future mistakes, a new constructor overload, which accepts
any FP value and marked with `delete`, to prevent its usage.

Fixes PR34095.

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

4 years ago[lldb] s/assertTrue/assertEqual in TestStepTarget.py
Pavel Labath [Thu, 28 Nov 2019 08:14:44 +0000 (09:14 +0100)]
[lldb] s/assertTrue/assertEqual in TestStepTarget.py

this improves error messages.

4 years ago[lldb] Remove FileSpec(FileSpec*) constructor
Pavel Labath [Thu, 28 Nov 2019 16:02:07 +0000 (17:02 +0100)]
[lldb] Remove FileSpec(FileSpec*) constructor

This constructor was the cause of some pretty weird behavior. Remove it,
and update all code to properly dereference the argument instead.

4 years ago[lldb] Add test for Stream::Address and Stream::AddressRange
Raphael Isemann [Wed, 4 Dec 2019 09:27:18 +0000 (10:27 +0100)]
[lldb] Add test for Stream::Address and Stream::AddressRange

I'm refactoring those functions, so we should have some tests for
them before doing that.

4 years ago[lldb/Editline] Fix a -Wreturn-type warning with gcc
Pavel Labath [Wed, 4 Dec 2019 09:44:12 +0000 (10:44 +0100)]
[lldb/Editline] Fix a -Wreturn-type warning with gcc

4 years ago[lldb] s/FileSpec::Equal/FileSpec::Match
Pavel Labath [Fri, 29 Nov 2019 10:31:00 +0000 (11:31 +0100)]
[lldb] s/FileSpec::Equal/FileSpec::Match

Summary:
The FileSpec class is often used as a sort of a pattern -- one specifies
a bare file name to search, and we check if in matches the full file
name of an existing module (for example).

These comparisons used FileSpec::Equal, which had some support for it
(via the full=false argument), but it was not a good fit for this job.

For one, it did a symmetric comparison, which makes sense for a function
called "equal", but not for typical searches (when searching for
"/foo/bar.so", we don't want to find a module whose name is just
"bar.so"). This resulted in patterns like:
    if (FileSpec::Equal(pattern, file, pattern.GetDirectory()))
which would request a "full" match only if the pattern really contained
a directory. This worked, but the intended behavior was very unobvious.

On top of that, a lot of the code wanted to handle the case of an
"empty" pattern, and treat it as matching everything. This resulted in
conditions like:
    if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory())
which are nearly impossible to decipher.

This patch introduces a FileSpec::Match function, which does exactly
what most of FileSpec::Equal callers want, an asymmetric match between a
"pattern" FileSpec and a an actual FileSpec. Empty paterns match
everything, filename-only patterns match only the filename component.

I've tried to update all callers of FileSpec::Equal to use a simpler
interface. Those that hardcoded full=true have been changed to use
operator==. Those passing full=pattern.GetDirectory() have been changed
to use FileSpec::Match.

There was also a handful of places which hardcoded full=false. I've
changed these to use FileSpec::Match too. This is a slight change in
semantics, but it does not look like that was ever intended, and it was
more likely a result of a misunderstanding of the "proper" way to use
FileSpec::Equal.

[In an ideal world a "FileSpec" and a "FileSpec pattern" would be two
different types, but given how widespread FileSpec is, it is unlikely
we'll get there in one go. This at least provides a good starting point
by centralizing all matching behavior.]

Reviewers: teemperor, JDevlieghere, jdoerfert

Subscribers: emaste, lldb-commits

Tags: #lldb

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

4 years ago[DWARFDebugLoclists] Add support for other DW_LLE encodings
Pavel Labath [Fri, 22 Nov 2019 09:53:09 +0000 (10:53 +0100)]
[DWARFDebugLoclists] Add support for other DW_LLE encodings

Summary:
lldb's loclists parser has support for DW_LLE_start_end(x) encodings. To
avoid regressing when switching the implementation to llvm's, I add
parsing support for all previously unsupported location list encodings.

Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX

Subscribers: hiraditya, probinson, llvm-commits

Tags: #llvm

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

4 years ago[DWARFDebugRnglists] Add a callback-based version of the getAbsoluteRanges function
Pavel Labath [Tue, 26 Nov 2019 09:40:30 +0000 (10:40 +0100)]
[DWARFDebugRnglists] Add a callback-based version of the getAbsoluteRanges function

Summary:
The dump() function already accepts a callback. This makes
getAbsoluteRanges do the same. The existing DWARFUnit overload is
implemented on top of the new function.

This enables usage of the debug_rnglists parser from within lldb (which
has it's own dwarf parser).

Reviewers: dblaikie, JDevlieghere, aprantl

Subscribers: hiraditya, probinson, llvm-commits

Tags: #llvm

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

4 years ago[SelectionDAG] Expand nnan FMINNUM/FMAXNUM to select sequence
Ulrich Weigand [Wed, 4 Dec 2019 09:27:02 +0000 (10:27 +0100)]
[SelectionDAG] Expand nnan FMINNUM/FMAXNUM to select sequence

InstCombine may synthesize FMINNUM/FMAXNUM nodes from fcmp+select
sequences (where the fcmp is marked nnan).  Currently, if the
target does not otherwise handle these nodes, they'll get expanded
to libcalls to fmin/fmax.  However, these functions may reside in
libm, which may introduce a library dependency that was not originally
present in the source code, potentially resulting in link failures.

To fix this problem, add code to TargetLowering::expandFMINNUM_FMAXNUM
to expand FMINNUM/FMAXNUM to a compare+select sequence instead of the
libcall. This is done only if the node is marked as "nnan"; in this case,
the expansion to compare+select is always correct. This also suffices to
catch all cases where FMINNUM/FMAXNUM was synthesized as above.

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

4 years ago[lldb][NFC] Extract single member parsing out of DWARFASTParserClang::ParseChildMembers
Raphael Isemann [Wed, 4 Dec 2019 08:38:49 +0000 (09:38 +0100)]
[lldb][NFC] Extract single member parsing out of DWARFASTParserClang::ParseChildMembers

ParseChildMembers does a few things, only one part is actually parsing a single
member. This extracts the member parsing logic into its own function.

This commit just moves the code as-is into its own function and forwards the parameters/
local variables to it, which means it should be NFC.

The only actual changes to the code are replacing 'break's (and one very curious 'continue'
that behaves like a 'break') with 'return's.

4 years ago[yaml2obj][test] - Remove excessive symtab-shinfo.yaml.
Georgii Rymar [Tue, 3 Dec 2019 13:11:10 +0000 (16:11 +0300)]
[yaml2obj][test] - Remove excessive symtab-shinfo.yaml.

The same testing is performed in `implicit-sections-info.yaml`:
https://github.com/llvm-mirror/llvm/blob/master/test/tools/yaml2obj/implicit-sections-info.yaml

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

4 years ago[lldb][NFC] Migrate to raw_ostream in Module::GetDescription
Raphael Isemann [Wed, 4 Dec 2019 08:20:42 +0000 (09:20 +0100)]
[lldb][NFC] Migrate to raw_ostream in Module::GetDescription

4 years ago[CodeGen][ObjC] Emit a primitive store to store a __strong field in
Akira Hatanaka [Fri, 29 Nov 2019 17:56:02 +0000 (09:56 -0800)]
[CodeGen][ObjC] Emit a primitive store to store a __strong field in
ExpandTypeFromArgs

This fixes a bug in IRGen where a call to `llvm.objc.storeStrong` was
being emitted to initialize a __strong field of an uninitialized
temporary struct, which caused crashes at runtime.

rdar://problem/51807365

4 years agogn build: Merge 9f251eece46
LLVM GN Syncbot [Wed, 4 Dec 2019 07:32:05 +0000 (07:32 +0000)]
gn build: Merge 9f251eece46

4 years agoRevert "Enable `-funwind-tables` flag when building libunwind"
Martin Storsjö [Wed, 4 Dec 2019 07:22:08 +0000 (09:22 +0200)]
Revert "Enable `-funwind-tables` flag when building libunwind"

This reverts commit b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de.

This change broke building libunwind for Windows/MinGW, and broke
on aspect of the CMake tests in libunwind in general.

After set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY), CMake
skips the linking step in tests, but cmake/config-ix.cmake also
does a few checks for functions in libraries (looking for whether
-lc provides fopen and whether -ldl provides dladdr).

As CMake only tests building a static library, these tests
incorrectly succeed and CMake concludes "Looking for fopen in c -
found" and "Looking for dladdr in dl - found", while building
then fails at the end with errors about unable to find -lc and -ldl.

4 years ago[lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple
Raphael Isemann [Wed, 4 Dec 2019 07:27:43 +0000 (08:27 +0100)]
[lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTriple

Reviewers: labath, davide

Reviewed By: davide

Subscribers: clayborg, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[clangd] Define out-of-line qualify function name
Kadir Cetinkaya [Fri, 22 Nov 2019 12:56:02 +0000 (13:56 +0100)]
[clangd] Define out-of-line qualify function name

Summary:
When moving function definitions to a different context, the function
name might need a different spelling, for example in the header it might be:

```
namespace a {
  void foo() {}
}
```

And we might want to move it into a context which doesn't have `namespace a` as
a parent, then we must re-spell the function name, i.e:
```
void a::foo() {}
```

This patch implements a version of this which ignores using namespace
declarations in the source file.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line qualify return value
Kadir Cetinkaya [Tue, 22 Oct 2019 15:02:29 +0000 (17:02 +0200)]
[clangd] Define out-of-line qualify return value

Summary:
Return type might need qualification if insertion context doesn't have
the same decls visible as the source context.

This patch adds qualification for return value to cover such cases.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line initial apply logic
Kadir Cetinkaya [Mon, 21 Oct 2019 16:16:40 +0000 (18:16 +0200)]
[clangd] Define out-of-line initial apply logic

Summary:
Initial implementation for apply logic, replaces function body with a
semicolon in source location and copies the full function definition into target
location.

Will handle qualification of return type and function name in following patches
to keep the changes small.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[clangd] Define out-of-line availability checks
Kadir Cetinkaya [Mon, 21 Oct 2019 16:03:38 +0000 (18:03 +0200)]
[clangd] Define out-of-line availability checks

Summary:
Initial availability checks for performing define out-of-line code
action, which is a refactoring that will help users move function/method
definitions from headers to implementation files.

Proposed implementation only checks whether we have an interesting selection,
namely function name or full function definition/body.

Reviewers: hokein

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[llvm-strip][MachO] Test llvm-strip --strip-debug
Fangrui Song [Wed, 4 Dec 2019 03:54:11 +0000 (19:54 -0800)]
[llvm-strip][MachO] Test llvm-strip --strip-debug

Reviewed By: smeenai

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

4 years ago[MacroFusion] Limit the max fused number as 2 to reduce the dependency
QingShan Zhang [Wed, 4 Dec 2019 04:58:34 +0000 (04:58 +0000)]
[MacroFusion] Limit the max fused number as 2 to reduce the dependency

This is the example:

int foo(int a, int b, int c, int d) {
  return a + b + c + d;
}

And this is the Dependency Graph:
+------+       +------+       +------+       +------+
|  A   |       |  B   |       |  C   |       |  D   |
+--+--++       +---+--+       +--+---+       +--+---+
   ^  ^            ^  ^          ^              ^
   |  |            |  |          |              |
   |  |            |  |New1      +--------------+
   |  |            |  |          |
   |  |            |  |       +--+---+
   |  |New2        |  +-------+ ADD1 |
   |  |            |          +--+---+
   |  |            |    Fuse     ^
   |  |            +-------------+
   |  +------------+
   |               |
   |   Fuse     +--+---+
   +----------->+ ADD2 |
   |            +------+
+--+---+
| ADD3 |
+------+

We need also create an artificial edge from ADD1 to A if
https://reviews.llvm.org/D69998 is landed. That will force the Node A scheduled
before the ADD1 and ADD2. But in fact, it is ok to schedule the Node A
in-between ADD3 and ADD2, as ADD3 and ADD2 are NOT a fusion pair because
ADD2 has been matched to ADD1. We are creating these unnecessary dependency
edges that override the heuristics.

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

4 years ago[PowerPC] folding rlwinm + rlwinm to rlwinm
czhengsz [Wed, 4 Dec 2019 02:48:12 +0000 (21:48 -0500)]
[PowerPC] folding rlwinm + rlwinm to rlwinm

  For example:
    x3 = rlwinm x3, 27, 5, 31
    x3 = rlwinm x3, 19, 0, 12
  can be combined to
    x3 = rlwinm x3, 14, 0, 12

Reviewed by: steven.zhang, lkail

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

4 years ago[Clang] Define Fuchsia C++ABI
Petr Hosek [Sat, 7 Sep 2019 01:59:43 +0000 (18:59 -0700)]
[Clang] Define Fuchsia C++ABI

Currently, it is a modified version of the Itanium ABI, with the only
change being that constructors and destructors return 'this'.

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

4 years agoFix warning on unused variable. NFC.
Michael Liao [Wed, 4 Dec 2019 02:15:17 +0000 (21:15 -0500)]
Fix warning on unused variable. NFC.

4 years ago[dsymutil] Support --out (NFC)
Jonas Devlieghere [Wed, 4 Dec 2019 01:06:05 +0000 (17:06 -0800)]
[dsymutil] Support --out (NFC)

Seems like this got lost during the libOption conversion.

4 years ago[Process] GetLanguageRuntimes() takes an argument that's always constant.
Davide Italiano [Wed, 4 Dec 2019 00:54:04 +0000 (16:54 -0800)]
[Process] GetLanguageRuntimes() takes an argument that's always constant.

And arguably `retry_if_null` isn't really descriptive of what
the flag did anyway.

4 years ago[Diagnostic][test] Remove an unneeded change to pragma_diagnostic_sections.cpp after...
Fangrui Song [Wed, 4 Dec 2019 00:39:48 +0000 (16:39 -0800)]
[Diagnostic][test] Remove an unneeded change to pragma_diagnostic_sections.cpp after D70638

4 years agogn build: (manually) merge ad871e42958
Nico Weber [Wed, 4 Dec 2019 00:22:40 +0000 (19:22 -0500)]
gn build: (manually) merge ad871e42958

4 years ago[ClangASTContext] Remove a very old hack.
Davide Italiano [Wed, 4 Dec 2019 00:31:44 +0000 (16:31 -0800)]
[ClangASTContext] Remove a very old hack.

This was fixed in clang a while ago, and the rdar associated
is now closed.

4 years ago[X86] Model DAZ and FTZ
Wang, Pengfei [Tue, 3 Dec 2019 03:10:22 +0000 (11:10 +0800)]
[X86] Model DAZ and FTZ

Summary: This is a follow-up of D70881. It models DAZ and FTZ for releated instructions.

Reviewers: craig.topper, RKSimon, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Model MXCSR for all AVX512 instructions
Wang, Pengfei [Wed, 27 Nov 2019 13:13:35 +0000 (21:13 +0800)]
[X86] Model MXCSR for all AVX512 instructions

Summary: Model MXCSR for all AVX512 instructions

Reviewers: craig.topper, RKSimon, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits, LuoYuanke, LiuChen3

Tags: #llvm

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

4 years agoAdd discussion of git-format-patch to Phabricator.html
Kit Barton [Fri, 29 Nov 2019 17:05:43 +0000 (12:05 -0500)]
Add discussion of git-format-patch to Phabricator.html

Summary: There is a discussion of git-format-patch in GettingStarted guide, but no mention of it in the Phabricator.html page.

Reviewers: jyknight, delcypher

Reviewed By: delcypher

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[TypeCategory] HasLanguage() is now unused.
Davide Italiano [Tue, 3 Dec 2019 23:06:04 +0000 (15:06 -0800)]
[TypeCategory] HasLanguage() is now unused.

4 years agoFix `sed -e s@FOO@%/S@` and similar when there's @'s in the working directory
Daniel Sanders [Tue, 3 Dec 2019 23:22:30 +0000 (15:22 -0800)]
Fix `sed -e s@FOO@%/S@` and similar when there's @'s in the working directory

Jenkins sometimes starts a new working directory by appending @2 (or
incrementing the number if the @n suffix is already there). This causes
several clang tests to fail as:
  s@INPUT_DIR@%/S/Inputs@g
gets expanded to the invalid:
  s@INPUT_DIR@/path/to/workdir@2/Inputs@g
                               ~~~~~~~~~~
where the part marked with ~'s is interpreted as the flags. These are
invalid and the test fails.

Previous fixes simply exchanged the @ character for another like | but
that's just moving the problem. Address it by adding an expansion that
escapes the @ character we're using as a delimiter as well as other magic
characters in the replacement of sed's s@@@.

There's still room for expansions to cause trouble though. One I ran into
while testing this was that having a directory called foo@bar causes lots
of `CHECK-NOT: foo` directives to match. There's also things like
directories containing `\1`

4 years agoReapply "Fix crash on switch conditions of non-integer types in templates"
Elizabeth Andrews [Tue, 3 Dec 2019 22:20:52 +0000 (14:20 -0800)]
Reapply "Fix crash on switch conditions of non-integer types in templates"

This patch reapplies commit 759948467ea. Patch was reverted due to a
clang-tidy test fail on Windows. The test has been modified. There
are no additional code changes.

Patch was tested with ninja check-all on Windows and Linux.

Summary of code changes:

Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because
the field member is set as type-dependent based on its containing class.
This patch sets the type dependency based on the field's type instead.

This patch fixes Bug 40982.

4 years ago[NFC] Pass a reference to CodeGenFunction to methods of LValue and
Akira Hatanaka [Tue, 3 Dec 2019 23:17:01 +0000 (15:17 -0800)]
[NFC] Pass a reference to CodeGenFunction to methods of LValue and
AggValueSlot

This reapplies 8a5b7c35709d9ce1f44a99f0c5b084bf2696ea17 after a null
dereference bug in CGOpenMPRuntime::emitUserDefinedMapper.

Original commit message:

This is needed for the pointer authentication work we plan to do in the
near future.

https://github.com/apple/llvm-project/blob/a63a81bd9911f87a0b5dcd5bdd7ccdda7124af87/clang/docs/PointerAuthentication.rst

4 years ago[FormatManager] Provide only one variant of EnableCategory.
Davide Italiano [Tue, 3 Dec 2019 23:02:54 +0000 (15:02 -0800)]
[FormatManager] Provide only one variant of EnableCategory.

All the callers pass a single language anyway.

4 years ago[DataVisualization] Simplify. NFCI.
Davide Italiano [Tue, 3 Dec 2019 22:54:59 +0000 (14:54 -0800)]
[DataVisualization] Simplify. NFCI.

4 years ago[MS] Emit exported complete/vbase destructors
Reid Kleckner [Mon, 2 Dec 2019 23:22:44 +0000 (15:22 -0800)]
[MS] Emit exported complete/vbase destructors

Summary:
Fixes PR44205

I checked, and deleting destructors are not affected.

Reviewers: hans

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[compiler-rt] Disable fuzzer large.test when LLVM_ENABLE_EXPENSIVE_CHECKS=ON
Alex Lorenz [Tue, 3 Dec 2019 22:34:02 +0000 (14:34 -0800)]
[compiler-rt] Disable fuzzer large.test when LLVM_ENABLE_EXPENSIVE_CHECKS=ON

This test is timing out on Green Dragon http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/
and looks like it's not executed on other bots with expensive checks
enabled
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win

The test times out at the C++ source file takes too long to build (2+ hours on my machine), as
clang spends a lot of time in IR/MIR verifiers.

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

4 years ago[FPEnv] [PowerPC] Lowering ppc_fp128 StrictFP Nodes to libcalls
Craig Topper [Tue, 3 Dec 2019 22:05:04 +0000 (14:05 -0800)]
[FPEnv] [PowerPC] Lowering ppc_fp128 StrictFP Nodes to libcalls

This is an alternative to D64662 that shares more code between
strict and non-strict nodes. It's modeled after the implementation
that I did for softening.

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

4 years ago[RISCV] Don't force Local Exec TLS for non-PIC
James Clarke [Tue, 3 Dec 2019 22:04:24 +0000 (22:04 +0000)]
[RISCV] Don't force Local Exec TLS for non-PIC

Summary:
Forcing Local Exec TLS requires the use of copy relocations. Copy
relocations need special handling in the runtime linker when being used
against TLS symbols, which is present in glibc, but not in FreeBSD nor
musl, and so cannot be relied upon. Moreover, copy relocations are a
hack that embed the size of an object in the ABI when it otherwise
wouldn't be, and break protected symbols (which are expected to be DSO
local), whilst also wasting space, thus they should be avoided whenever
possible. As discussed in D70398, RISC-V should move away from forcing
Local Exec, and instead use Initial Exec like other targets, with
possible linker relaxation to follow. The RISC-V GCC maintainers also
intend to adopt this more-conventional behaviour (see
https://github.com/riscv/riscv-elf-psabi-doc/issues/122).

Reviewers: asb, MaskRay

Reviewed By: MaskRay

Subscribers: emaste, krytarowski, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits, bsdjhb

Tags: #llvm

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

4 years ago[InstCombine] Revert aafde063aaf09285c701c80cd4b543c2beb523e8 and 6749dc3446671df0523...
Craig Topper [Tue, 3 Dec 2019 21:48:39 +0000 (13:48 -0800)]
[InstCombine] Revert aafde063aaf09285c701c80cd4b543c2beb523e8 and 6749dc3446671df05235d0a218c426a314ac33cd related to bitcast handling of x86_mmx

This reverts these two commits
[InstCombine] Turn (extractelement <1 x i64/double> (bitcast (x86_mmx))) into a single bitcast from x86_mmx to i64/double.
[InstCombine] Don't transform bitcasts between x86_mmx and v1i64 into insertelement/extractelement

We're seeing at least one internal test failure related to a
bitcast that was previously before an inline assembly block
containing emms being placed after it. This leads to the mmx
state ending up not empty after the emms. IR has no way to
make any specific guarantees about this. Reverting these patches
to get back to previous behavior which at least worked for this
test.

4 years ago[TypeCategory] Nothing passes down a list of languages.
Davide Italiano [Tue, 3 Dec 2019 21:36:50 +0000 (13:36 -0800)]
[TypeCategory] Nothing passes down a list of languages.

Summary: This should allow further simplifications, but it's a first step.

Reviewers: teemperor, jingham, friss

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoEnable `-funwind-tables` flag when building libunwind
Sergej Jaskiewicz [Tue, 5 Nov 2019 11:47:24 +0000 (14:47 +0300)]
Enable `-funwind-tables` flag when building libunwind

Summary:
Or, rather, don't accidentally forget to pass it.

This is aimed to solve the problem discussed in [this thread](http://lists.llvm.org/pipermail/llvm-dev/2019-November/136890.html), and to fix [a year-old bug](https://bugs.llvm.org/show_bug.cgi?id=38468).

TL;DR: when building libunwind for ARM Linux, we **need** libunwind to be built with the `-funwind-tables` flag, because, well ARM EHABI needs unwind info produced by this flag. Without the flag all the procedures in libunwind are marked `.cantunwind`, which causes all sorts of bad things. From `_Unwind_Backtrace` not working, to C++ exceptions not being caught (which is the aforementioned bug is about).

Previously, this flag was not added because the CMake check `add_compile_flags_if_supported(-funwind-tables)` produced a false negative. Why? With this flag, the compiler generates calls to the `__aeabi_unwind_cpp_pr0` symbol, which is defined in libunwind itself and obviously is not available at configure time, before libunwind is built. This led to failure at link time during the CMake check. We handle this by disabling the linker for CMake checks in linbunwind.

Also, this patch introduces a lit feature `libunwind-arm-ehabi`, which is used to mark the `signal_frame.pass.cpp` test as unsupported (as was advised by @miyuki in D70397).

Reviewers: peter.smith, phosek, EricWF, compnerd, jroelofs, saugustine, miyuki, jfb

Subscribers: mgorny, kristof.beyls, christof, libcxx-commits, miyuki

Tags: #libc

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

4 years ago[UpdateTestChecks] Change shebang from python to python3
Fangrui Song [Tue, 26 Nov 2019 18:40:52 +0000 (10:40 -0800)]
[UpdateTestChecks] Change shebang from python to python3

'python' means Python 2 on some platforms while Python 3 on others.
'python3' is Python 3 only. Python 2.7 End of Life is set to January 1,
2020. Getting rid of Python 2 support reduces maintenance burden.

Reviewed By: lebedev.ri

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