platform/upstream/llvm.git
4 years agoUpdate last-mod date for libcxx status page
marshall [Sun, 16 Feb 2020 17:55:50 +0000 (18:55 +0100)]
Update last-mod date for libcxx status page

4 years agoUpdated with list of papers and issues adopted in Prague
marshall [Sun, 16 Feb 2020 17:54:06 +0000 (18:54 +0100)]
Updated with list of papers and issues adopted in Prague

4 years ago[gn build] Port ee2c0f76d74
LLVM GN Syncbot [Sun, 16 Feb 2020 17:32:06 +0000 (17:32 +0000)]
[gn build] Port ee2c0f76d74

4 years ago[ms] [llvm-ml] Add a draft MASM parser
Eric Astor [Sun, 16 Feb 2020 17:29:51 +0000 (12:29 -0500)]
[ms] [llvm-ml] Add a draft MASM parser

Summary:
Many directives are unavailable, and support for others may be limited.

This first draft has preliminary support for:
    - conditional directives (including errors),
    - data allocation (unsigned types up to 8 bytes, and ALIGN),
    - equates/variables (numeric and text),
    - and procedure directives (without parameters),
as well as COMMENT, ECHO, INCLUDE, INCLUDELIB, PUBLIC, and EXTERN. Text variables (aka text macros) are expanded in-place wherever the identifier occurs.

We deliberately ignore all ml.exe processor directives.

Prominent features not yet supported:
    - structs
    - macros (both procedures and functions)
    - procedures (with specified parameters)
    - substitution & expansion operators

Conditional directives are complicated by the fact that "ifdef rax" is a valid way to check if a file is being assembled for a 64-bit x86 processor; we add support for "ifdef <register>" in general, which requires adding a tryParseRegister method to all MCTargetAsmParsers. (Some targets require backtracking in the non-register case.)

Reviewers: rnk, thakis

Reviewed By: thakis

Subscribers: kerbowa, merge_guards_bot, wuzish, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, mgorny, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits

Tags: #llvm

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

4 years ago[IRBuilder] Prefer InsertPointGuard over full copy; NFC
Nikita Popov [Sun, 16 Feb 2020 17:02:29 +0000 (18:02 +0100)]
[IRBuilder] Prefer InsertPointGuard over full copy; NFC

Don't copy the IRBuilder when an InsertPointGuard would also do.

4 years ago[IRBuilder] Fix unnecessary IRBuilder copies; NFC
Nikita Popov [Sun, 16 Feb 2020 16:57:18 +0000 (17:57 +0100)]
[IRBuilder] Fix unnecessary IRBuilder copies; NFC

Fix a few cases where an IRBuilder is passed to a helper function
by value, while a by reference pass was intended.

4 years ago[X86] combineX86ShuffleChain - add support for combining 512-bit shuffles to PALIGNR
Simon Pilgrim [Sun, 16 Feb 2020 13:54:17 +0000 (13:54 +0000)]
[X86] combineX86ShuffleChain - add support for combining 512-bit shuffles to PALIGNR

4 years ago[X86] combineX86ShuffleChain - add support for combining 512-bit shuffles to bit...
Simon Pilgrim [Sun, 16 Feb 2020 13:09:16 +0000 (13:09 +0000)]
[X86] combineX86ShuffleChain - add support for combining 512-bit shuffles to bit shifts

4 years agoRevert "[IRBuilder] Virtualize IRBuilder"
Nikita Popov [Sun, 16 Feb 2020 15:59:15 +0000 (16:59 +0100)]
Revert "[IRBuilder] Virtualize IRBuilder"

This reverts commit 0765d3824d069f37596bc5a890399099b776c2a0.
This reverts commit 1b04866a3db9f816a559860f941da067fe1eccf1.

Relevant looking crashes observed on:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win

4 years ago[VectorCombine] fix cost calc for extract-cmp
Sanjay Patel [Sun, 16 Feb 2020 15:40:28 +0000 (10:40 -0500)]
[VectorCombine] fix cost calc for extract-cmp

getOperationCost() is not the cost we wanted; that's not the
throughput value that the rest of the calculation uses.

We may want to switch everything in this code to use the
getInstructionThroughput() wrapper to avoid these kinds of
problems, but I'll look at that as a follow-up because that
can create other logical diffs via using optional parameters
(we'd need to speculatively create the vector instruction to
make a fair(er) comparison).

4 years ago[x86] form broadcast of scalar memop even with >1 use
Sanjay Patel [Sun, 16 Feb 2020 15:32:56 +0000 (10:32 -0500)]
[x86] form broadcast of scalar memop even with >1 use

The unseen logic diff occurs because MayFoldLoad() is defined like this:

static bool MayFoldLoad(SDValue Op) {
  return Op.hasOneUse() && ISD::isNormalLoad(Op.getNode());
}

The test diffs here all seem ok to me on screen/paper, but it's hard to know
if that will lead to universally better perf for all targets. For example,
if a target implements broadcast from mem as multiple uops, we would have to
weigh the potential reduction of instructions and register pressure vs.
possible increase in number of uops. I don't know if we can make a truly
informed decision on this at compile-time.

The motivating case that I'm looking at in PR42024:
https://bugs.llvm.org/show_bug.cgi?id=42024
...resembles the diff in extract-concat.ll, but we're not going to change the
larger example there without at least 1 other fix.

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

4 years ago[InstCombine] Create new log2 intrinsic; NFCI
Nikita Popov [Sun, 16 Feb 2020 09:15:53 +0000 (10:15 +0100)]
[InstCombine] Create new log2 intrinsic; NFCI

