platform/upstream/llvm.git
5 years ago[nfc][libomptarget] Reorganise support header
JonChesterfield [Thu, 31 Oct 2019 17:14:17 +0000 (17:14 +0000)]
[nfc][libomptarget] Reorganise support header

Summary:
[nfc][libomptarget] Reorganise support header

All functions defined in support implementation are now declared in support.h
Reordered functions in support implementation to match the sequence in support.h
Added include guards to support.h
Added #include interface to support.h to provide kmp_Ident declaration
Move supporti.h to support.cu and s/INLINE/EXTERN/g
Add remaining includes to support.cu

A minor side effect is to change the name mangling of the support functions to
extern "C". If this matters another macro along the lines of INLINE/EXTERN
can be added - perhaps DEVICE as that's the obvious implementation.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: mgorny, jfb, openmp-commits

Tags: #openmp

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

5 years ago[InstCombine] simplify fcmp+select canonicalization; NFCI
Sanjay Patel [Thu, 31 Oct 2019 17:10:34 +0000 (13:10 -0400)]
[InstCombine] simplify fcmp+select canonicalization; NFCI

We had 2 blocks of code that are nearly identical. Existing
regression tests should cover both of the patterns.

5 years agoReapply "Import Dexter to debuginfo-tests""
Jeremy Morse [Thu, 31 Oct 2019 16:51:53 +0000 (16:51 +0000)]
Reapply "Import Dexter to debuginfo-tests""

This reverts commit cb935f345683194e42e6e883d79c5a16479acd74.

Discussion in D68708 advises that green dragon is being briskly
refurbished, and it's good to have this patch up testing it.

5 years ago[lldb] [test/API] Fix testcases symlink
Michał Górny [Thu, 31 Oct 2019 16:43:18 +0000 (17:43 +0100)]
[lldb] [test/API] Fix testcases symlink

5 years agoUpstream diff from swift-lldb.
Adrian Prantl [Thu, 31 Oct 2019 16:19:55 +0000 (09:19 -0700)]
Upstream diff from swift-lldb.

This is very likely untested, but it looks like an obviously correct change.

5 years agoRevert "Import Dexter to debuginfo-tests"
Jeremy Morse [Thu, 31 Oct 2019 16:22:10 +0000 (16:22 +0000)]
Revert "Import Dexter to debuginfo-tests"

This reverts commit f78c236efda85af1e526ac35ed535ef4786450e3.

Green dragon breakage was observed; I'll take a look at why.

5 years agoFix missing memcpy, memmove and memset tail calls
Sanne Wouda [Thu, 31 Oct 2019 14:55:57 +0000 (14:55 +0000)]
Fix missing memcpy, memmove and memset tail calls

Summary:
If a wrapper around one of the mem* stdlib functions bitcasts the returned
pointer value before returning it (e.g. to a wchar_t*), LLVM does not emit a
tail call.

Add a check for this scenario so that we emit a tail call.

Reviewers: wmi, mkuper, ramred01, dmgreen

Reviewed By: wmi, dmgreen

Subscribers: hiraditya, sanwou01, javed.absar, lebedev.ri, llvm-commits

Tags: #llvm

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

5 years ago[llvm-objcopy] --add-symbol: address post-commit reviews of D69093
Fangrui Song [Thu, 31 Oct 2019 16:12:06 +0000 (09:12 -0700)]
[llvm-objcopy] --add-symbol: address post-commit reviews of D69093

* Improve comments.
* Reorder the assignment to Obj.SectionNames before the symbol table
  creation code. Add a test.

Reviewed By: grimar

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

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Thu, 31 Oct 2019 14:35:58 +0000 (10:35 -0400)]
[InstCombine] regenerate test checks; NFC

5 years ago[clang-format] Fix SpacesInSquareBrackets for Lambdas with Initial "&ref" Parameter
Mitchell Balan [Thu, 31 Oct 2019 15:07:36 +0000 (11:07 -0400)]
[clang-format] Fix SpacesInSquareBrackets for Lambdas with Initial "&ref" Parameter

Summary:
This fixes an edge case in the `SpacesInSquareBrackets` option where an initial `&ref` lambda parameter is not padded with an initial space.

`int foo = [&bar ]() {}` is fixed to give `int foo = [ &bar ]() {}`

Reviewers: MyDeveloperDay, klimek, sammccall

Reviewed by: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

5 years agoDAG: Add new control for ISD::FMAD formation
Matt Arsenault [Mon, 28 Oct 2019 18:00:12 +0000 (11:00 -0700)]
DAG: Add new control for ISD::FMAD formation

For AMDGPU this depends on whether denormals are enabled in the
default FP mode for the function. Currently this is treated as a
subtarget feature, so FMAD is selectively legal based on that. I want
to move this out of the subtarget features so this can be controlled
with a denormal mode attribute. Additionally, this will allow folding
based on a future ftz fast math flag.

5 years agoAMDGPU: Simplify getAddressSpace calls
Matt Arsenault [Thu, 31 Oct 2019 05:42:45 +0000 (22:42 -0700)]
AMDGPU: Simplify getAddressSpace calls

These can be directly taken from the GlobalValue instead of going
through the type.

5 years ago[TII] Use optional destination and source pair as a return value; NFC
Djordje Todorovic [Thu, 31 Oct 2019 13:48:32 +0000 (14:48 +0100)]
[TII] Use optional destination and source pair as a return value; NFC

Refactor usage of isCopyInstrImpl, isCopyInstr and isAddImmediate methods
to return optional machine operand pair of destination and source
registers.

Patch by Nikola Prica

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

