platform/upstream/llvm.git
4 years ago[AMDGPU] Fix emitIfBreak CF lowering: use temp reg to make register coalescer life...
vpykhtin [Mon, 18 Nov 2019 17:06:48 +0000 (20:06 +0300)]
[AMDGPU] Fix emitIfBreak CF lowering: use temp reg to make register coalescer life easier.

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

4 years ago[OPENMP]Fix PR44133: crash on lambda reductions in templates.
Alexey Bataev [Mon, 25 Nov 2019 21:25:27 +0000 (16:25 -0500)]
[OPENMP]Fix PR44133: crash on lambda reductions in templates.

Need to perform the instantiation of the combiner/initializer even if
the resulting type is not dependent, if the construct is defined in
templates in some cases.

4 years ago[lldb] [test] Un-XFAIL lldb-server tests fixed on NetBSD
Michał Górny [Tue, 26 Nov 2019 15:45:43 +0000 (16:45 +0100)]
[lldb] [test] Un-XFAIL lldb-server tests fixed on NetBSD

4 years ago[clang-tidy] Use range-for for check registration. NFC
Alexander Kornienko [Fri, 22 Nov 2019 11:22:40 +0000 (12:22 +0100)]
[clang-tidy] Use range-for for check registration. NFC

Actually, just testing GitHub commit rights.

4 years ago[LegalizeTypes][RISCV] Soften FCOPYSIGN operand
Luís Marques [Sun, 24 Nov 2019 15:23:29 +0000 (15:23 +0000)]
[LegalizeTypes][RISCV] Soften FCOPYSIGN operand

Summary: Adds support for softening FCOPYSIGN operands.
Adds RISC-V tests that exercise the new softening code.

Reviewers: asb, lenary, efriedma
Reviewed By: efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70679

4 years ago[RISCV] Handle fcopysign(f32, f64) and fcopysign(f64, f32)
Luís Marques [Tue, 26 Nov 2019 14:24:59 +0000 (14:24 +0000)]
[RISCV] Handle fcopysign(f32, f64) and fcopysign(f64, f32)

Summary: Adds tablegen patterns to explicitly handle fcopysign where the
magnitude and sign arguments have different types, due to the sign value casts
being removed the by DAGCombiner. Support for RV32IF follows in a separate
commit. Adds tests for all relevant scenarios except RV32IF.

Reviewers: lenary
Reviewed By: lenary
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70678

4 years ago[llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verdef section.
Georgii Rymar [Wed, 20 Nov 2019 14:37:56 +0000 (17:37 +0300)]
[llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verdef section.

Currently we have following issues:
1) We have 2 different implementations with a different behaviors for GNU/LLVM styles.
2) Errors are either not handled at all or we call report_fatal_error with not helpfull messages.
3) There is no test coverage even for those errors that are reported.

This patch reimplements parsing of the SHT_GNU_verdef section entries
in a single place, adds a few error messages and test coverage.

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

4 years ago[lldb] Avoid snprintf in PlatformRemoteDarwinDevice
Pavel Labath [Tue, 26 Nov 2019 14:11:16 +0000 (15:11 +0100)]
[lldb] Avoid snprintf in PlatformRemoteDarwinDevice

This quashes a -Wformat-truncation warning.

4 years ago[InferFuncAttributes][Attributor] add tests for 'dereferenceable'; NFC
Sanjay Patel [Tue, 26 Nov 2019 14:07:17 +0000 (09:07 -0500)]
[InferFuncAttributes][Attributor] add tests for 'dereferenceable'; NFC

Pulling a couple of extra tests out of
D64258
before abandoning in favor of
D70714

4 years ago[lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifier
Raphael Isemann [Tue, 26 Nov 2019 13:23:32 +0000 (14:23 +0100)]
[lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifier

4 years ago[lldb] Use llvm::format in AppleObjCRuntimeV2.cpp
Pavel Labath [Tue, 26 Nov 2019 14:00:15 +0000 (15:00 +0100)]
[lldb] Use llvm::format in AppleObjCRuntimeV2.cpp

Crushing a "sprintf" buffer is null warning.

4 years ago[llvm-readobj][test] - Cleanup the many-sections.s test case.
Georgii Rymar [Tue, 26 Nov 2019 12:29:30 +0000 (15:29 +0300)]
[llvm-readobj][test] - Cleanup the many-sections.s test case.

It removes 2 precompiled binaries used which are now
can be crafted with the use of yaml2obj.

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

4 years ago[lldb] fix a -Wcast-qual warning
Pavel Labath [Tue, 26 Nov 2019 13:48:47 +0000 (14:48 +0100)]
[lldb] fix a -Wcast-qual warning

4 years ago[lldb] remove a superfluous semicolon
Pavel Labath [Tue, 26 Nov 2019 13:47:28 +0000 (14:47 +0100)]
[lldb] remove a superfluous semicolon

4 years agoPartially reland "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated...
Dávid Bolvanský [Tue, 26 Nov 2019 11:13:13 +0000 (12:13 +0100)]
Partially reland "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy""

But do not enable it under -Wextra until libcxx issue is solved.

4 years ago[lldb] remove unsigned Stream::operator<< overloads
Pavel Labath [Thu, 14 Nov 2019 14:31:26 +0000 (15:31 +0100)]
[lldb] remove unsigned Stream::operator<< overloads

Summary:
I recently re-discovered that the unsinged stream operators of the
lldb_private::Stream class have a surprising behavior in that they print
the number in hex. This is all the more confusing because the "signed"
versions of those operators behave normally.

Now that, thanks to Raphael, each Stream class has a llvm::raw_ostream
wrapper, I think we should delete most of our formatting capabilities
and just delegate to that. This patch tests the water by just deleting
the operators with the most surprising behavior.

Most of the code using these operators was printing user_id_t values. It
wasn't fully consistent about prefixing them with "0x", but I've tried
to consistenly print it without that prefix, to make it more obviously
different from pointer values.

Reviewers: teemperor, JDevlieghere, jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb/symbolvendorelf] Copy more sections from separate debug files
Pavel Labath [Mon, 25 Nov 2019 13:33:25 +0000 (14:33 +0100)]
[lldb/symbolvendorelf] Copy more sections from separate debug files

Include the fancier DWARF5 sections too.

4 years ago[lldb][NFC] Remove no longer unused variable in DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 13:17:06 +0000 (14:17 +0100)]
[lldb][NFC] Remove no longer unused variable in DWARFASTParserClang::ParseTypeFromDWARF