Rather than mixing creation of new instructions and in-place
modification here, create a new log2 intrinsic. This should be
NFC apart from worklist order changes.

4 years ago[InstCombine] Add multiuse tests for cttz transform; NFC
Nikita Popov [Sun, 16 Feb 2020 09:51:11 +0000 (10:51 +0100)]
[InstCombine] Add multiuse tests for cttz transform; NFC

These show incorrect duplication of instructions.

4 years ago[Sema] Adds the pointer-to-int-cast diagnostic
Mark de Wever [Sun, 16 Feb 2020 14:01:25 +0000 (15:01 +0100)]
[Sema] Adds the pointer-to-int-cast diagnostic

Converting a pointer to an integer whose result cannot represented in the
integer type is undefined behavior is C and prohibited in C++. C++ already
has a diagnostic when casting. This adds a diagnostic for C.

Since this diagnostic uses the range of the conversion it also modifies
int-to-pointer-cast diagnostic to use a range.

Fixes PR8718: No warning on casting between pointer and non-pointer-sized int

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

4 years ago[IRBuilder] Try to fix warnings
Nikita Popov [Sun, 16 Feb 2020 14:21:21 +0000 (15:21 +0100)]
[IRBuilder] Try to fix warnings

Try to fix -Wnon-virtual-dtor warnings that cause build failure
on clang-pcc64le-rhel.

4 years ago[IRBuilder] Virtualize IRBuilder
Nikita Popov [Sat, 1 Feb 2020 17:23:36 +0000 (18:23 +0100)]
[IRBuilder] Virtualize IRBuilder

Related llvm-dev thread:
http://lists.llvm.org/pipermail/llvm-dev/2020-February/138951.html

This patch moves the IRBuilder from templating over the constant
folder and inserter towards making both of these virtual.
There are a couple of motivations for this:

1. It's not possible to share code between use-sites that use
different IRBuilder folders/inserters (short of templating the code
and moving it into headers).
2. Methods currently defined on IRBuilderBase (which is not templated)
do not use the custom inserter, resulting in subtle bugs (e.g.
incorrect InstCombine worklist management). It would be possible to
move those into the templated IRBuilder, but...
3. The vast majority of the IRBuilder implementation has to live
in the header, because it depends on the template arguments.
4. We have many unnecessary dependencies on IRBuilder.h,
because it is not easy to forward-declare. (Significant parts of
the backend depend on it via TargetLowering.h, for example.)

This patch addresses the issue by making the following changes:

* IRBuilderDefaultInserter::InsertHelper becomes virtual.
  IRBuilderBase accepts a reference to it.
* IRBuilderFolder is introduced as a virtual base class. It is
 implemented by ConstantFolder (default), NoFolder and TargetFolder.
  IRBuilderBase has a reference to this as well.
* All the logic is moved from IRBuilder to IRBuilderBase. This means
  that methods can in the future replace their IRBuilder<> & uses
  (or other specific IRBuilder types) with IRBuilderBase & and thus
  be usable with different IRBuilders.
* The IRBuilder class is now a thin wrapper around IRBuilderBase.
  Essentially it only stores the folder and inserter and takes care
  of constructing the base builder.

What this patch doesn't do, but should be simple followups after this change:

* Fixing use of the inserter for creation methods originally defined
  on IRBuilderBase.
* Replacing IRBuilder<> uses in arguments with IRBuilderBase, where useful.
* Moving code from the IRBuilder header to the source file.

From the user perspective, these changes should be mostly transparent:
The only thing that consumers using a custom inserted may need to do is
inherit from IRBuilderDefaultInserter publicly and mark their InsertHelper
as public.

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

4 years ago[llvm-readobj] - Refactor the code that dumps relocations.
Georgii Rymar [Thu, 13 Feb 2020 12:12:31 +0000 (15:12 +0300)]
[llvm-readobj] - Refactor the code that dumps relocations.

The current code has following issues:
1) It has a duplicated logic part.
2) This logic relies on unwrapOrError calls, but if we want to convert
   them to warnings, we will need to change all of them what is hard to do
   because of the duplication.

In this patch I've created a new method that returns Expected<> what allows
now to catch all errors in a single place and remove the code duplication.

Note: this change is itself a refactor NFC. It does not change the current logic
anyhow. It prepares the code for the follow-up(s).

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

4 years ago[mlir] Allow adding extra class declarations to interfaces.
riverriddle@google.com [Sun, 16 Feb 2020 07:54:28 +0000 (23:54 -0800)]
[mlir] Allow adding extra class declarations to interfaces.

Summary: This matches the similar feature on operation definitions.

Reviewers: jpienaar, antiagainst

Reviewed By: jpienaar, antiagainst

Subscribers: mehdi_amini, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Parser][NFC] Remove several usages of getEncodedSourceLocation
River Riddle [Sun, 16 Feb 2020 07:48:59 +0000 (23:48 -0800)]
[mlir][Parser][NFC] Remove several usages of getEncodedSourceLocation

Summary: getEncodedSourceLocation can be very costly to compute, especially if the input line becomes very long. This revision inlines some of the verification of a few `getChecked` methods to avoid the materialization of an encoded source location.

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

4 years ago[FIX] Do not copy an llvm::function_ref if it has to be reused
Johannes Doerfert [Sun, 16 Feb 2020 06:51:11 +0000 (00:51 -0600)]
[FIX] Do not copy an llvm::function_ref if it has to be reused

Some buildbots signaled a problem in this method when the
llvm::function_ref was copied and reused after 1228d42ddab8. To
eliminate the problem we avoid copying the llvm::function_ref and
instead we pass it as a const reference.