5 years ago[MachineOutliner][NFC] Fix FileCheck regex in two of test-cases
David Tellenbach [Thu, 31 Oct 2019 14:19:15 +0000 (14:19 +0000)]
[MachineOutliner][NFC] Fix FileCheck regex in two of test-cases

5 years agoImport Dexter to debuginfo-tests
Jeremy Morse [Thu, 31 Oct 2019 13:41:24 +0000 (13:41 +0000)]
Import Dexter to debuginfo-tests

Dexter (Debug Experience Tester) is a test-driver for our debug info
integration tests, reading a set of debug experience expectations and
comparing them with the actual behaviour of a program under a debugger.
More about Dexter can be found in the RFC:

  http://lists.llvm.org/pipermail/llvm-dev/2019-October/135773.html

and the phab review in D68708. Not all the debuginfo tests have been
transformed into Dexter tests, and we look forwards to doing that
incrementally.

This commit mostly aims to flush out buildbots that are running
debuginfo-tests but don't have python 3 installed, possibly
green-dragon and some windows bots.

5 years ago[test][DebugInfo] Add the test for ARM call site parameters
Djordje Todorovic [Thu, 31 Oct 2019 12:52:26 +0000 (13:52 +0100)]
[test][DebugInfo] Add the test for ARM call site parameters

This is addition to D67556.

Patch by Nikola Prica

5 years agogn build: (manually) merge cd24a00 more
Nico Weber [Thu, 31 Oct 2019 13:12:53 +0000 (09:12 -0400)]
gn build: (manually) merge cd24a00 more

5 years ago[InstCombine] Canonicalize uadd.with.overflow to uadd.sat
David Green [Thu, 31 Oct 2019 12:42:36 +0000 (12:42 +0000)]
[InstCombine] Canonicalize uadd.with.overflow to uadd.sat

This adds some patterns to transform uadd.with.overflow to uadd.sat
(with usub.with.overflow to usub.sat too). The patterns selects from
UINTMAX (or 0 for subs) depending on whether the operation overflowed.

Signed patterns are a little more involved (they can wrap in two
directions), but can be added here in a followup patch too.

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

5 years agoRevert "[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions"
Jeremy Morse [Thu, 31 Oct 2019 12:34:17 +0000 (12:34 +0000)]
Revert "[DebugInfo] MachineSink: Insert undef DBG_VALUEs when sinking instructions"

This reverts commit ee50590e1684c197bc4336984795e48bf53c7a4e.

PR43855 reports a performance regression from this commit, which I'll
look into.

5 years agoRevert "[DebugInfo] MachineSink: find more DBG_VALUEs to sink"
Jeremy Morse [Thu, 31 Oct 2019 12:33:18 +0000 (12:33 +0000)]
Revert "[DebugInfo] MachineSink: find more DBG_VALUEs to sink"

This reverts commit f5e1b718a675a4449b71423f04d38e1e93045105.

PR43855 reports a performance regression with commit ee50590e. This commit
depends on the faulty one, so has to come out too.

5 years ago[clangd] Fix namespace aliases in findExplicitReferences
Ilya Biryukov [Thu, 31 Oct 2019 10:58:57 +0000 (11:58 +0100)]
[clangd] Fix namespace aliases in findExplicitReferences

Reviewers: kadircet

Reviewed By: kadircet

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

Tags: #clang

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

5 years ago[clangd] Add fno-delayed-parsing to new define inline tests
Kadir Cetinkaya [Thu, 31 Oct 2019 12:22:20 +0000 (13:22 +0100)]
[clangd] Add fno-delayed-parsing to new define inline tests

To unbreak windows buildbots.

5 years ago[PatternMatch] Add m_WithOverflowInst and m_ExtractValue matchers
David Green [Thu, 31 Oct 2019 11:47:47 +0000 (11:47 +0000)]
[PatternMatch] Add m_WithOverflowInst and m_ExtractValue matchers

Used in D69245, these add pattern matchers for the WithOverflowInst
(capturing the result) and the ExtractValue instructions taking a
template parameter specifying the element being extracted.

5 years ago[llvm-objcopy] Preserve .ARM.attributes section when stripping files
James Henderson [Thu, 31 Oct 2019 11:53:33 +0000 (11:53 +0000)]
[llvm-objcopy] Preserve .ARM.attributes section when stripping files

This works around a bug in Debian's patchset for glibc. The bug is
described in detail in the upstream debian bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943798, but the short
version of it is that glibc on any Debian based distro don't load
libraries unless it has a .ARM.attribute section.

Reviewed by: jhenderson, rupprecht, MaskRay, jakehehrlich

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

Patch by Tobias Hieta.

5 years agocomment typo fix to cycle bots
Nico Weber [Thu, 31 Oct 2019 11:54:16 +0000 (07:54 -0400)]
comment typo fix to cycle bots

5 years agoBuild fix after 4b6597f
Nico Weber [Thu, 31 Oct 2019 11:42:54 +0000 (07:42 -0400)]
Build fix after 4b6597f

5 years ago[clang][analyzer] Using CallDescription in StreamChecker.
Balázs Kéri [Thu, 31 Oct 2019 11:09:44 +0000 (12:09 +0100)]
[clang][analyzer] Using CallDescription in StreamChecker.

Summary:
Recognization of function names is done now with the CallDescription
class instead of using IdentifierInfo. This means function name and
argument count is compared too.
A new check for filtering not global-C-functions was added.
Test was updated.

Reviewers: Szelethus, NoQ, baloghadamsoftware, Charusso

Reviewed By: Szelethus, NoQ, Charusso

Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

5 years agogn build: (manually) merge b32bae6f760
Nico Weber [Thu, 31 Oct 2019 11:35:54 +0000 (07:35 -0400)]
gn build: (manually) merge b32bae6f760