4 years ago[yaml2obj] - Fix BB after «[yaml2obj] - Teach tool to describe SHT_GNU_verdef section...
Georgii Rymar [Tue, 26 Nov 2019 13:01:47 +0000 (16:01 +0300)]
[yaml2obj] - Fix BB after «[yaml2obj] - Teach tool to describe SHT_GNU_verdef section with a "Content" property.»

Fixed a temporary file name.

BB: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/669

4 years ago[lldb][NFC] Simplify structure parsing code in DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 13:01:10 +0000 (14:01 +0100)]
[lldb][NFC] Simplify structure parsing code in DWARFASTParserClang::ParseTypeFromDWARF

This way it looks more like the code around it. The assert is also gone as it just
checks that the variables we declare directly above were not initialized by anyone.
That made more sense when this was one large function.

4 years ago[lldb] Add boilerplate to recognize the .debug_rnglists.dwo section
Pavel Labath [Tue, 26 Nov 2019 10:00:23 +0000 (11:00 +0100)]
[lldb] Add boilerplate to recognize the .debug_rnglists.dwo section

4 years ago[lldb][NFC] Extract type modifier parsing from DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 12:42:16 +0000 (13:42 +0100)]
[lldb][NFC] Extract type modifier parsing from DWARFASTParserClang::ParseTypeFromDWARF

Part of the work to split up this monolithic parsing function.

4 years ago[clangd] Speed up when building rename edit.
Haojian Wu [Tue, 19 Nov 2019 14:23:36 +0000 (15:23 +0100)]
[clangd] Speed up when building rename edit.

Summary:
We used to scan the code everytime when computing the LSP position to the offset
(respect the LSP encoding). Now we only scan the source code once.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[NFC] ASSERT_EQ before accessing items in containers
Kirill Bobyrev [Tue, 26 Nov 2019 12:45:04 +0000 (13:45 +0100)]
[NFC] ASSERT_EQ before accessing items in containers

As discussed offline, something different from `EXPECT_EQ` should be
used to check if the container contains enough items before accessing
them so that other tests can still be run even if the assertion fails as
opposed to having `EXPECT_EQ` failing and then aborting the run due to
the errors caused by out-of-bounds memory access.

Reviewed by: ilya-biryukov

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

4 years ago[yaml2obj] - Teach tool to describe SHT_GNU_verdef section with a "Content" property.
Georgii Rymar [Tue, 26 Nov 2019 10:59:37 +0000 (13:59 +0300)]
[yaml2obj] - Teach tool to describe SHT_GNU_verdef section with a "Content" property.

There is no way to set raw content for SHT_GNU_verdef section.
This patch implements it.

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

4 years ago[openmp] Recognise ARMv7ve machine arch.
AndreyChurbanov [Tue, 26 Nov 2019 11:37:24 +0000 (14:37 +0300)]
[openmp] Recognise ARMv7ve machine arch.

Patch by raj.khem (Khem Raj)

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

4 years ago[X86][MC] no error diagnostic for out-of-range jrcxz/jecxz/jcxz
Alexey Lapshin [Fri, 15 Nov 2019 18:48:55 +0000 (21:48 +0300)]
[X86][MC] no error diagnostic for out-of-range jrcxz/jecxz/jcxz

Fix for PR24072:

X86 instructions jrcxz/jecxz/jcxz performs short jumps if rcx/ecx/cx register is 0
The maximum relative offset for a forward short jump is 127 Bytes (0x7F).
The maximum relative offset for a backward short jump is 128 Bytes (0x80).

Gnu assembler warns when the distance of the jump exceeds the maximum but llvm-as does not.

Patch by Konstantin Belochapka and Alexey Lapshin

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

4 years ago[lldb][NFC] Extract enum parsing from DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 11:21:31 +0000 (12:21 +0100)]
[lldb][NFC] Extract enum parsing from DWARFASTParserClang::ParseTypeFromDWARF

Part of the work to split up this monolithic parsing function.

4 years ago[lldb][NFCI] Extract subroutine parsing from DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 10:54:30 +0000 (11:54 +0100)]
[lldb][NFCI] Extract subroutine parsing from DWARFASTParserClang::ParseTypeFromDWARF

Part of the work to split up this monolithic parsing function.

Should be NFC but due to the kafkaesque control flow in this case statement this might
have some unintended side effects.

4 years ago[lldb][NFC] Extract array type parsing from DWARFASTParserClang::ParseTypeFromDWARF
Raphael Isemann [Tue, 26 Nov 2019 10:27:22 +0000 (11:27 +0100)]
[lldb][NFC] Extract array type parsing from DWARFASTParserClang::ParseTypeFromDWARF

Part of the work to split up this monolithic parsing function.

4 years ago[OpenCL] Add work-group and miscellaneous vector builtin functions
Sven van Haastregt [Tue, 26 Nov 2019 10:44:49 +0000 (10:44 +0000)]
[OpenCL] Add work-group and miscellaneous vector builtin functions

Add the work-group and miscellaneous vector builtin functions from the
OpenCL C specification.

Patch by Pierre Gondois and Sven van Haastregt.

4 years ago[AArch64][SVE] Implement floating-point conversion intrinsics
Kerry McLaughlin [Tue, 26 Nov 2019 10:21:20 +0000 (10:21 +0000)]
[AArch64][SVE] Implement floating-point conversion intrinsics

Summary:
Adds intrinsics for the following:
  - fcvt
  - fcvtzs & fcvtzu
  - scvtf & ucvtf
  - fcvtlt, fcvtnt
  - fcvtx & fcvtxnt

Reviewers: huntergr, sdesmalen, dancgr, mgudim, efriedma

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[ARM][ReachingDefs] Remove dead code in loloops.
Sam Parker [Tue, 26 Nov 2019 10:25:04 +0000 (10:25 +0000)]
[ARM][ReachingDefs] Remove dead code in loloops.

Add some more helper functions to ReachingDefs to query the uses of
a given MachineInstr and also to query whether two MachineInstrs use
the same def of a register.

For Arm, while tail-predicating, these helpers are used in the
low-overhead loops to remove the dead code that calculates the number
of loop iterations.

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