4 years ago[Attributor][FIX] Use pointer not reference as it can be null
Johannes Doerfert [Sun, 16 Feb 2020 02:38:49 +0000 (20:38 -0600)]
[Attributor][FIX] Use pointer not reference as it can be null

4 years agoRestore functionality of --sysroot on FreeBSD after b18cb9c47
Dimitry Andric [Sun, 16 Feb 2020 00:47:12 +0000 (01:47 +0100)]
Restore functionality of --sysroot on FreeBSD after b18cb9c47

After b18cb9c47, clang would sometimes prefer the host C++ includes
(e.g. in /usr/include/c++/v1) before those specified via --sysroot.
While this behavior may be desirable on Linux, it is not so on FreeBSD,
where we make extensive use of --sysroot during the build of the base
system.  In that case, clang must *not* search outside the sysroot,
except for its own internal headers.

Add an override addLibCxxIncludePaths() to restore the old behavior,
which is to simply append /usr/include/c++/v1 to the specified sysroot.
While here, apply clang-format to the FreeBSD specific toolchain files.

Fixes PR44923.

4 years ago[NFC] Move ValidTextRanges out of DwarfTransformer and into GsymCreator and unify...
Greg Clayton [Sun, 16 Feb 2020 00:46:50 +0000 (16:46 -0800)]
[NFC] Move ValidTextRanges out of DwarfTransformer and into GsymCreator and unify address is not in GSYM errors so all strings match.

4 years ago[FIX] Remove pointer in attribute to eliminate leaks (see D71830)
Johannes Doerfert [Sun, 16 Feb 2020 00:07:42 +0000 (18:07 -0600)]
[FIX] Remove pointer in attribute to eliminate leaks (see D71830)

4 years ago[libc++] Move abs and div into stdlib.h to fix header cycle.
Eric Fiselier [Sat, 15 Feb 2020 23:55:07 +0000 (18:55 -0500)]
[libc++] Move abs and div into stdlib.h to fix header cycle.

libc++ is careful to not fracture overload sets. When one overload
is visible to a user, all of them should be. Anything less causes
subtle bugs and ODR violations.

Previously, in order to support ::abs and ::div being supplied by
both <cmath> and <cstdlib> we had to do awful things that make
<math.h> and <stdlib.h> have header cycles and be non-modular.
This really breaks with modules.

Specifically the problem was that in C++ ::abs introduces overloads
for floating point numbers, these overloads forward to ::fabs,
which are defined in math.h. Therefore ::abs needed to be in math.h
too. But this required stdlib.h to include math.h and math.h to
include stdlib.h.

To avoid these problems the definitions have been moved to stddef.h
(which math includes), and the floating point overloads of ::abs
have been changed to call __builtin_fabs, which both Clang and GCC
support.

4 years ago[libc++] Add utility to generate and display libc++'s header dependency
Eric Fiselier [Sat, 15 Feb 2020 23:26:29 +0000 (18:26 -0500)]
[libc++] Add utility to generate and display libc++'s header dependency
graph.

4 years ago[X86] Add test cases showing failure to simplify target shuffles to bit shifts
Simon Pilgrim [Sat, 15 Feb 2020 23:34:31 +0000 (23:34 +0000)]
[X86] Add test cases showing failure to simplify target shuffles to bit shifts

4 years agoFix Wdocumentation unknown parameter warnings. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 23:33:17 +0000 (23:33 +0000)]
Fix Wdocumentation unknown parameter warnings. NFCI.

4 years ago[X86][AVX512] Split AVX512F and AVX512BW shuffle combining tests
Simon Pilgrim [Sat, 15 Feb 2020 22:48:10 +0000 (22:48 +0000)]
[X86][AVX512] Split AVX512F and AVX512BW shuffle combining tests

Split off shuffle combine tests that use AVX512F intrinsics, so we can test it with/without AVX512BW support.

4 years ago[X86][AsmPrinter] PrintSymbolOperand: prefer to lower ELF MO_GlobalAddress to .Lfoo...
Fangrui Song [Sat, 15 Feb 2020 19:40:10 +0000 (11:40 -0800)]
[X86][AsmPrinter] PrintSymbolOperand: prefer to lower ELF MO_GlobalAddress to .Lfoo$local

4 years ago[ValueLattice] Update markConstantRange to return false equal ranges.
Florian Hahn [Sat, 15 Feb 2020 20:24:19 +0000 (21:24 +0100)]
[ValueLattice] Update markConstantRange to return false equal ranges.

Currently we always return true, when markConstantRange is used on an
object already containing a constant range. If NewR is equal to the
existing constant range however, nothing changes and we should return
false.

I also went ahead and added a clarifying comment and improved the
assertion.

Reviewers: efriedma, davide, nikic

Reviewed By: efriedma

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

4 years ago[X86] Merge two switches together to simplify some code. NFC
Craig Topper [Sat, 15 Feb 2020 20:55:51 +0000 (12:55 -0800)]
[X86] Merge two switches together to simplify some code. NFC

4 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sat, 15 Feb 2020 18:48:57 +0000 (10:48 -0800)]
[X86] Fix typo in comment. NFC

4 years ago[X86] combineX86ShuffleChain - add support for combining to X86ISD::ROTLI
Simon Pilgrim [Sat, 15 Feb 2020 20:04:15 +0000 (20:04 +0000)]
[X86] combineX86ShuffleChain - add support for combining to X86ISD::ROTLI

Refactors matchShuffleAsBitRotate to allow use by both lowerShuffleAsBitRotate and matchUnaryPermuteShuffle.