5 years agoMake flang driver stuff work on macOS
Nico Weber [Wed, 30 Oct 2019 19:54:09 +0000 (15:54 -0400)]
Make flang driver stuff work on macOS

6bf55804 added special-case code for TY_PP_Fortran to
ToolChain::LookupTypeForExtension(), but
Darwin::LookupTypeForExtension() overrode that method without calling
the superclass implementation.

Make it call the superclass implementation to fix things.

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

5 years ago[X86][SSE] Convert computeZeroableShuffleElements to emit KnownUndef and KnownZero
Simon Pilgrim [Thu, 31 Oct 2019 11:21:39 +0000 (11:21 +0000)]
[X86][SSE] Convert computeZeroableShuffleElements to emit KnownUndef and KnownZero

5 years ago[LICM] Invalidate SCEV upon instruction hoisting
Serguei Katkov [Thu, 31 Oct 2019 10:18:29 +0000 (17:18 +0700)]
[LICM] Invalidate SCEV upon instruction hoisting

Since SCEV can cache information about location of an instruction, it should be invalidated when the instruction is moved.
There should be similar bug in code sinking part of LICM, it will be fixed in a follow-up change.

Patch Author: Daniil Suchkov
Reviewers: asbirlea, mkazantsev, reames
Reviewed By: asbirlea
Subscribers: hiraditya, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D69370

5 years agominidump: Create memory regions from the sections of loaded modules
Pavel Labath [Wed, 16 Oct 2019 08:38:10 +0000 (10:38 +0200)]
minidump: Create memory regions from the sections of loaded modules

Summary:
Not all minidumps contain information about memory permissions. However,
it is still important to know which regions of memory contain
potentially executable code. This is particularly important for
unwinding on win32, as the default unwind method there relies on
scanning the stack for things which "look like" code pointers.

This patch enables ProcessMinidump to reconstruct the likely permissions
of memory regions using the sections of loaded object files. It only
does this if we don't have a better source (memory info list stream, or
linux /proc/maps) for this information, and only if the information in
the object files does not conflict with the information in the minidump.

Theoretically that last bit could be improved, since the permissions
obtained from the MemoryList streams is also only a very rough guess,
but it did not seem worthwhile to complicate the implementation because
of that because there will generally be no overlap in practice as the
MemoryList will contain the stack contents and not any module data.

The patch adds a test checking that the module section permissions are
entered into the memory region list, and also a test which demonstrate
that now the unwinder is able to correctly find return addresses even in
minidumps without memory info list streams.

There's one TODO left in this patch, which is that the "memory region"
output does not give any indication about the "don't know" values of
memory region permissions (it just prints them as if they permission bit
was set). I address this in a follow up.

Reviewers: amccarth, clayborg

Subscribers: mgrang, lldb-commits

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

5 years agominidump: Add an "arm64" constant
Pavel Labath [Thu, 31 Oct 2019 10:05:47 +0000 (11:05 +0100)]
minidump: Add an "arm64" constant

This is the "official" constant for arm64. We also have another constant
for arm64 (called BP_ARM64), which was used by breakpad while there was
no official constant for arm64 available.

5 years ago[Test] Add a unit test exposing lack of SCEV invalidation in LICM during code hoistin...
Serguei Katkov [Thu, 31 Oct 2019 10:05:57 +0000 (17:05 +0700)]
[Test] Add a unit test exposing lack of SCEV invalidation in LICM during code hoisting. NFC.

This unit test exposes a bug in LICM: when it hoists instructions it doesn't invalidate SCEV accordingly.
Similar test exposing lack of SCEV invalidation during code sinking will be submitted as a follow-up change.

Patch Author: Daniil Suchkov
Reviewers: mkazantsev, asbirlea, reames
Reviewed By: asbirlea
Subscribers: mgorny, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D69369

5 years ago[lldb] Fix offset intersection bug between MPX and AVX registers
Guilherme Andrade [Thu, 31 Oct 2019 09:46:58 +0000 (10:46 +0100)]
[lldb] Fix offset intersection bug between MPX and AVX registers

Summary:
This change increases the offset of MPX registers (by 128) so they
do not overlap with the offset associated with AVX registers. That was
causing MPX data in GDBRemoteRegisterContext::m_reg_data to get overwritten.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

5 years ago[cfi] Add flag to always generate .debug_frame
David Candler [Thu, 31 Oct 2019 08:55:57 +0000 (08:55 +0000)]
[cfi] Add flag to always generate .debug_frame

This adds a flag to LLVM and clang to always generate a .debug_frame
section, even if other debug information is not being generated. In
situations where .eh_frame would normally be emitted, both .debug_frame
and .eh_frame will be used.

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

5 years ago[lldb/lit] Introduce %clang_host substitutions
Pavel Labath [Wed, 30 Oct 2019 14:57:16 +0000 (15:57 +0100)]
[lldb/lit] Introduce %clang_host substitutions

Summary:
This patch addresses an ambiguity in how our existing tests invoke the
compiler. Roughly two thirds of our current "shell" tests invoke the
compiler to build the executables for the host. However, there is also
a significant number of tests which don't build a host binary (because
they don't need to run it) and instead they hardcode a certain target.

We also have code which adds a bunch of default arguments to the %clang
substitutions. However, most of these arguments only really make sense
for the host compilation. So far, this has worked mostly ok, because the
arguments we were adding were not conflicting with the target-hardcoding
tests (though they did provoke an occasional "argument unused" warning).

However, this started to break down when we wanted to use
target-hardcoding clang-cl tests (D69031) because clang-cl has a
substantially different command line, and it was getting very confused
by some of the arguments we were adding on non-windows hosts.