4 years ago[SystemZ] Don't build a PPA instruction with an immediate 0 operand.
Jonas Paulsson [Tue, 26 Nov 2019 10:16:48 +0000 (11:16 +0100)]
[SystemZ]  Don't build a PPA instruction with an immediate 0 operand.

The improvement in the machine verifier for operand types (D63973) discovered
a bad operand in a test using a PPA instruction. It was an immediate 0 where
a register was expected.

This patch fixes this (NFC) by now making the PPA second register operand
NoRegister instead of a zero immediate in the MIR.

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

4 years ago[ARM][ReachingDefs] RDA in LoLoops
Sam Parker [Tue, 26 Nov 2019 10:03:25 +0000 (10:03 +0000)]
[ARM][ReachingDefs] RDA in LoLoops

Add several new methods to ReachingDefAnalysis:
- getReachingMIDef, instead of returning an integer, return the
  MachineInstr that produces the def.
- getInstFromId, return a MachineInstr for which the given integer
  corresponds to.
- hasSameReachingDef, return whether two MachineInstr use the same
  def of a register.
- isRegUsedAfter, return whether a register is used after a given
  MachineInstr.

These methods have been used in ARMLowOverhead to replace searching
for uses/defs.

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

4 years ago[lldb][NFC] Extract pointer to member type parsing from DWARFASTParserClang::ParseTyp...
Raphael Isemann [Tue, 26 Nov 2019 09:45:35 +0000 (10:45 +0100)]
[lldb][NFC] Extract pointer to member type parsing from DWARFASTParserClang::ParseTypeFromDWARF

Part of the work to split up this monolithic parsing function.

4 years ago[InstCombine] Fixed std::min on some bots. NFCI
Dávid Bolvanský [Tue, 26 Nov 2019 10:06:06 +0000 (11:06 +0100)]
[InstCombine] Fixed std::min on some bots. NFCI

4 years ago[ARM][ConstantIslands] Correct block size update
Sam Parker [Thu, 21 Nov 2019 14:29:15 +0000 (14:29 +0000)]
[ARM][ConstantIslands] Correct block size update

When inserting a non-decrementing LE, the basic block was being
resized to take into consideration that a tCMP and tBcc had been
combined into one T1 instruction. This is not true in the LE case
where we generate a CBN?Z and an LE.

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

4 years ago[InstCombine] Optimize some memccpy calls to memcpy/null
Dávid Bolvanský [Mon, 25 Nov 2019 19:15:25 +0000 (20:15 +0100)]
[InstCombine] Optimize some memccpy calls to memcpy/null

Summary:
return memccpy(d, "helloworld", 'r', 20)
=>
return memcpy(d, "helloworld", 8 /* pos of 'r' in string */), d + 8

Reviewers: efriedma, jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] NULL -> nullptr in DWARFASTParserClang::UpdateSymbolContextScopeForType
Raphael Isemann [Mon, 25 Nov 2019 13:44:51 +0000 (14:44 +0100)]
[lldb][NFC] NULL -> nullptr in DWARFASTParserClang::UpdateSymbolContextScopeForType

4 years agoRecommit ARM-NEON: make type modifiers orthogonal and allow multiple modifiers.
Tim Northover [Fri, 11 Oct 2019 12:46:47 +0000 (13:46 +0100)]
Recommit ARM-NEON: make type modifiers orthogonal and allow multiple modifiers.

The modifier system used to mutate types on NEON intrinsic definitions had a
separate letter for all kinds of transformations that might be needed, and we
were quite quickly running out of letters to use. This patch converts to a much
smaller set of orthogonal modifiers that can be applied together to achieve the
desired effect.

When merging with downstream it is likely to cause a conflict with any local
modifications to the .td files. There is a new script in
utils/convert_arm_neon.py that was used to convert all .td definitions and I
would suggest running it on the last downstream version of those files before
this commit rather than resolving conflicts manually.

The original version broke vcreate_* because it became a macro and didn't
apply the normal integer promotion rules before bitcasting to a vector.
This adds a temporary.

4 years agoclang-format-vs : Fix typo NUGET_EXE_DIR on README
Hans Wennborg [Tue, 26 Nov 2019 09:16:06 +0000 (10:16 +0100)]
clang-format-vs : Fix typo NUGET_EXE_DIR on README

Match with the CMake variable.

Patch by empty2fill!

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

4 years ago[clangd] Implement cross-file rename.
Haojian Wu [Wed, 23 Oct 2019 12:40:20 +0000 (14:40 +0200)]
[clangd] Implement cross-file rename.

Summary:
This is the initial version. The cross-file rename is purely based on
the index.

It is hidden under a command-line flag, and only available for a small set
of symbols.

Reviewers: ilya-biryukov, sammccall

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

Tags: #clang

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

4 years ago[LLD][ELF] - Make compression level be dependent on -On.
Georgii Rymar [Mon, 25 Nov 2019 09:39:03 +0000 (12:39 +0300)]
[LLD][ELF] - Make compression level be dependent on -On.

Currently LLD always use zlib compression level 6.
This patch changes it to use 1 for -O0, -O1 and 6 for -O2.

It fixes https://bugs.llvm.org/show_bug.cgi?id=44089.

There was also a thread in llvm-dev on this topic:
https://lists.llvm.org/pipermail/llvm-dev/2018-August/125020.html

Here is a table with results of building clang mentioned there:

```
Level   Time            Size
0       0m17.128s       2045081496   Z_NO_COMPRESSION
1       0m31.471s       922618584    Z_BEST_SPEED
2       0m32.659s       903642376
3       0m36.749s       890805856
4       0m41.532s       876697184
5       0m48.383s       862778576
6       1m3.176s        855251640    Z_DEFAULT_COMPRESSION
7       1m15.335s       853755920
8       2m0.561s        852497560
9       2m33.972s       852397408    Z_BEST_COMPRESSION
```

It shows that it is probably not reasonable to use values greater than 6.

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

4 years ago[Attributor] Track a GEP Instruction in align deduction
Hideto Ueno [Tue, 26 Nov 2019 07:51:59 +0000 (07:51 +0000)]
[Attributor] Track a GEP Instruction in align deduction

Summary:
This patch enables us to track GEP instruction in align deduction.
If a pointer `B` is defined as `A+Offset` and known to have alignment `C`, there exists some integer Q such that
```
 A + Offset = C * Q = B
```
 So we can say that the maximum power of two which is a divisor of gcd(Offset, C) is an alignment.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Return Op instead of SDValue() for lowering flags_read/write intrinsics