4 years ago[ValueLattice] Make mark* functions public, return if value changed.
Florian Hahn [Sat, 15 Feb 2020 18:22:02 +0000 (19:22 +0100)]
[ValueLattice] Make mark* functions public, return if value changed.

This patch prepares ValueLatticeElement to be used by SCCP, by:
* making the mark* functions public
* make the mark* functions return a bool indicating if the value has changed.

Reviewers: efriedma, davide, mssimpso, nikic

Reviewed By: nikic

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

4 years ago[X86] Add test showing failure to combine shuffle to bit rotation
Simon Pilgrim [Sat, 15 Feb 2020 19:23:00 +0000 (19:23 +0000)]
[X86] Add test showing failure to combine shuffle to bit rotation

4 years ago[X86] Move combineIncDecVector logic from Select to PreprocessISelDAG.
Craig Topper [Sat, 15 Feb 2020 17:59:10 +0000 (09:59 -0800)]
[X86] Move combineIncDecVector logic from Select to PreprocessISelDAG.

This allows it to work properly with masked inc/dec for avx512. Those
would have a vselect as the root node so didn't get a chance to call
combineIncDecVector.

This also simplifies the logic because we don't have to manage
the topological ordering.

4 years agoRecommit "[SCCP] Remove forcedconstant, go to overdefined instead"
Florian Hahn [Thu, 13 Feb 2020 23:05:50 +0000 (00:05 +0100)]
Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"

This includes a fix for cases where things get marked as overdefined in
ResolvedUndefsIn, but we later discover a constant. To avoid crashing,
we consistently bail out on overdefined values in the visitors. This is
similar to the previous behavior with forcedconstant.

This reverts the revert commit 02b72f564c8be0b4f4337d5c4a3fcf7e8018a818.

4 years ago[MC] De-capitalize MCStreamer::Emit{Bundle,Addrsig}* etc
Fangrui Song [Sat, 15 Feb 2020 16:52:56 +0000 (08:52 -0800)]
[MC] De-capitalize MCStreamer::Emit{Bundle,Addrsig}* etc

So far, all non-COFF-related Emit* functions have been de-capitalized.

4 years agoFix gcc9.2 -Winit-list-lifetime warning. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 16:47:35 +0000 (16:47 +0000)]
Fix gcc9.2 -Winit-list-lifetime warning. NFCI.

Reported by @lbenes (Luke Benes)

4 years ago[obj2yaml] - Fix a -Wsign-compare warning gived by GCC 9.2
Georgii Rymar [Sat, 15 Feb 2020 15:34:06 +0000 (18:34 +0300)]
[obj2yaml] - Fix a -Wsign-compare warning gived by GCC 9.2

I was reported that with commit:
https://github.com/llvm/llvm-project/commit/d3963051c490

gcc-9.2 is giving the warning below.
This should help (I have no gcc 9.2 to test).

[ 57%] Building CXX object tools/obj2yaml/CMakeFiles/obj2yaml.dir/elf2yaml.cpp.o
/llvm/tools/obj2yaml/elf2yaml.cpp: In instantiation of â€˜llvm::Expected<llvm::ELFYAML::Object*>
{anonymous}::ELFDumper<ELFT>::dump() [with ELFT = llvm::object::ELFType<llvm::support::little, false>]’:
/llvm/tools/obj2yaml/elf2yaml.cpp:1218:31:   required from â€˜llvm::Error elf2yaml(llvm::raw_ostream&,
const llvm::object::ELFFile<ELFT>&) [with ELFT = llvm::object::ELFType<llvm::support::little, false>]’
/llvm/tools/obj2yaml/elf2yaml.cpp:1231:47:   required from here
/llvm/tools/obj2yaml/elf2yaml.cpp:207:41: warning: comparison of integer expressions of different
signedness: â€˜llvm::support::detail::packed_endian_specific_integral<unsigned int, llvm::support::little, 1>::value_type’ {aka â€˜unsigned int’} and â€˜int’ [-Wsign-compare]
  207 |     if (!SymTab || SymTabShndx->sh_link != SymTab - Sections.begin())
/llvm/tools/obj2yaml/elf2yaml.cpp: In instantiation of â€˜llvm::Expected<llvm::ELFYAML::Object*>
{anonymous}::ELFDumper<ELFT>::dump() [with ELFT = llvm::object::ELFType<llvm::support::big, false>]’:
...

4 years ago[Support] In tests, fix warning: variable ‘Threads’ set but not used
Alexandre Ganea [Sat, 15 Feb 2020 14:03:38 +0000 (09:03 -0500)]
[Support] In tests, fix warning: variable â€˜Threads’ set but not used

4 years agoFix boolean/bitwise operator precedence warnings. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 13:53:18 +0000 (13:53 +0000)]
Fix boolean/bitwise operator precedence warnings. NFCI.