This patch avoid this problem by creating separate %clang(xx,_cl)_host
substutitions, which are specifically meant to be used for compiling
host binaries. All funny host-specific options are moved there. To
ensure that the regular %clang substitutions are not used for compiling
host binaries (skipping the extra arguments) I employ a little
hac^H^H^Htrick -- I add an invalid --target argument to the %clang
substitution, which means that one has to use an explicit --target in
order for the compilation to succeed.

Reviewers: JDevlieghere, aprantl, mstorsjo, espindola

Subscribers: emaste, arichardson, MaskRay, jfb, lldb-commits

Tags: #lldb

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

5 years ago[yaml2obj/obj2yaml] - Add support for SHT_GNU_HASH section.
georgerim [Thu, 24 Oct 2019 12:38:53 +0000 (15:38 +0300)]
[yaml2obj/obj2yaml] - Add support for SHT_GNU_HASH section.

This adds parsing and dumping support for GNU hash sections.
They are described nicely here: https://blogs.oracle.com/solaris/gnu-hash-elf-sections-v2

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

5 years ago[LLDB] [Windows] Fix Windows-specific race condition in LLDB for session lifetime
Martin Storsjö [Mon, 28 Oct 2019 08:28:26 +0000 (10:28 +0200)]
[LLDB] [Windows] Fix Windows-specific race condition in LLDB for session lifetime

This can e.g. happen if the debugged executable exits before the initial
stop, e.g. if it fails to load dependent DLLs.

Add a virtual destructor to ProcessDebugger and let it clean up the
session, and make ProcessWindows::OnExitProcess call
ProcessDebugger::OnExitProcess for shared parts.

Fix suggestion by Adrian McCarthy.

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

5 years ago[LLDB] [PECOFF] Fix error handling for executables that object::createBinary errors...
Martin Storsjö [Wed, 30 Oct 2019 21:57:40 +0000 (23:57 +0200)]
[LLDB] [PECOFF] Fix error handling for executables that object::createBinary errors out on

llvm::object::createBinary returns an Expected<>, which requires
not only checking the object for success, but also requires consuming
the Error, if one was set.

Use LLDB_LOG_ERROR for this case, and change an existing similar log
statement to use it as well, to make sure the Error is consumed even
if the log channel is disabled.

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

5 years ago[LLDB] [Windows] Remove a TODO which probably won't be implemented
Martin Storsjö [Thu, 31 Oct 2019 07:46:56 +0000 (09:46 +0200)]
[LLDB] [Windows] Remove a TODO which probably won't be implemented

Contrary to WoW64 on x86_64, there's no struct similar to WOW64_CONTEXT
defined, for storing and handling the CPU state of an ARM32 process
from an ARM64 process. Thus, making an ARM64 lldb-server able to
control ARM32 processes seems infeasible at the moment.

(The normal CONTEXT struct has a different layout on each architecture.
In addition to this, a WOW64_CONTEXT struct always is defined, that
can store the CPU state of an x86_32 process, to allow handling it from
an x86_64 process. But there's no similar universally available struct
for ARM32.)

5 years ago[LLDB] [PECOFF] Don't crash in ReadImageDataByRVA for addresses out of range
Martin Storsjö [Mon, 28 Oct 2019 08:09:52 +0000 (10:09 +0200)]
[LLDB] [PECOFF] Don't crash in ReadImageDataByRVA for addresses out of range

This can happen e.g. when unwinding doesn't work perfectly.

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

5 years agoRevert "[SLP] Vectorize jumbled stores."
Haojian Wu [Thu, 31 Oct 2019 09:21:24 +0000 (10:21 +0100)]
Revert "[SLP] Vectorize jumbled stores."

This reverts commit 21d498c9c0f32dcab5bc89ac593aa813b533b43a.

This commit causes some crashes on some targets.

5 years ago[llvm-readelf/llvm-readobj] - Improve dumping of broken versioning sections.
Georgii Rymar [Mon, 28 Oct 2019 10:09:38 +0000 (13:09 +0300)]
[llvm-readelf/llvm-readobj] - Improve dumping of broken versioning sections.

This updates the elf-invalid-versioning.test test case:
makes a cleanup, adds llvm-readobj calls and fixes 2
crash/assert issues I've found (test cases are provided).

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

5 years ago[Diagnostics] Warn for std::is_constant_evaluated in constexpr mode
Dávid Bolvanský [Tue, 29 Oct 2019 18:06:48 +0000 (19:06 +0100)]
[Diagnostics] Warn for std::is_constant_evaluated in constexpr mode

Summary:
constexpr int fn1() {
  if constexpr (std::is_constant_evaluated()) // condition is always true!
    return 0;
  else
    return 1;
}

constexpr int fn2() {
  if (std::is_constant_evaluated())
    return 0;
  else
    return 1;
}

Solves PR42977

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

5 years ago[MustExecute] Silence clang warning about unused captured 'this'
Mikael Holmen [Thu, 31 Oct 2019 08:40:29 +0000 (09:40 +0100)]
[MustExecute] Silence clang warning about unused captured 'this'

New code introduced in fe799c97fa caused clang to complain with