Craig Topper [Tue, 26 Nov 2019 07:07:43 +0000 (23:07 -0800)]
[X86] Return Op instead of SDValue() for lowering flags_read/write intrinsics

Returning SDValue() means we didn't handle it and the common
code should try to expand it. But its a target intrinsic so
expanding won't do anything and just leave the node alone. But
it will print confusing debug messages.

By returning Op we tell the common code that the node is legal
and shouldn't receive any further processing.

4 years ago[ELF] Support input section description .rel[a].dyn in /DISCARD/
Fangrui Song [Mon, 25 Nov 2019 21:24:18 +0000 (13:24 -0800)]
[ELF] Support input section description .rel[a].dyn in /DISCARD/

Reviewed By: ruiu

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

4 years ago[X86] Updated strict fp scalar tests and add fp80 tests for D68857, NFC.
Wang, Pengfei [Tue, 26 Nov 2019 05:40:28 +0000 (13:40 +0800)]
[X86] Updated strict fp scalar tests and add fp80 tests for D68857, NFC.

4 years ago[BPF] add "llvm." prefix to BPF internally created globals
Yonghong Song [Tue, 26 Nov 2019 00:31:33 +0000 (16:31 -0800)]
[BPF] add "llvm." prefix to BPF internally created globals

Currently, BPF backend creates some global variables with name like
  <type_name>:<reloc_type>:<patch_imm>$<access_str>
to carry certain information to BPF backend.

With direct clang compilation, the following code in
   llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
is triggered and the above globals are emitted to the ELF file.
(clang enabled this as opt flag -faddrsig is on by default.)
   if (TM.Options.EmitAddrsig) {
    // Emit address-significance attributes for all globals.
    OutStreamer->EmitAddrsig();
    for (const GlobalValue &GV : M.global_values())
      if (!GV.use_empty() && !GV.isThreadLocal() &&
          !GV.hasDLLImportStorageClass() && !GV.getName().startswith("llvm.") &&
          !GV.hasAtLeastLocalUnnamedAddr())
        OutStreamer->EmitAddrsigSym(getSymbol(&GV));
  }
...
 10162: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND tcp_sock:0:2048$0:117
 10163: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND tcp_sock:0:2112$0:126:0
 10164: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT   UND tcp_sock:1:8$0:31:6
...
While in llc, those globals are not emited since EmitAddrsig
default option is false for llc. The llc flag "-addrsig" can be used to
enable the above code.

This patch added "llvm." prefix to these internal globals so that
they can be ignored in the above codes and possible other
places.

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

4 years agoRevert "As a follow-up to my initial mail to llvm-dev here's a first pass at the...
Muhammad Omair Javaid [Tue, 26 Nov 2019 04:32:13 +0000 (09:32 +0500)]
Revert "As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there."

This reverts commit 8ff85ed905a7306977d07a5cd67ab4d5a56fafb4.

This commit introduced 9 new failures on lldb buildbot host at http://lab.llvm.org:8014/builders/lldb-aarch64-ubuntu

Following tests were failing:
    lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py
    lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py
    lldb-api :: functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
    lldb-api :: functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
    lldb-api :: functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
    lldb-api :: functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
    lldb-api :: functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py
    lldb-api :: functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
    lldb-api :: functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py
    lldb-api :: functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py

Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65410

4 years ago[LegalizeTypes] Remove code to create ISD::FP_TO_FP16 from SoftenFloatRes_FTRUNC.
Craig Topper [Tue, 26 Nov 2019 02:13:29 +0000 (18:13 -0800)]
[LegalizeTypes] Remove code to create ISD::FP_TO_FP16 from SoftenFloatRes_FTRUNC.

There seems to have been a misunderstanding of what ISD::FTRUNC
represents. ISD::FTRUNC is equivalent to llvm.trunc which takes
a floating point value, truncates it without changing the size
of the value and returns it.

Despite its similar name, its different than the fptrunc instruction
in IR which changes a floating point value to a smaller floating
point value. fptrunc is represented by ISD::FP_ROUND in SelectionDAG.

Since the ISD::FP_TO_FP16 node takes a floating point value and
converts it to f16 its more similar to ISD::FP_ROUND. In fact there
is identical code to what is being removed here in SoftenFloatRes_FP_ROUND.

I assume this bug was never encountered because it would require
f16 to be legalized by softening rather than the default of
promoting.

4 years ago[X86] Add support for STRICT_FP_ROUND/STRICT_FP_EXTEND from/to fp128 to/from f32...
Craig Topper [Tue, 26 Nov 2019 01:14:52 +0000 (17:14 -0800)]
[X86] Add support for STRICT_FP_ROUND/STRICT_FP_EXTEND from/to fp128 to/from f32/f64/f80 in 64-bit mode.

These need to emit a libcall like we do for the non-strict version.

32-bit mode needs to SoftenFloat support to be implemented for strict FP nodes.

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

4 years ago[clang][CodeGen] Fix wrong memcpy size of no_unique_address in FieldMemcpyizer
Senran Zhang [Tue, 26 Nov 2019 02:15:14 +0000 (10:15 +0800)]
[clang][CodeGen] Fix wrong memcpy size of no_unique_address in FieldMemcpyizer

When generating ctor, FieldMemcpyizer wrongly treated zero-sized class members
as what should be copied, and generated wrong memcpy size under some special
circumstances. This patch tries to fix it.

Reviewed By: MaskRay, rjmccall

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

4 years agoRevert "Use InitLLVM to setup a pretty stack printer"
Nico Weber [Tue, 26 Nov 2019 02:06:56 +0000 (21:06 -0500)]
Revert "Use InitLLVM to setup a pretty stack printer"

This reverts commit 3f76260dc0674cc0acb25f550a0f0c594cf537ea.
Breaks at least these tests on Windows:
    Clang :: Driver/clang-offload-bundler.c
    Clang :: Driver/clang-offload-wrapper.c

4 years agoUse InitLLVM to setup a pretty stack printer
Rui Ueyama [Tue, 26 Nov 2019 01:15:47 +0000 (10:15 +0900)]
Use InitLLVM to setup a pretty stack printer