4 years ago[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits
Simon Pilgrim [Sat, 15 Feb 2020 13:27:06 +0000 (13:27 +0000)]
[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits

As noted on D74621, the bswap intrinsic has a self imposed limitation that the type's bitwidth must be divisible by 16, but there's no reason that APInt::byteSwap must have the same limitation, given that it can already handle any byte width.

4 years ago[AArch64][FIX] Correct register live range during pseudo expansion.
Pavel Iliin [Sat, 15 Feb 2020 10:50:59 +0000 (10:50 +0000)]
[AArch64][FIX] Correct register live range during pseudo expansion.

This commit fixes the broken tests after
commit b6a9fe209992789be3ed95664d25196361cfad34
on the expensive check builder:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/2884

4 years ago[APInt] byteSwap - simplify sub 64-bits cases to match general implementation. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 12:16:14 +0000 (12:16 +0000)]
[APInt] byteSwap - simplify sub 64-bits cases to match general implementation. NFCI.

We can just byteSwap the entire uint64_t VAL and then shift down into place like we do for the multi-word case.

4 years ago[APInt] Add some procedural APInt::byteSwap unit tests
Simon Pilgrim [Sat, 15 Feb 2020 11:56:26 +0000 (11:56 +0000)]
[APInt] Add some procedural APInt::byteSwap unit tests

rGf0181cc7bac3 added specific tests up to i64, this adds a general loop to test some basic byte moves for larger APInts.

4 years ago[AArch64] Fixup kill flags on BSL generation
David Green [Sat, 15 Feb 2020 10:41:14 +0000 (10:41 +0000)]
[AArch64] Fixup kill flags on BSL generation

This hopefully fixes up the expensive checks bot.

4 years ago[gn build] unbreak win build by removing flags that only work with a sysroot
Nico Weber [Sat, 15 Feb 2020 11:25:21 +0000 (06:25 -0500)]
[gn build] unbreak win build by removing flags that only work with a sysroot

4 years ago[Debuginfo][NFC] Remove usages of WithColor::error and WithColor::warning.
Alexey Lapshin [Fri, 14 Feb 2020 15:57:21 +0000 (18:57 +0300)]
[Debuginfo][NFC] Remove usages of WithColor::error and WithColor::warning.

Summary:
This patch is extracted from D74308.

It patches all usages of WithColor::error() and WithColor::warning
in DebugInfoDWARF library.

Depends on D74481

Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoPR44890: Inherit explicitly-specified template arguments into base class
Richard Smith [Sat, 15 Feb 2020 10:15:26 +0000 (02:15 -0800)]
PR44890: Inherit explicitly-specified template arguments into base class
deduction.

4 years ago[cxx_status] New papers from Prague 2020 WG21 meeting.
Richard Smith [Sat, 15 Feb 2020 09:51:43 +0000 (01:51 -0800)]
[cxx_status] New papers from Prague 2020 WG21 meeting.

4 years agoFix standalone build interaction with compiler extension
serge-sans-paille [Fri, 14 Feb 2020 11:11:20 +0000 (12:11 +0100)]
Fix standalone build interaction with compiler extension

As suggested in https://github.com/llvm/llvm-project/issues/120, don't try to
generate the extension file from clang, only do the linking step.

Fixes the regression introduced in D74464 when running cmake inside the clang
directory.

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

4 years ago[Debuginfo][NFC] Create common error handlers for DWARFContext.
Alexey Lapshin [Tue, 11 Feb 2020 15:32:27 +0000 (18:32 +0300)]
[Debuginfo][NFC] Create common error handlers for DWARFContext.

Summary:
this review is extracted from D74308.

It creates two error handlers which allow to redefine error
reporting routine and should be used for all places
where errors are reported:

  std::function<void(Error)> RecoverableErrorHandler = defaultErrorHandler;
  std::function<void(Error)> WarningHandler = defaultWarningHandler;

It also creates accessors to above handlers which should be used to
report errors.

  function_ref<void(Error)> getRecoverableErrorHandler() {
    return RecoverableErrorHandler;
  }

  function_ref<void(Error)> getWarningHandler() { return WarningHandler; }

It patches all error reporting places inside DWARFContext and DWARLinker.

Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere

Reviewed By: jhenderson, JDevlieghere

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #debug-info

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

4 years ago[Attributor] Collect memory accesses with their respective kind and location
Johannes Doerfert [Tue, 28 Jan 2020 04:49:36 +0000 (22:49 -0600)]
[Attributor] Collect memory accesses with their respective kind and location

In addition to a single bit per memory locations, e.g., globals and
arguments, we now collect more information about the actual accesses,
e.g., what instruction caused it, was it a read/write/read+write, and
what the underlying base pointer was. Follow up patches will make
explicit use of this.

Reviewed By: uenoku

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

4 years ago[NFC] Revert unnecessary parts of b91c267380
Johannes Doerfert [Sat, 15 Feb 2020 07:38:58 +0000 (01:38 -0600)]
[NFC] Revert unnecessary parts of b91c267380

In b91c267380 I accidentally introduced fixes that were not necessary
after 1a93285c686a. All but the `llvm_unreachable` are reverted again.

4 years ago[FIX] Order macros after D72304
Johannes Doerfert [Sat, 15 Feb 2020 07:37:23 +0000 (01:37 -0600)]
[FIX] Order macros after D72304

4 years ago[FIX] Remove warnings and UB after 1228d42ddab8
Johannes Doerfert [Sat, 15 Feb 2020 06:59:08 +0000 (00:59 -0600)]
[FIX] Remove warnings and UB after 1228d42ddab8

4 years ago[FIX] Repair clang-tidy check after D72304
Johannes Doerfert [Sat, 15 Feb 2020 06:58:42 +0000 (00:58 -0600)]
[FIX] Repair clang-tidy check after D72304

4 years ago[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.
Fady Ghanim [Sat, 15 Feb 2020 06:42:23 +0000 (00:42 -0600)]
[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well.

Also this patch modifies clang to use the new directives when  `-fopenmp-enable-irbuilder` commandline option is passed.

Reviewed By: jdoerfert

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

4 years ago[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}
Fangrui Song [Sat, 15 Feb 2020 06:40:47 +0000 (22:40 -0800)]
[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}

4 years agoNFC: add indexing operator for ArrayAttr
Uday Bondhugula [Sat, 15 Feb 2020 06:54:18 +0000 (22:54 -0800)]
NFC: add indexing operator for ArrayAttr

Summary: - add ArrayAttr::operator[](unsigned idx)

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

4 years ago[OpenMP][NFC] Update OpenMPSupport table
Johannes Doerfert [Sat, 15 Feb 2020 06:40:39 +0000 (00:40 -0600)]
[OpenMP][NFC] Update OpenMPSupport table

4 years ago[OpenMP][NFCI] Use the libFrontend DefaultKind in Clang
Atmn Patel [Sat, 15 Feb 2020 03:45:49 +0000 (21:45 -0600)]
[OpenMP][NFCI] Use the libFrontend DefaultKind in Clang

This swaps out the OpenMPDefaultClauseKind enum with a
llvm::omp::DefaultKind enum which is stored in OMPConstants.h.

This should not change any functionality.

Reviewed By: jdoerfert

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

4 years ago[Attributor] Fix -Wunused-variable for -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Sat, 15 Feb 2020 05:47:19 +0000 (21:47 -0800)]
[Attributor] Fix -Wunused-variable for -DLLVM_ENABLE_ASSERTIONS=off builds after b4352e43d86e

4 years ago[AsmPrinter] Omit unique ID for .stack_sizes
Fangrui Song [Sat, 15 Feb 2020 05:14:31 +0000 (21:14 -0800)]
[AsmPrinter] Omit unique ID for .stack_sizes

Follow-up for D74006.

4 years ago[AsmPrinter][XRay] Omit unique ID for xray_instr_map and xray_fn_idx
Fangrui Song [Sat, 15 Feb 2020 05:02:26 +0000 (21:02 -0800)]
[AsmPrinter][XRay] Omit unique ID for xray_instr_map and xray_fn_idx

Follow-up for D74006.

4 years ago[AArch64][FPenv] Update chain of int to fp conversion
Diogo Sampaio [Sat, 15 Feb 2020 05:05:15 +0000 (05:05 +0000)]
[AArch64][FPenv] Update chain of int to fp conversion

Summary:
When using strict fp, it is required to update the
chain when performing integer type promotion of a
operand to a integer to floating point conversion.

Reviewers: craig.topper, john.brawn

Reviewed By: craig.topper

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AsmPrinter] Omit unique ID for __patchable_function_entries sections
Fangrui Song [Sat, 15 Feb 2020 04:35:04 +0000 (20:35 -0800)]
[AsmPrinter] Omit unique ID for __patchable_function_entries sections

Follow-up for D74006.

When the integrated assembler is used, we use SHF_LINK_ORDER.  The
linked-to symbol is part of ELFSectionKey, thus we can omit the unique
ID.

4 years ago[MC] Add MCSection::NonUniqueID and delete one MCContext::getELFSection overload
Fangrui Song [Sat, 15 Feb 2020 04:15:55 +0000 (20:15 -0800)]
[MC] Add MCSection::NonUniqueID and delete one MCContext::getELFSection overload

4 years ago[MC][ELF] Make linked-to symbol name part of ELFSectionKey
Fangrui Song [Tue, 4 Feb 2020 21:52:10 +0000 (13:52 -0800)]
[MC][ELF] Make linked-to symbol name part of ELFSectionKey

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

This rule has been implemented by GNU as https://sourceware.org/ml/binutils/2020-02/msg00028.html (binutils >= 2.35)

It allows us to simplify

```
.section .foo,"o",foo,unique,0
.section .foo,"o",bar,unique,1  # different section
```

to

```
.section .foo,"o",foo
.section .foo,"o",bar  # different section
```

We consider the two `.foo` different even if the linked-to symbols foo and bar
are defined in the same section.  This is a deliberate choice so that we don't
need to know the section where foo and bar are defined beforehand.

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

4 years ago[Attributor][FIX] Ensure abstract attributes are existing before manifest
Johannes Doerfert [Fri, 14 Feb 2020 16:34:31 +0000 (10:34 -0600)]
[Attributor][FIX] Ensure abstract attributes are existing before manifest

While the function return updateImpl did only look at call sites the
manifest method looked at return values. If we don't do this during the
updateImpl we might create new abstract attributes during manifest. This
is a problem when it comes to liveness information.

4 years ago[Attributor] Manifest simplified (return) values properly
Johannes Doerfert [Sat, 15 Feb 2020 02:11:22 +0000 (20:11 -0600)]
[Attributor] Manifest simplified (return) values properly

If we simplify a function return value we have to modify the return
instructions.

4 years ago[Attributor][FIX] Collapse `undef` to a proper value
Johannes Doerfert [Sat, 15 Feb 2020 02:08:20 +0000 (20:08 -0600)]
[Attributor][FIX] Collapse `undef` to a proper value

If we see an undef we cannot assume it's the same as "no value". For now
we just collapse it to 0.

4 years ago[Attributor][FIX] Restrict cross-SCC call deletion
Johannes Doerfert [Sat, 15 Feb 2020 02:06:34 +0000 (20:06 -0600)]
[Attributor][FIX] Restrict cross-SCC call deletion

If we know a call was not needed we might have ended up deleting it even
if it was in a different SCC. This prevents us from doing so.

4 years ago[Attributor][NFC] Add check lines for tests
Johannes Doerfert [Sat, 15 Feb 2020 01:27:41 +0000 (19:27 -0600)]
[Attributor][NFC] Add check lines for tests

4 years ago[Attributor][FIX] Carefully strip casts in AANoAlias
Johannes Doerfert [Sat, 15 Feb 2020 01:23:21 +0000 (19:23 -0600)]
[Attributor][FIX] Carefully strip casts in AANoAlias

We can strip casts in AANoAlias but that might cause us to end up with a
non-pointer type. We do properly handle that case now.

4 years ago[Attributor][FIX] Do not RAUW void values
Johannes Doerfert [Fri, 14 Feb 2020 02:10:59 +0000 (20:10 -0600)]
[Attributor][FIX] Do not RAUW void values

This caused an error when passes iterated over cached assumptions in the
tracker and assumed them to be `null` or an instruction. I failed to
create a test case so far.

4 years ago[llvm-ranlib][test] Fix rwx- after a4f3847f3d5742cfab7acdc614e7ca54643e0c85
Fangrui Song [Sat, 15 Feb 2020 03:41:05 +0000 (19:41 -0800)]
[llvm-ranlib][test] Fix rwx- after a4f3847f3d5742cfab7acdc614e7ca54643e0c85

4 years agoAMDGPU/GlobalISel: Fix missing impdef of scc on boolean bit ops
Matt Arsenault [Sat, 15 Feb 2020 03:02:31 +0000 (22:02 -0500)]
AMDGPU/GlobalISel: Fix missing impdef of scc on boolean bit ops

4 years ago[MC] De-capitalize another set of MCStreamer::Emit* functions
Fangrui Song [Sat, 15 Feb 2020 03:21:58 +0000 (19:21 -0800)]
[MC] De-capitalize another set of MCStreamer::Emit* functions

Emit{ValueTo,Code}Alignment Emit{DTP,TP,GP}* EmitSymbolValue etc

4 years ago[MC] De-capitalize some MCStreamer::Emit* functions
Fangrui Song [Sat, 15 Feb 2020 02:16:24 +0000 (18:16 -0800)]
[MC] De-capitalize some MCStreamer::Emit* functions

4 years ago[gn build] Make build locally deterministic
Nico Weber [Sat, 15 Feb 2020 02:55:33 +0000 (21:55 -0500)]
[gn build] Make build locally deterministic

This follows http://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html
to make the GN build locally deterministic.

With this, I've built lld at two different build paths on my Windows box and got
identical binaries. (I'd expect the same to happen on Linux, and with other
binaries.)

This doesn't have the bits to get universal determinism yet.

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

4 years agoRemove 'process launch failed:' message prefix in Target::Launch
Jason Molenda [Sat, 15 Feb 2020 02:42:38 +0000 (18:42 -0800)]
Remove 'process launch failed:' message prefix in Target::Launch

SB API clients can describe the failure message in a more natural
way for their UI, this doesn't add information for them.

Differential Revision: https://reviews.llvm.org/D74585
<rdar://problem/49953304>

4 years ago[RISCV] Correct the CallPreservedMask for the function call in an interrupt handler
Shiva Chen [Fri, 14 Feb 2020 07:57:11 +0000 (15:57 +0800)]
[RISCV] Correct the CallPreservedMask for the function call in an interrupt handler

CallPreservedMask is used to describe the register liveness after a
function call. The function call in an interrupt handler should use the same
CallPreservedMask as normal functions. So that only callee save registers
can live through the function call.

4 years ago[Attributor] Derive memory location attributes (argmemonly, ...)
Johannes Doerfert [Sun, 26 Jan 2020 08:51:57 +0000 (02:51 -0600)]
[Attributor] Derive memory location attributes (argmemonly, ...)

In addition to memory behavior attributes (readonly/writeonly) we now
derive memory location attributes (argmemonly/inaccessiblememonly/...).
The former is part of AAMemoryBehavior and the latter part of
AAMemoryLocation. While they are similar in nature it got messy when
they were put in a single AA. Location attributes for arguments and
floating values will follow later.

Note that both memory attributes kinds can derive readnone. If there are
no accesses AAMemoryBehavior will derive readnone. If there are accesses
but only to stack (=local) locations AAMemoryLocation will derive
readnone.

Reviewed By: uenoku

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

4 years agoAMDGPU: Don't preserve analyses with div64 IR expansion
Matt Arsenault [Sat, 15 Feb 2020 00:57:38 +0000 (19:57 -0500)]
AMDGPU: Don't preserve analyses with div64 IR expansion

The dominator tree needs to be updated, but that isn't handled now.

4 years agoFix 01b02a73de78 to use correct macro spelling and fix unit tests.
Amy Huang [Fri, 14 Feb 2020 23:31:45 +0000 (15:31 -0800)]
Fix 01b02a73de78 to use correct macro spelling and fix unit tests.

4 years agoAMDGPU/GlobalISel: Fix G_EXTRACT of 96-bit results
Matt Arsenault [Fri, 7 Feb 2020 20:18:58 +0000 (15:18 -0500)]
AMDGPU/GlobalISel: Fix G_EXTRACT of 96-bit results

This would assert on an unhandled size in getRegSplitParts.

4 years agoAMDGPU: Use generated checks for memcpy expansion
Matt Arsenault [Fri, 14 Feb 2020 20:13:53 +0000 (15:13 -0500)]
AMDGPU: Use generated checks for memcpy expansion

4 years agoAMDGPU/GlobalISel: Improve 16-bit bswap
Matt Arsenault [Fri, 14 Feb 2020 15:56:46 +0000 (10:56 -0500)]
AMDGPU/GlobalISel: Improve 16-bit bswap

Match the new DAG behavior and use v_perm_b32 when available. Also
does better on SI/CI by expanding 16-bit swaps. Also fix
non-power-of-2 cases.

4 years agoGlobalISel: Remove unused function argument
Matt Arsenault [Fri, 7 Feb 2020 20:51:04 +0000 (15:51 -0500)]
GlobalISel: Remove unused function argument

4 years ago[TBLGEN] Allow to override RC weight
Stanislav Mekhanoshin [Wed, 12 Feb 2020 22:45:21 +0000 (14:45 -0800)]
[TBLGEN] Allow to override RC weight

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

4 years ago[WebAssembly] Add section names for some DWARF5 sections
Derek Schuff [Fri, 14 Feb 2020 23:29:32 +0000 (15:29 -0800)]
[WebAssembly] Add section names for some DWARF5 sections

Summary:
Addresses PR44728 but no tests because I've not yet made any attempt to verify
correctness of the debug info.

Reviewers: sbc100, aardappel

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

4 years agoFix -Wstring-compare warnings in new OpenMP code
Reid Kleckner [Fri, 14 Feb 2020 23:23:42 +0000 (15:23 -0800)]
Fix -Wstring-compare warnings in new OpenMP code

4 years ago[FIX] Add missing InGroup to warning introduced as part of D71830
Johannes Doerfert [Fri, 14 Feb 2020 23:21:13 +0000 (17:21 -0600)]
[FIX] Add missing InGroup to warning introduced as part of D71830

4 years ago[Attributor][FIX] Validate the type for AAValueConstantRange as needed
Johannes Doerfert [Thu, 13 Feb 2020 20:22:26 +0000 (14:22 -0600)]
[Attributor][FIX] Validate the type for AAValueConstantRange as needed

Due to the genericValueTraversal we might visit values for which we did
not create an AAValueConstantRange object, e.g., as they are behind a
PHI or select or call with `returned` argument. As a consequence we need
to validate the types as we are about to query AAValueConstantRange for
operands.

4 years agoDon't call computeHostNumPhysicalCores when LLVM_ENABLE_THREADS is off
Amy Huang [Fri, 14 Feb 2020 22:52:25 +0000 (14:52 -0800)]
Don't call computeHostNumPhysicalCores when LLVM_ENABLE_THREADS is off

Summary:
Fix change from 8404aeb56a73 to avoid calling
computeHostNumPhysicalCores if LLVM_ENABLE_THREADS is off.

Reviewers: rnk, aganea

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lli] Add a '-dlopen <library-path>' option to lli.
Lang Hames [Fri, 14 Feb 2020 22:22:59 +0000 (14:22 -0800)]
[lli] Add a '-dlopen <library-path>' option to lli.