../lib/Analysis/MustExecute.cpp:360:34: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
  GetterTy<LoopInfo> LIGetter = [this](const Function &F) {
                                 ^~~~
../lib/Analysis/MustExecute.cpp:365:44: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
  GetterTy<PostDominatorTree> PDTGetter = [this](const Function &F) {
                                           ^~~~
2 errors generated.

5 years ago[clangd] Add parameter renaming to define-inline code action
Kadir Cetinkaya [Mon, 14 Oct 2019 10:02:24 +0000 (12:02 +0200)]
[clangd] Add parameter renaming to define-inline code action

Summary:
When moving a function definition to declaration location we also need
to handle renaming of the both function and template parameters.

This patch achives that by making sure every parameter name and dependent type
in destination is renamed to their respective name in the source.

Reviewers: ilya-biryukov

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

Tags: #clang

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

5 years ago[libunwind] [Windows] Add a log message if EnumProcessModules fails
Martin Storsjö [Mon, 28 Oct 2019 08:11:05 +0000 (10:11 +0200)]
[libunwind] [Windows] Add a log message if EnumProcessModules fails

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

5 years ago[Attributor][NFCI] Improve the usage of IntegerStates
Johannes Doerfert [Wed, 30 Oct 2019 04:18:49 +0000 (23:18 -0500)]
[Attributor][NFCI] Improve the usage of IntegerStates

Setting the upper bound directly in the state can be beneficial and
simplifies the logic. This also exposed more copy&paste type errors.

5 years ago[Attributor][FIX] Unbreak buildbot through test correction
Johannes Doerfert [Thu, 31 Oct 2019 06:04:35 +0000 (01:04 -0500)]
[Attributor][FIX] Unbreak buildbot through test correction

5 years ago[Attributor] Make liveness "edge-based"
Johannes Doerfert [Tue, 29 Oct 2019 16:47:47 +0000 (11:47 -0500)]
[Attributor] Make liveness "edge-based"

Summary:
If control is transferred to a successor is the key question when it
comes to liveness. The new implementation puts that question in the
focus and thereby providing a clean way to assume certain CFG edges are
dead or instructions will not transfer control.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

5 years ago[llvm-objcopy][MachO] Implement --strip-all
Seiya Nuta [Thu, 31 Oct 2019 04:51:11 +0000 (13:51 +0900)]
[llvm-objcopy][MachO] Implement --strip-all

Reviewers: alexshap, rupprecht, jdoerfert, jhenderson

Reviewed By: alexshap

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

5 years ago[Attributor] Liveness for values
Johannes Doerfert [Sun, 13 Oct 2019 08:08:18 +0000 (03:08 -0500)]
[Attributor] Liveness for values

Summary:
This patch introduces liveness (AAIsDead) for all positions, thus for
all kinds of values. For now, we say an instruction is dead if it would
be removed assuming all users are dead. A call site return is different
as we just look at the users. If all call site returns have been
eliminated, the return values can return undef instead of their original
value, eliminating uses.

We try to recursively delete dead instructions now and we introduce a
simple check interface for use-traversal.

This is the idea tried out in D68626 but implemented in the right way.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

5 years ago[Attributor][NFC] Do not delete dead blocks but "clear" them
Johannes Doerfert [Wed, 30 Oct 2019 22:34:59 +0000 (17:34 -0500)]
[Attributor][NFC] Do not delete dead blocks but "clear" them

Deleting blocks will require us to deal with dead edges, e.g.,
  `br i1 false, label %live, label %dead`
explicitly. For now we just clear the blocks and move on.
This will be revisited once we actually fold branches.

5 years ago[MustExecute] Forward iterate over conditional branches
Johannes Doerfert [Sun, 13 Oct 2019 01:46:49 +0000 (20:46 -0500)]
[MustExecute] Forward iterate over conditional branches

Summary:
If a conditional branch is encountered we can try to find a join block
where the execution is known to continue. This means finding a suitable
block, e.g., the immediate post dominator of the conditional branch, and
proofing control will always reach that block.

This patch implements different techniques that work with and without
provided analysis.

Reviewers: uenoku, sstefan1, hfinkel

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

5 years agocomment typo fix to cycle bots
Nico Weber [Thu, 31 Oct 2019 02:17:52 +0000 (22:17 -0400)]
comment typo fix to cycle bots

5 years ago[libomptarget] Change nvcc compilation to use a unity build
Jon Chesterfield [Thu, 31 Oct 2019 01:58:29 +0000 (01:58 +0000)]
[libomptarget] Change nvcc compilation to use a unity build

Summary:
[libomptarget] Change nvcc compilation to use a unity build

This allows nvcc to inline functions between what would otherwise be distinct
translation units, which in turn removes any runtime cost from implementing
functions in source files (as opposed to inline in headers).

This will then allow the circular dependencies in deviceRTL to be readily
broken and individual components more easily shared between architectures.

Reviewers: ABataev, jdoerfert, grokos, RaviNarayanaswamy, hfinkel, ronlieb, gregrodgers

Reviewed By: jdoerfert

Subscribers: mgorny, openmp-commits

Tags: #openmp

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

5 years ago[Attributor] Add "free"-based heap2stack deduction
Johannes Doerfert [Mon, 14 Oct 2019 22:29:05 +0000 (17:29 -0500)]
[Attributor] Add "free"-based heap2stack deduction

Summary:
If there is a unique free of the allocated that has to be reached from
the malloc, we can apply the heap-2-stack transformation even if the
pointer escapes.

Reviewers: hfinkel, sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

5 years ago[AArch64][SVE] Add patterns for some integer vector instructions
Ehsan Amiri [Wed, 30 Oct 2019 17:00:52 +0000 (13:00 -0400)]
[AArch64][SVE] Add patterns for some integer vector instructions

Add pattern matching for SVE vector instructions:

-- add, sub, and, or, xor instructions
-- sqadd, uqadd, sqsub, uqsub target-independent intrinsics
-- bic intrinsics
-- predicated add, sub, subr intrinsics

Patch Review: https://reviews.llvm.org/D69128
Patch authored by: dancgr (Danilo Carvalho Grael)

5 years ago[Attributor][NFC] Eagerly mark attributes as fixed.
Johannes Doerfert [Mon, 14 Oct 2019 02:10:31 +0000 (21:10 -0500)]
[Attributor][NFC] Eagerly mark attributes as fixed.

If an attribute did not query any optimistic (=non-fixed) information to
justify its state, we know the attribute state will not change anymore.
Thus, we can indicate an optimistic fixpoint.

5 years ago[Attributor][NFC] Do not record dependences on fixed attributes
Johannes Doerfert [Mon, 14 Oct 2019 01:25:25 +0000 (20:25 -0500)]
[Attributor][NFC] Do not record dependences on fixed attributes

Since fixed values cannot change, we do not need to wait for it to
happen, we will never notify the dependent attribute anyway.

5 years ago[Attributor][NFC] Simplify the IRPosition interface
Johannes Doerfert [Mon, 21 Oct 2019 03:46:48 +0000 (22:46 -0500)]
[Attributor][NFC] Simplify the IRPosition interface

We pretended IRPosition came either as mutable or immutable objects
while they are basically always immutable, with a single (existing)
unfortunate exceptions. This patch cleans up the uses to deal with the
immutable version.

5 years ago[Attributor] Automatically deal with undef values for IRAttributes
Johannes Doerfert [Wed, 30 Oct 2019 22:33:33 +0000 (17:33 -0500)]
[Attributor] Automatically deal with undef values for IRAttributes

For (almost) all IRAttribute we can derive whatever we want for undef
values so it makes sense to provide this functionality in the base
class. At the same time, we probably do not want to annotate them.

5 years ago[Utils] Allow update_test_checks to check function information
Johannes Doerfert [Thu, 10 Oct 2019 17:08:21 +0000 (12:08 -0500)]
[Utils] Allow update_test_checks to check function information

Summary:
This adds a switch to the update_test_checks that triggers arguments and
other function annotations, e.g., personality, to be present in the
check line. If not set, the behavior should be the same as before.
If arguments are recorded, their names are scrubbed from the IR to allow
merging.

This patch includes D68153.

Reviewers: lebedev.ri, greened, spatel, xbolva00, RKSimon, mehdi_amini

Subscribers: bollu, llvm-commits

Tags: #llvm

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

5 years ago[GISel][CombinerHelper] Combine shuffle_vector scalar to build_vector
Quentin Colombet [Thu, 31 Oct 2019 00:16:55 +0000 (17:16 -0700)]
[GISel][CombinerHelper] Combine shuffle_vector scalar to build_vector

Teach the combiner helper how to replace shuffle_vector of scalars
into build_vector.
I am not particularly happy about having to add this combine, but we
currently get those from <1 x iN> from the IR.

Bonus: This fixes an assert in the shuffle_vector combines since before
this patch, we were expecting vector types.

5 years ago[clang-tidy] Regenerate clang-tidy check list 📋
Stephane Moore [Tue, 29 Oct 2019 02:53:58 +0000 (19:53 -0700)]
[clang-tidy] Regenerate clang-tidy check list 📋

Summary:
These changes were generated by invoking
clang-tools-extra/clang-tidy/add_new_check.py and then reverting the
check that was added.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

5 years agoRun clang-format on lib/CodeGen/CGCall.h and fix indentation
Akira Hatanaka [Thu, 31 Oct 2019 00:51:45 +0000 (17:51 -0700)]
Run clang-format on lib/CodeGen/CGCall.h and fix indentation

5 years agoOnly ask once if we have no commands. NFC.
Jim Ingham [Thu, 31 Oct 2019 01:02:50 +0000 (18:02 -0700)]
Only ask once if we have no commands.  NFC.

5 years ago[ThinLTO/WPD] Fix index-based WPD for available_externally vtables
Teresa Johnson [Fri, 25 Oct 2019 21:56:12 +0000 (14:56 -0700)]
[ThinLTO/WPD] Fix index-based WPD for available_externally vtables

Summary:
Clang does not add type metadata to available_externally vtables. When
choosing a summary to look at for virtual function definitions, make
sure we skip summaries for any available externally vtables as they will
not describe any virtual function functions, which are only summarized
in the presence of type metadata on the vtable def. Simply look for the
corresponding strong def's summary.

Also add handling for same-named local vtables with the same GUID
because of same-named files without enough distinguishing path.
In that case we return a conservative result with no devirtualization.

Reviewers: pcc, davidxl, evgeny777

Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

5 years ago[JITLink] Move block ownership from LinkGraph to Section.
Lang Hames [Wed, 30 Oct 2019 21:54:54 +0000 (14:54 -0700)]
[JITLink] Move block ownership from LinkGraph to Section.

This enables easy iteration over blocks in a specific section.

5 years agoRevert "[CodeView] Add option to disable inline line tables."
Amy Huang [Thu, 31 Oct 2019 00:31:12 +0000 (17:31 -0700)]
Revert "[CodeView] Add option to disable inline line tables."
because it breaks compiler-rt tests.

This reverts commit 6d03890384517919a3ba7fe4c35535425f278f89.

5 years ago[CodeView] Add option to disable inline line tables.
Amy Huang [Mon, 16 Sep 2019 22:46:49 +0000 (15:46 -0700)]
[CodeView] Add option to disable inline line tables.

Summary:
This adds a clang option to disable inline line tables. When it is used,
the inliner uses the call site as the location of the inlined function instead of
marking it as an inline location with the function location.

See https://bugs.llvm.org/show_bug.cgi?id=42344

Reviewers: rnk

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

5 years ago[lit] Add missing import
Reid Kleckner [Wed, 30 Oct 2019 23:32:26 +0000 (16:32 -0700)]
[lit] Add missing import

Apparently llvm-lit.py does not execute this path

5 years agoRevert "[Builtins] Downgrade duplicate source file warning from a fatal error to...
Dan Liew [Wed, 30 Oct 2019 23:21:46 +0000 (16:21 -0700)]
Revert "[Builtins] Downgrade duplicate source file warning from a fatal error to a warning."

This reverts commit dc748816e2aec8941d63f8ad07fb82aff6be8af7.

Now that 8ea148dc0cbff33ac3c80cf4273991465479a01e has landed it should
be safe to turning the warning back into a fatal error.

5 years ago[Builtins] Fix bug where powerpc builtins specializations didn't remove generic imple...
Dan Liew [Fri, 18 Oct 2019 18:09:19 +0000 (11:09 -0700)]
[Builtins] Fix bug where powerpc builtins specializations didn't remove generic implementations.

Summary:
Previously the CMake code looked for filepaths of the form
`<arch>/<filename>` as an indication that `<arch>/<filename>` provided a
specialization of a top-level file `<filename>`. For powerpc there was a
bug because the powerpc specialized implementations lived in `ppc/` but
the architectures were `powerpc64` and `powerpc64le` which meant that
CMake was looking for files at `powerpc64/<filename>` and
`powerpc64le/<filename>`.

The result of this is that for powerpc the builtins library contained a
duplicate symbol for `divtc3` because it had the generic implementation
and the specialized version in the built static library.

Although we could just add similar code to what there is for arm (i.e.
compute `${_arch}`) to fix this, this is extremely error prone (until
r375150 no error was raised). Instead this patch takes a different
approach that removes looking for the architecture name entirely.
Instead this patch uses the convention that a source file in a
sub-directory might be a specialization of a generic implementation and
if a source file of the same name (ignoring extension) exists at the
top-level then it is the corresponding generic implementation. This
approach is much simpler because it doesn't require keeping track of
different architecture names.

This convention already existed in repository but previously it was
implicit.  This change makes it explicit.

This patch is motivated by wanting to revert r375162 which worked around
the powerpc bug found when r375150 landed.

Once it lands we should revert r375162.

Reviewers: phosek, beanz, compnerd, shiva0217, amyk, rupprecht, kongyi, mstorsjo, t.p.northover, weimingz, jroelofs, joerg, sidneym

Subscribers: nemanjai, mgorny, kristof.beyls, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

5 years ago[InstCombine] keep assumption before sinking calls
tyker [Wed, 30 Oct 2019 23:11:18 +0000 (00:11 +0100)]
[InstCombine] keep assumption before sinking calls

Summary:
in the following C code the branch is not removed by clang in O3.
```
int f1(char* p) {
    int i1 = __builtin_strlen(p);
    if (!p)
        return -1;
    return i1;
}
```
The issue is that the call to strlen is sunk to the following block by instcombine. In its new place the call to strlen doesn't dominate the use in the icmp anymore so value tracking can't see that p cannot be null.
This patch resolves the issue by inserting an assumption at the place of the call before sinking a call when that call can be used to prove an argument to be nonnull.
This resolves this issue at O3.

Reviewers: majnemer, xbolva00, fhahn, jdoerfert, spatel, efriedma

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

5 years ago[lit] Silence warning about importing the resource module on Windows
Reid Kleckner [Wed, 30 Oct 2019 23:10:24 +0000 (16:10 -0700)]
[lit] Silence warning about importing the resource module on Windows

lit was printing this warning on every test run on Windows, and that is
not necessary.

5 years agoRun clang-format on lldb/source/Commands (NFC)
Adrian Prantl [Wed, 30 Oct 2019 22:26:19 +0000 (15:26 -0700)]
Run clang-format on lldb/source/Commands (NFC)

These files had a lot of whitespace errors in them which was a
constant source of merge conflicts downstream.

5 years ago[clang][ScanDeps] Fix shadowing warning.
Michael Spencer [Wed, 30 Oct 2019 22:53:25 +0000 (15:53 -0700)]
[clang][ScanDeps] Fix shadowing warning.

5 years ago[libc++] Add test and remove workaround for PR13592
Louis Dionne [Wed, 30 Oct 2019 22:49:04 +0000 (15:49 -0700)]
[libc++] Add test and remove workaround for PR13592

PR13592 was caused by a problem in how to compiler implemented the
__is_convertible_to intrinsic. That problem, reported as PR13591,
was fixed back in 2012. We don't support such old versions of Clang
anyway, so we don't need the library workaround that had been added
to solve PR13592 (while waiting for the compiler fix).

5 years agoDisable new clang-scan-deps test on Windows due to backslash path matching problems
Reid Kleckner [Wed, 30 Oct 2019 22:51:34 +0000 (15:51 -0700)]
Disable new clang-scan-deps test on Windows due to backslash path matching problems

5 years agogn build: Merge 33a745e6fe7
LLVM GN Syncbot [Wed, 30 Oct 2019 22:28:00 +0000 (22:28 +0000)]
gn build: Merge 33a745e6fe7

5 years ago[clang][clang-scan-deps] Add support for extracting full module dependencies.
Michael Spencer [Wed, 16 Oct 2019 19:28:35 +0000 (12:28 -0700)]
[clang][clang-scan-deps] Add support for extracting full module dependencies.

This is a recommit of d8a4ef0e685c with the nondeterminism fixed.

This adds experimental support for extracting a Clang module dependency graph
from a compilation database. The output format is experimental and will change.
It is currently a concatenation of JSON outputs for each compilation. Future
patches will change this to deduplicate modules between compilations.

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

5 years agoFix -Wsign-compare warning with clang-cl
Reid Kleckner [Wed, 30 Oct 2019 22:18:21 +0000 (15:18 -0700)]
Fix -Wsign-compare warning with clang-cl

off_t apparently is just "long" on Win64, which is 32-bits, and
therefore not long enough to compare with UINT32_MAX. Use auto to follow
the surrounding code. uint64_t would also be fine.

5 years agoRevert "[clang][clang-scan-deps] Add support for extracting full module dependencies."
Michael Spencer [Wed, 30 Oct 2019 22:15:39 +0000 (15:15 -0700)]
Revert "[clang][clang-scan-deps] Add support for extracting full module dependencies."

This reverts commit d8a4ef0e685cec1fc73d4953b48220b649d05b40.

This commit broke some of the bots. I believe it's due to nondeterminism. Will fix and recommit.

5 years ago[lit] Change progress bar color to red on first failure
Julian Lettner [Mon, 25 Feb 2019 06:38:44 +0000 (22:38 -0800)]
[lit] Change progress bar color to red on first failure

5 years ago[lit] Add helper for `test.result.code.isFailure`
Julian Lettner [Mon, 25 Feb 2019 05:59:55 +0000 (21:59 -0800)]
[lit] Add helper for `test.result.code.isFailure`

5 years ago[lit] Extract `_install_win32_signal_handler` function
Julian Lettner [Sat, 23 Feb 2019 06:33:48 +0000 (22:33 -0800)]
[lit] Extract `_install_win32_signal_handler` function

5 years ago[X86] Model MXCSR for all SSE instructions
Craig Topper [Wed, 30 Oct 2019 21:56:19 +0000 (14:56 -0700)]
[X86] Model MXCSR for all SSE instructions

This patch adds MXCSR as a reserved physical register and models its use
by X86 SSE instructions. It also adds flag "mayRaiseFPException" for the
instructions that possibly can raise FP exception according to the
architecture definition.

Following what SystemZ and other targets does, only the current rounding
modes and the IEEE exception masks are modeled. *Changes* of the MXCSR
due to exceptions are not modeled.

Patch by Pengfei Wang

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

5 years ago[MS] Don't reference deleted copy ctors from catchable types
Reid Kleckner [Wed, 30 Oct 2019 21:38:11 +0000 (14:38 -0700)]
[MS] Don't reference deleted copy ctors from catchable types

When throwing objects with deleted copy constructors, the copy ctor
field of the catchable type should remain null and the mangle name
changes. This already worked in simple cases, but in cases involving
non-trivial subobjects, sometimes LookupCopyingConstructor could return
a non-null but deleted constructor decl. Skip those and don't reference
them.

Fixes PR43680

5 years agoAMDGPU: Disallow spill folding with m0 copies
Matt Arsenault [Wed, 30 Oct 2019 19:56:24 +0000 (12:56 -0700)]
AMDGPU: Disallow spill folding with m0 copies

readlane and writelane instructions are not allowed to use m0 as the
data operand, so spilling them is tricky and would require an
intermediate SGPR to spill it. Constrain the virtual register class in
this caes to disallow the inline spiller from folding the m0 operand
directly into the spill instruction.

I copied this hack from AArch64 which has the same problem for $sp.

5 years ago[globalisel][docs] Add the tutorial to the Porting document
Daniel Sanders [Wed, 30 Oct 2019 21:52:57 +0000 (14:52 -0700)]
[globalisel][docs] Add the tutorial to the Porting document

In lieu of converting that tutorial to text, add a link to the porting
tutorial from the 2017 Dev Meeting to the porting page

5 years ago[clang][clang-scan-deps] Add support for extracting full module dependencies.
Michael Spencer [Wed, 16 Oct 2019 19:28:35 +0000 (12:28 -0700)]
[clang][clang-scan-deps] Add support for extracting full module dependencies.

This adds experimental support for extracting a Clang module dependency graph
from a compilation database. The output format is experimental and will change.
It is currently a concatenation of JSON outputs for each compilation. Future
patches will change this to deduplicate modules between compilations.

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

5 years agoAMDGPU: Don't fold S_NOPs with implicit operands
Matt Arsenault [Wed, 30 Oct 2019 19:39:55 +0000 (12:39 -0700)]
AMDGPU: Don't fold S_NOPs with implicit operands

5 years agoRegAllocFast: Use Register
Matt Arsenault [Wed, 30 Oct 2019 21:01:58 +0000 (14:01 -0700)]
RegAllocFast: Use Register

5 years ago[X86] Rewrite hasReassociableOperands and setSpecialOperandAttr to not hardcode numbe...
Craig Topper [Wed, 30 Oct 2019 19:48:19 +0000 (12:48 -0700)]
[X86] Rewrite hasReassociableOperands and setSpecialOperandAttr to not hardcode number of operands or position of the EFLAGS operand.

This makes the code immune to the MXCSR addition in D68121.

5 years ago[X86] Precommit new tests from D68757. NFC
Craig Topper [Wed, 30 Oct 2019 18:41:44 +0000 (11:41 -0700)]
[X86] Precommit new tests from D68757. NFC

5 years ago[ReleaseNotes] Add item on deleting the BasicBlockPass(Manager).
Alina Sbirlea [Wed, 30 Oct 2019 20:39:11 +0000 (13:39 -0700)]
[ReleaseNotes] Add item on deleting the BasicBlockPass(Manager).

5 years agoAdd a test file that was missed in 4de6b1586807285e20a5db6596519c2336a64568
Vladimir Plyashkun [Wed, 30 Oct 2019 20:54:45 +0000 (16:54 -0400)]
Add a test file that was missed in 4de6b1586807285e20a5db6596519c2336a64568

5 years agoAdd a test file that was missed in e477988309dbde214a6d16ec690a416882714aac
Daniel [Wed, 30 Oct 2019 20:51:31 +0000 (16:51 -0400)]
Add a test file that was missed in e477988309dbde214a6d16ec690a416882714aac