InitLLVM does not only save a few lines from main() but also makes the
commands do the right thing for multibyte character pathnames on
Windows (i.e. canonicalize argv's to UTF-8) because of the code we
have in this file:

https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/InitLLVM.cpp#L32

For many LLVM commands, we already have calls of InitLLVM, but there
are still remainings.

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

4 years agoSpeculative fix for frame-loclist.s test on Windows.
Evgenii Stepanov [Tue, 26 Nov 2019 01:50:02 +0000 (17:50 -0800)]
Speculative fix for frame-loclist.s test on Windows.

"echo -e" treats windows paths as special characters (ex. "\b").

4 years agoAs a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described...
Eric Christopher [Tue, 26 Nov 2019 00:33:19 +0000 (16:33 -0800)]
As a follow-up to my initial mail to llvm-dev here's a first pass at the O1 described there.

This change doesn't include any change to move from selection dag to fast isel
and that will come with other numbers that should help inform that decision.
There also haven't been any real debuggability studies with this pipeline yet,
this is just the initial start done so that people could see it and we could start
tweaking after.

Test updates: Outside of the newpm tests most of the updates are coming from either
optimization passes not run anymore (and without a compelling argument at the moment)
that were largely used for canonicalization in clang.

Original post:

http://lists.llvm.org/pipermail/llvm-dev/2019-April/131494.html

Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65410

4 years ago[X86] Add proper execution domain information to the avx512vnni instructions.
Craig Topper [Tue, 26 Nov 2019 00:56:50 +0000 (16:56 -0800)]
[X86] Add proper execution domain information to the avx512vnni instructions.

4 years ago[X86] Remove forward declaration of _invpcid from intrin.h. Rely on inline version...
Craig Topper [Tue, 26 Nov 2019 00:07:37 +0000 (16:07 -0800)]
[X86] Remove forward declaration of _invpcid from intrin.h. Rely on inline version from immintrin.h

The forward declaration had a cdecl calling convention, but the
inline version did not. This leads to a conflict if the default
calling convention is not cdecl. Fix this by just removing the
forward declaration.

Fixes PR41503

4 years ago[MemorySSA] Combine verifications.
Alina Sbirlea [Fri, 22 Nov 2019 22:12:28 +0000 (14:12 -0800)]
[MemorySSA] Combine verifications.

Summary:
Combine three verification methods into one to improve compile time when asserts are enabled.
Motivated by PR44066.

Sample change of timings on testcase in PR44066 (release+asserts):
MSSA off or verification disabled: 1.13s.
MSSA on (ToT): 2.48s.
With patch: 2.03s.
With enabling DefUses after combining Domination+Ordering: 2.6s.
After also combining DefUses with Domination+Ordering: 2.06s (candidate to be taken out of EXPENSIVE_CHECKS).

Subscribers: Prazek, hiraditya, george.burgess.iv, sanjoy.google, llvm-commits

Tags: #llvm

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

4 years agoFix new llvm-symbolizer tests on Windows.
Evgenii Stepanov [Mon, 25 Nov 2019 23:57:38 +0000 (15:57 -0800)]
Fix new llvm-symbolizer tests on Windows.

A forward-slash vs backward-slash issue.

4 years agogn build: (manually) merge 9e676d9c7e
Nico Weber [Mon, 25 Nov 2019 23:48:10 +0000 (18:48 -0500)]
gn build: (manually) merge 9e676d9c7e

4 years ago[X86] Add test case for pr44140. NFC
Craig Topper [Mon, 25 Nov 2019 22:49:21 +0000 (14:49 -0800)]
[X86] Add test case for pr44140. NFC

4 years agoFix an unused variable warning where a variable was only used in an assert.
Eric Christopher [Mon, 25 Nov 2019 23:27:30 +0000 (15:27 -0800)]
Fix an unused variable warning where a variable was only used in an assert.

4 years agoIRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail.
Peter Collingbourne [Mon, 25 Nov 2019 20:28:11 +0000 (12:28 -0800)]
IRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail.

This has the main effect of causing target-cpu and target-features to be set
on __cfi_check_fail, causing the function to become ABI-compatible with other
functions in the case where these attributes affect ABI (e.g. reserve-x18).

Technically we only need to call SetLLVMFunctionAttributes to get the target-*
attributes set, but since we're creating a definition we probably ought to
call the ForDefinition function as well.

Fixes PR44094.

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

4 years agollvm-symbolizer: fix handling of DW_AT_specification in FRAME.
Evgenii Stepanov [Sat, 23 Nov 2019 02:04:58 +0000 (18:04 -0800)]
llvm-symbolizer: fix handling of DW_AT_specification in FRAME.

Summary:
Use getSubroutineName() to the the subrouting name; this function knows
how to handle cases when DW_TAG_subprogram refers to an earlier
declaration:

0x00000050:     DW_TAG_subprogram
                  DW_AT_linkage_name    ("_ZN1A1fEv")
                  DW_AT_name    ("f")
...
0x00000067:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000000000000)
                DW_AT_high_pc   (0x0000000000000020)
                DW_AT_specification     (0x00000050 "_ZN1A1fEv")
...
0x0000008c:     DW_TAG_variable

Reviewers: pcc, vitalybuka, jdoerfert

Subscribers: srhines, hiraditya, rupprecht, llvm-commits

Tags: #llvm

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

4 years agollvm-symbolizer: Support loclist in FRAME.
Evgenii Stepanov [Thu, 21 Nov 2019 01:02:17 +0000 (17:02 -0800)]
llvm-symbolizer: Support loclist in FRAME.

Summary:
Support location lists in FRAME command.
These are used for the majority of local variables in optimized code.
Also support DW_OP_breg in addition to DW_OP_fbreg when it refers to the
same register as DW_AT_frame_base.

Reviewers: pcc, jdoerfert

Subscribers: srhines, hiraditya, rupprecht, llvm-commits

Tags: #llvm

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

4 years agollvm-symbolizer: Fix FRAME handling of missing AT_name.
Evgenii Stepanov [Fri, 22 Nov 2019 18:56:44 +0000 (10:56 -0800)]
llvm-symbolizer: Fix FRAME handling of missing AT_name.

Summary:
llvm-symbolizer protocol is empty string means end-of-output.
Do not emit empty string when a function or a variable do not have a
name for any reason. Emit "??".

Reviewers: pcc, vitalybuka, jdoerfert