Passing '-dlopen <library-path>' to lli will cause the specified library to be
loaded (via llvm::sys::DynamicLibrary::LoadLibraryPermanently) before JIT'd code
is executed, making the library's symbols accessible to JIT'd code.

4 years ago[OpenMP][Part 2] Use reusable OpenMP context/traits handling
Johannes Doerfert [Fri, 20 Dec 2019 02:42:12 +0000 (20:42 -0600)]
[OpenMP][Part 2] Use reusable OpenMP context/traits handling

This patch implements an almost complete handling of OpenMP
contexts/traits such that we can reuse most of the logic in Flang
through the OMPContext.{h,cpp} in llvm/Frontend/OpenMP.

All but construct SIMD specifiers, e.g., inbranch, and the device ISA
selector are define in `llvm/lib/Frontend/OpenMP/OMPKinds.def`. From
these definitions we generate the enum classes `TraitSet`,
`TraitSelector`, and `TraitProperty` as well as conversion and helper
functions in `llvm/lib/Frontend/OpenMP/OMPContext.{h,cpp}`.

The above enum classes are used in the parser, sema, and the AST
attribute. The latter is not a collection of multiple primitive variant
arguments that contain encodings via numbers and strings but instead a
tree that mirrors the `match` clause (see `struct OpenMPTraitInfo`).