Subscribers: srhines, hiraditya, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[ELF] Delete unused Configuration::zExecstack after D56554
Fangrui Song [Mon, 25 Nov 2019 22:44:01 +0000 (14:44 -0800)]
[ELF] Delete unused Configuration::zExecstack after D56554

4 years agoFix sanitizer-common build with glibc 2.31
Evgenii Stepanov [Mon, 25 Nov 2019 21:52:17 +0000 (13:52 -0800)]
Fix sanitizer-common build with glibc 2.31

Summary:
As mentioned in D69104, glibc changed ABI recently with the [[ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2f959dfe849e0646e27403f2e4091536496ac0f02f959dfe ]] change.
D69104 dealt with just 32-bit ARM, but that is just one of the many affected architectures.
E.g. x86_64, i?86, riscv64, sparc 32-bit, s390 31-bit are affected too (and various others).

This patch instead of adding a long list of further architectures that wouldn't be checked ever next to arm 32-bit changes the structures to match the 2.31 layout and performs the checking on Linux for ipc_perm mode position/size only on non-Linux or on Linux with glibc 2.31 or later.  I think this matches what is done for aarch64 already.
If needed, we could list architectures that haven't changed ABI (e.g. powerpc), so that they would be checked even with older glibcs.  AFAIK sanitizers don't actually use ipc_perm.mode and
so all they care about is the size and alignment of the whole structure.

Note, s390 31-bit and arm 32-bit big-endian changed ABI even further, there will now be shmctl with old symbol version and shmctl@@GLIBC_2.31 which will be incompatible.  I'm afraid this isn't really solvable unless the sanitizer libraries are symbol versioned and use matching symbol versions to glibc symbols for stuff they intercept, plus use dlvsym.
This patch doesn't try to address that.

Patch by Jakub Jelinek.

Reviewers: kcc, eugenis, dvyukov

Reviewed By: eugenis

Subscribers: jyknight, kristof.beyls, fedor.sergeev, simoncook, PkmX, s.egerton, steven.zhang, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agoDisallow use of __has_c_attribute in C++ mode.
Aaron Ballman [Mon, 25 Nov 2019 22:32:07 +0000 (17:32 -0500)]
Disallow use of __has_c_attribute in C++ mode.

__has_cpp_attribute is not available in C mode, and __has_c_attribute
should not be available in C++ mode. This also adds a test to
demonstrate that we properly handle scoped attribute tokens even in C
mode.

4 years ago[DAGCombiner] avoid crash on out-of-bounds insert index (PR44139)
Sanjay Patel [Mon, 25 Nov 2019 21:07:10 +0000 (16:07 -0500)]
[DAGCombiner] avoid crash on out-of-bounds insert index (PR44139)

We already have this simplification at node-creation-time, but
the test from:
https://bugs.llvm.org/show_bug.cgi?id=44139
...shows that we can combine our way to an assert/crash too.

4 years agoRevert "[Diagnostic] add a warning which warns about misleading indentation"
Tom Stellard [Mon, 25 Nov 2019 20:30:35 +0000 (12:30 -0800)]
Revert "[Diagnostic] add a warning which warns about misleading indentation"

This reverts commit 7b86188b50bf6e537fe98b326f258fbd23108b83.

This commit introduced bot falures for multi-stage bots with -Werror.

4 years agoRevert "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy"
Tom Stellard [Mon, 25 Nov 2019 20:23:32 +0000 (12:23 -0800)]
Revert "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy"

This reverts commit 9353c5dd0664ea444236e527bf93566e11dc34df.

This commit introduced bot falures for multi-stage bots with -Werror.

4 years agoRevert "[DDG] Data Dependence Graph - Topological Sort"
Bardia Mahjour [Mon, 25 Nov 2019 21:17:41 +0000 (16:17 -0500)]
Revert "[DDG] Data Dependence Graph - Topological Sort"
Revert for now to look into the failures  on x86

This reverts commit bec37c3fc766a7b97f8c52c181c325fd47b75259.

4 years ago[PowerPC][compiler-rt][builtins]Add __fixtfti builtin on PowerPC
Lei Huang [Mon, 25 Nov 2019 20:06:21 +0000 (14:06 -0600)]
[PowerPC][compiler-rt][builtins]Add __fixtfti builtin on PowerPC

Implements __fixtfti builtin for PowerPC. This builtin converts a
long double (IBM double-double) to a signed int128. The conversion relies on
the unsigned conversion of the absolute value of the long double.

Tests included for both positive and negative long doubles.

Patch By: Baptiste Saleil

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

4 years ago[GWP-ASan] Add GWP_ASAN_ prefix to macros.
Mitch Phillips [Mon, 25 Nov 2019 20:25:43 +0000 (12:25 -0800)]
[GWP-ASan] Add GWP_ASAN_ prefix to macros.

Summary:
When platforms use their own `LIKELY()` definitions, it can be quite
troublesome to ensure they don't conflict with the GWP-ASan internal
definitions. Just force the GWP_ASAN_ prefix to help this issue.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: #sanitizers, llvm-commits, cferris, pcc

Tags: #sanitizers, #llvm

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

4 years ago[PowerPC] Rename DarwinDirective to CPUDirective (NFC)
Kit Barton [Fri, 15 Nov 2019 21:48:34 +0000 (15:48 -0600)]
[PowerPC] Rename DarwinDirective to CPUDirective (NFC)

Summary:
This patch renames the DarwinDirective (used to identify which CPU was defined)
to CPUDirective. It also adds the getCPUDirective() method and replaces all uses
of getDarwinDirective() with getCPUDirective().

Once this patch lands and downstream users of the getDarwinDirective() method
have switched to the getCPUDirective() method, the old getDarwinDirective()
method will be removed.

Reviewers: nemanjai, hfinkel, power-llvm-team, jsji, echristo, #powerpc, jhibbits

Reviewed By: hfinkel, jsji, jhibbits

Subscribers: hiraditya, shchenz, llvm-commits

Tags: #llvm

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

4 years ago[LLD] Add a default copy constructor to avoid warnings
Nemanja Ivanovic [Mon, 25 Nov 2019 20:07:57 +0000 (14:07 -0600)]
[LLD] Add a default copy constructor to avoid warnings

This should fix the failure on the PPC64LE LLD bot.

4 years ago[OPENMP]Fix PR41826: symbols visibility in device code.
Alexey Bataev [Thu, 21 Nov 2019 16:30:43 +0000 (11:30 -0500)]
[OPENMP]Fix PR41826: symbols visibility in device code.

Summary:
Currently, we ignore all locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds. But in some
cases changing of dso locality may lead to problems with codegen, so
instead mark external symbols as hidden instead in the device code.

Reviewers: jdoerfert

Subscribers: guansong, caomhin, kkwli0, cfe-commits

Tags: #clang

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

4 years ago[Diagnostic] add a warning which warns about misleading indentation
Tyker [Mon, 25 Nov 2019 19:46:32 +0000 (20:46 +0100)]
[Diagnostic] add a warning which warns about misleading indentation

Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation

Reviewers: aaron.ballman, xbolva00

Reviewed By: aaron.ballman, xbolva00

Subscribers: arphaman, Ka-Ka, thakis

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

4 years ago[lldb] [Process/NetBSD] Fix handling concurrent watchpoint events
Michał Górny [Fri, 8 Nov 2019 17:42:37 +0000 (18:42 +0100)]
[lldb] [Process/NetBSD] Fix handling concurrent watchpoint events

Fix handling concurrent watchpoint events so that they are reported
correctly in LLDB.

If multiple watchpoints are hit concurrently, the NetBSD kernel reports
them as series of SIGTRAPs with a thread specified, and the debugger
investigates DR6 in order to establish which watchpoint was hit.  This
is normally fine.

However, LLDB disables and reenables the watchpoint on all threads after
each hit, which results in the hit status from DR6 being wiped.
As a result, it can't establish which watchpoint was hit in successive
SIGTRAP processing.

In order to workaround this problem, clear DR6 only if the breakpoint
is overwritten with a new one.  More specifically, move cleaning DR6
from ClearHardwareWatchpoint() to SetHardwareWatchpointWithIndex(),
and do that only if the newly requested watchpoint is different
from the one being set previously.  This ensures that the disable-enable
logic of LLDB does not clear watchpoint hit status for the remaining
threads.

This also involves refactoring of watchpoint logic.  With the old logic,
clearing watchpoint involved wiping dr6 & dr7, and setting it setting
dr{0..3} & dr7.  With the new logic, only enable bit is cleared
from dr7, and the remaining bits are cleared/overwritten while setting
new watchpoint.

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

4 years ago[lldb] [Process/NetBSD] Copy watchpoints to newly-created threads
Michał Górny [Sat, 9 Nov 2019 10:56:08 +0000 (11:56 +0100)]
[lldb] [Process/NetBSD] Copy watchpoints to newly-created threads

NetBSD ptrace interface does not populate watchpoints to newly-created
threads.  Solve this via copying the watchpoints from the current thread
when new thread is reported via TRAP_LWP.

Add a test that verifies that when the user does not have permissions
to set watchpoints on NetBSD, the 'watchpoint set' errors out gracefully
and thread monitoring does not crash on being unable to copy watchpoints
to new threads.

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

4 years ago[lldb] [Process/NetBSD] Improve threading support
Michał Górny [Fri, 12 Jul 2019 17:11:31 +0000 (19:11 +0200)]
[lldb] [Process/NetBSD] Improve threading support

Implement major improvements to multithreaded program support.  Notably,
support tracking new and exited threads, associate signals and events
with correct threads and support controlling individual threads when
resuming.

Firstly, use PT_SET_EVENT_MASK to enable reporting of created and exited
threads via SIGTRAP.  Handle TRAP_LWP events to keep track
of the currently running threads.

Secondly, update the signal (both generic and SIGTRAP) handling code
to account for per-thread signals correctly.  Signals delivered
to the whole process are reported on all threads, while per-thread
signals and events are reported only to the specific thread.
The remaining threads are marked as 'stopped with no reason'.  Note that
NetBSD always stops all threads on debugger events.

Thirdly, implement the ability to set every thread as running, stopped
or single-stepping separately while continuing the process.  This also
provides the ability to send a signal to the whole process or to one
of its thread while resuming.

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

4 years ago[libcxx] Omit unneeded locale fallbacks on Android 21+
Shoaib Meenai [Fri, 8 Nov 2019 03:55:58 +0000 (19:55 -0800)]
[libcxx] Omit unneeded locale fallbacks on Android 21+

Android API level 21 and above have all these functions available, so we
don't need to include our fallback definitions.

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

4 years ago[lldb] [test] XFAIL ASAN tests on NetBSD
Michał Górny [Mon, 25 Nov 2019 19:03:41 +0000 (20:03 +0100)]
[lldb] [test] XFAIL ASAN tests on NetBSD

4 years ago[TargetLowering] Merge ExpandChainLibCall with makeLibCall
Craig Topper [Mon, 25 Nov 2019 18:48:28 +0000 (10:48 -0800)]
[TargetLowering] Merge ExpandChainLibCall with makeLibCall

I need to be able to drop an operand for STRICT_FP_ROUND handling on X86. Merging these functions gives me the ArrayRef interface that passes the return type, operands, and debugloc instead of the Node.

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

4 years ago[InstCombine] remove shuffle mask canonicalization that creates undef elements
Sanjay Patel [Mon, 25 Nov 2019 18:30:45 +0000 (13:30 -0500)]
[InstCombine] remove shuffle mask canonicalization that creates undef elements

This is NFC-intended because SimplifyDemandedVectorElts() does the same
transform later. As discussed in D70641, we may want to change that
behavior, so we need to isolate where it happens.

4 years ago[WebAssembly] Change the llvm-lto dir to use the LLVM Version
Dan Gohman [Mon, 25 Nov 2019 17:28:31 +0000 (09:28 -0800)]
[WebAssembly] Change the llvm-lto dir to use the LLVM Version

Using the version instead of the VCS revision, which isn't available
when LLVM_APPEND_VC_REV is set. The bitcode format should be
backwards-compatible at least within a minor version, so the version
string should be sufficient.

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

4 years ago[ARM] Generate CMSE instructions from CMSE intrinsics
Momchil Velikov [Mon, 18 Nov 2019 18:03:41 +0000 (18:03 +0000)]
[ARM] Generate CMSE instructions from CMSE intrinsics

This patch adds instruction selection patterns for the TT, TTT, TTA, and TTAT
instructions and tests for llvm.arm.cmse.tt, llvm.arm.cmse.ttt,
llvm.arm.cmse.tta, and llvm.arm.cmse.ttat intrinsics (added in a previous
patch).

Patch by Javed Absar.

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