The changes to the parser make it more forgiving when wrong syntax is
read and they also resulted in more specialized diagnostics. The tests
are updated and the core issues are detected as before. Here and
elsewhere this patch tries to be generic, thus we do not distinguish
what selector set, selector, or property is parsed except if they do
behave exceptionally, as for example `user={condition(EXPR)}` does.

The sema logic changed in two ways: First, the OMPDeclareVariantAttr
representation changed, as mentioned above, and the sema was adjusted to
work with the new `OpenMPTraitInfo`. Second, the matching and scoring
logic moved into `OMPContext.{h,cpp}`. It is implemented on a flat
representation of the `match` clause that is not tied to clang.
`OpenMPTraitInfo` provides a method to generate this flat structure (see
`struct VariantMatchInfo`) by computing integer score values and boolean
user conditions from the `clang::Expr` we keep for them.

The OpenMP context is now an explicit object (see `struct OMPContext`).
This is in anticipation of construct traits that need to be tracked. The
OpenMP context, as well as the `VariantMatchInfo`, are basically made up
of a set of active or respectively required traits, e.g., 'host', and an
ordered container of constructs which allows duplication. Matching and
scoring is kept as generic as possible to allow easy extension in the
future.

---

Test changes:

The messages checked in `OpenMP/declare_variant_messages.{c,cpp}` have
been auto generated to match the new warnings and notes of the parser.
The "subset" checks were reversed causing the wrong version to be
picked. The tests have been adjusted to correct this.
We do not print scores if the user did not provide one.
We print spaces to make lists in the `match` clause more legible.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: merge_guards_bot, rampitec, mgorny, hiraditya, aheejin, fedor.sergeev, simoncook, bollu, guansong, dexonsmith, jfb, s.egerton, llvm-commits, cfe-commits

Tags: #clang, #llvm

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