4 years ago[SystemZ] Return the right offsets from getCalleeSavedSpillSlots().
Jonas Paulsson [Mon, 25 Nov 2019 17:48:47 +0000 (18:48 +0100)]
[SystemZ]  Return the right offsets from getCalleeSavedSpillSlots().

// Due to the SystemZ ABI, the DWARF CFA (Canonical Frame Address) is not
// equal to the incoming stack pointer, but to incoming stack pointer plus
// 160.  The getOffsetOfLocalArea() returned value is interpreted as "the
// offset of the local area from the CFA".

The immediate offsets into the Register save area returned by
getCalleeSavedSpillSlots() should take this offset into account, which this
patch makes sure of.

Patch and review by Ulrich Weigand.
https://reviews.llvm.org/D70427

4 years ago[NFC][LoopFusion] Use isControlFlowEquivalent() from CodeMoverUtils.
Whitney Tsang [Mon, 25 Nov 2019 17:51:24 +0000 (17:51 +0000)]
[NFC][LoopFusion] Use isControlFlowEquivalent() from CodeMoverUtils.
Reviewer: kbarton, jdoerfert, Meinersbur, bmahjour, etiotto
Reviewed By: Meinersbur
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D70619

4 years ago[PowerPC] Fix VSX clobbers of CSR registers
Nemanja Ivanovic [Mon, 25 Nov 2019 15:32:28 +0000 (09:32 -0600)]
[PowerPC] Fix VSX clobbers of CSR registers

If an inline asm statement clobbers a VSX register that overlaps with a
callee-saved Altivec register or FPR, we will not record the clobber and will
therefore violate the ABI. This is clearly a bug so this patch fixes it.

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

4 years ago[InstCombine] prevent infinite loop from conflicting shuffle mask transforms
Sanjay Patel [Mon, 25 Nov 2019 16:55:57 +0000 (11:55 -0500)]
[InstCombine] prevent infinite loop from conflicting shuffle mask transforms

The pattern in question is currently not possible because we
aggressively (wrongly) transform mask elements to undef values
if they choose from an undef operand. That, however, would
change if we tighten our semantics for shuffles as discussed
in D70641. Adding this check gives us the flexibility to make
that change with minimal overhead for current definitions.

4 years ago[scudo][standalone] Fix for releaseToOS prior to init
Kostya Kortchinsky [Thu, 21 Nov 2019 18:57:49 +0000 (10:57 -0800)]
[scudo][standalone] Fix for releaseToOS prior to init

Summary:
cferris@ found an issue where calling `releaseToOS` prior to any other
heap operation would lead to a crash, due to the allocator not being
properly initialized (it was discovered via `mallopt`).

The fix is to call `initThreadMaybe` prior to calling `releaseToOS` for
the Primary.

Add a test that crashes prior to fix.

Reviewers: hctim, cferris, pcc, eugenis

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[DDG] Data Dependence Graph - Topological Sort
bmahjour [Mon, 25 Nov 2019 16:12:37 +0000 (11:12 -0500)]
[DDG] Data Dependence Graph - Topological Sort

Summary:
In this patch the DDG DAG is sorted topologically to put the
nodes in the graph in the order that would satisfy all
dependencies. This helps transformations that would like to
generate code based on the DDG. Since the DDG is a DAG a
reverse-post-order traversal would give us the topological
ordering. This patch also sorts the basic blocks passed to
the builder based on program order to ensure that the
dependencies are computed in the correct direction.

Authored By: bmahjour

Reviewer: Meinersbur, fhahn, myhsu, xtian, dmgreen, kbarton, jdoerfert

Reviewed By: Meinersbur

Subscribers: ychen, arphaman, simoll, a.elovikov, mgorny, hiraditya, jfb, wuzish, llvm-commits, jsji, Whitney, etiotto, ppc-slack

Tags: #llvm

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

4 years ago[InstCombine] simplify code for shuffle mask canonicalization; NFC
Sanjay Patel [Mon, 25 Nov 2019 16:11:12 +0000 (11:11 -0500)]
[InstCombine] simplify code for shuffle mask canonicalization; NFC

We never use the local 'Mask' before returning, so that was dead code.

4 years ago[InstCombine] remove dead code from shuffle mask canonicalization; NFC
Sanjay Patel [Mon, 25 Nov 2019 15:54:18 +0000 (10:54 -0500)]
[InstCombine] remove dead code from shuffle mask canonicalization; NFC

4 years ago[InstCombine] simplify loop for shuffle mask canonicalization; NFC
Sanjay Patel [Mon, 25 Nov 2019 15:40:21 +0000 (10:40 -0500)]
[InstCombine] simplify loop for shuffle mask canonicalization; NFC

4 years agoRevert 3f91705ca54 "ARM-NEON: make type modifiers orthogonal and allow multiple modif...
Hans Wennborg [Mon, 25 Nov 2019 15:27:53 +0000 (16:27 +0100)]
Revert 3f91705ca54 "ARM-NEON: make type modifiers orthogonal and allow multiple modifiers."

This broke the vcreate_u64 intrinsic. Example:

  $ cat /tmp/a.cc
  #include <arm_neon.h>

  void g() {
    auto v = vcreate_u64(0);
  }
  $ bin/clang -c /tmp/a.cc --target=arm-linux-androideabi16 -march=armv7-a
  /tmp/a.cc:4:12: error: C-style cast from scalar 'int' to vector 'uint64x1_t' (vector of 1 'uint64_t' value) of different size
    auto v = vcreate_u64(0);
             ^~~~~~~~~~~~~~
  /work/llvm.monorepo/build.release/lib/clang/10.0.0/include/arm_neon.h:4144:11: note: expanded from macro 'vcreate_u64'
    __ret = (uint64x1_t)(__p0); \
            ^~~~~~~~~~~~~~~~~~

Reverting until this can be investigated.

> The modifier system used to mutate types on NEON intrinsic definitions had a
> separate letter for all kinds of transformations that might be needed, and we
> were quite quickly running out of letters to use. This patch converts to a much
> smaller set of orthogonal modifiers that can be applied together to achieve the
> desired effect.
>
> When merging with downstream it is likely to cause a conflict with any local
> modifications to the .td files. There is a new script in
> utils/convert_arm_neon.py that was used to convert all .td definitions and I
> would suggest running it on the last downstream version of those files before
> this commit rather than resolving conflicts manually.