platform/upstream/llvm.git
4 years ago[PowerPC] Regenerate f128 test to fix issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 16:00:17 +0000 (17:00 +0100)]
[PowerPC] Regenerate f128 test to fix issue reported on D77354

I had to manually edit the file as the update script won't strip checks that don't have the ":" immediately after the prefix

4 years agoInstCombine: Reduce minnum/maxnum if inputs are casted
Matt Arsenault [Fri, 3 Apr 2020 15:09:19 +0000 (11:09 -0400)]
InstCombine: Reduce minnum/maxnum if inputs are casted

4 years ago[ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections
Fangrui Song [Fri, 3 Apr 2020 05:10:43 +0000 (22:10 -0700)]
[ELF] Allow invalid sh_size%sh_entsize!=0 for non-SHF_MERGE sections

Fixes https://bugs.llvm.org/show_bug.cgi?id=45370
Fixes https://github.com/Clozure/ccl/issues/273

.stab holds a table of 12-byte entries. GNU as before 2.35 incorrectly
sets sh_entsize(.stab) to 20 on 64-bit architectures:
https://sourceware.org/bugzilla/show_bug.cgi?id=25768

We should not emit the confusing error:
"SHF_MERGE section size (...) must be a multiple of sh_entsize (20)

Reviewed By: grimar, psmith

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

4 years ago[X86] Remove defunct section checks from emulated TLS tests to fix issue reported...
Simon Pilgrim [Fri, 3 Apr 2020 15:45:56 +0000 (16:45 +0100)]
[X86] Remove defunct section checks from emulated TLS tests to fix issue reported on D77354

4 years ago[libc++] Add an alternative Lit test format
Louis Dionne [Mon, 30 Mar 2020 20:25:24 +0000 (16:25 -0400)]
[libc++] Add an alternative Lit test format

This new test format is simpler and more flexible. It creates Lit ShTests
on the fly that reuse existing substitutions (like %{cxx}) instead of
having complex logic in Python to run the tests. This has the benefit
that virtually no coding is required to customize how the test suite is
run -- one can achieve pretty much anything by defining the appropriate
substitutions in a simple lit.cfg file.

For example, in order to run the tests on an embedded device after
building with a specific SDK, one can set the %{cxx} and %{compile_flags}
substitutions to use that SDK, and the %{exec} substitution to the ssh.py
script currently used for .sh.cpp tests with a remote executor. Dealing with
the SSHExecutor becomes unnecessary, since all tests are treated like ShTests.

As a side effect of this design, configuration files for the test
suite can be as simple as:

config.substitutions.append(('%{cxx}', '<path-to-compiler>'))
config.substitutions.append(('%{compile_flags}', '<flags>'))
config.substitutions.append(('%{link_flags}', '<flags>'))
config.substitutions.append(('%{exec}', '<script-to-execute>'))

This should allow storing lit.cfg files for various configurations
directly in the repository instead of relying on complicated logic
in config.py to set up the right flags. I've found numerous problems
in that logic in the past years, and it seems like having simple and
explicit configuration files for the configurations we support is
going to solve most of these problems. Specifically, I am hoping to
store configuration files for testing other Standard Libraries in
the repository.

Improving the interaction with the test suite configuration is still a
work in progress, so for now this test format reuses the substitutions and
available features that are set up by the current config.py.

This new test format should support pretty much everything that the current
test format supports, however it will not be enabled by default at first to
make sure we're satisfied with it. For a short period of time, the new format
will require `--param=use_new_format=True` to be enabled, however it is a very
short term goal to replace the current testing format entirely and to simplify
the configuration accordingly.

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

4 years ago[AST] clang::VectorType supports any size (that fits in unsigned)
Sam McCall [Thu, 2 Apr 2020 20:53:01 +0000 (22:53 +0200)]
[AST] clang::VectorType supports any size (that fits in unsigned)

Summary:
This matches llvm::VectorType.
It moves the size from the type bitfield into VectorType, increasing size by 8
bytes (including padding of 4). This is OK as we don't expect to create terribly
many of these types.

c.f. D77313 which enables large power-of-two sizes without growing VectorType.

Reviewers: efriedma, hokein

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[MSan] Add COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED
Ilya Leoshkevich [Fri, 3 Apr 2020 13:15:06 +0000 (15:15 +0200)]
[MSan] Add COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED

Summary:
MSan not implementing COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED looks
like an omission - this macro makes it possible for those intercepted
functions, which libc needs very early, to work before interceptors are
initialized (i.e. before REAL() is usable).

While currently there are no observable practical problems in this
area, changes in libc or in MSan runtime may provoke them. Therefore,
change MSan to work like ASan and TSan already do - use internal
functions in certain interceptors when initialization is not complete.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[X86] Fix weak global label issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 15:14:47 +0000 (16:14 +0100)]
[X86] Fix weak global label issue reported on D77354

4 years ago[X86] Fix gisel copy tests to fix issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 15:09:17 +0000 (16:09 +0100)]
[X86] Fix gisel copy tests to fix issue reported on D77354

4 years ago[X86] Fix strong local function/global label issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 14:37:18 +0000 (15:37 +0100)]
[X86] Fix strong local function/global label issue reported on D77354

4 years ago[X86] Cleanup emulated TLS test checks. NFC
Simon Pilgrim [Fri, 3 Apr 2020 14:15:17 +0000 (15:15 +0100)]
[X86] Cleanup emulated TLS test checks. NFC

4 years ago[LoopOps] Return ArrayRefs from accessors instead of iterator_ranges
Benjamin Kramer [Fri, 3 Apr 2020 15:12:40 +0000 (17:12 +0200)]
[LoopOps] Return ArrayRefs from accessors instead of iterator_ranges

Same funcitonality, but a bit friendlier for users passing it along to
APIs that take ArrayRefs.

4 years ago[libc++] Fix is_pointer support for Objective-C++
Louis Dionne [Fri, 3 Apr 2020 15:06:26 +0000 (11:06 -0400)]
[libc++] Fix is_pointer support for Objective-C++

This test regressed with 5ade17e0ca8b, but we never noticed it because
.pass.mm tests were skipped due to a bug in our Lit config. This commit
fixes is_pointer (by essentially reverting tha part of 5ade17e0ca8b) and
also adds .pass.mm tests to the list of supported test suffixes.

We can explore how to support __is_pointer with Objective-C++ qualifiers
as a follow-up -- the main goal of this commit is to fix the regression
quickly and make sure all tests of the suite are run.

4 years ago[Alignment][NFC] Remove documentation and FIXME for deprecated functions
Guillaume Chatelet [Fri, 3 Apr 2020 14:16:09 +0000 (14:16 +0000)]
[Alignment][NFC] Remove documentation and FIXME for deprecated functions

4 years ago[libc++] Add REQUIRES for tests that need -fblocks and -fobjc-arc
Louis Dionne [Thu, 2 Apr 2020 22:28:21 +0000 (18:28 -0400)]
[libc++] Add REQUIRES for tests that need -fblocks and -fobjc-arc

AppleClang seems to support these extensions by default, but other
compilers don't.

4 years agoFix __builtin_amdgcn_workgroup_size_x/y/z return type
Yaxun (Sam) Liu [Fri, 3 Apr 2020 13:24:58 +0000 (09:24 -0400)]
Fix __builtin_amdgcn_workgroup_size_x/y/z return type

https://reviews.llvm.org/D77390

4 years ago[X86] Regenerate soft fp legalization test to fix issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 13:55:13 +0000 (14:55 +0100)]
[X86] Regenerate soft fp legalization test to fix issue reported on D77354

4 years ago[X86] Regenerate stack clash test to fix issue reported on D77354
Simon Pilgrim [Fri, 3 Apr 2020 13:52:24 +0000 (14:52 +0100)]
[X86] Regenerate stack clash test to fix issue reported on D77354

4 years ago[Hexagon] Fix issue with non-preemptible STT_TLS symbols
Sid Manning [Thu, 2 Apr 2020 17:08:53 +0000 (12:08 -0500)]
[Hexagon] Fix issue with non-preemptible STT_TLS symbols

A PC-relative relocation referencing a non-preemptible absolute symbol
(due to STT_TLS) is not representable in -pie/-shared mode.

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

4 years ago[gn build] Port d65557d15d4
LLVM GN Syncbot [Fri, 3 Apr 2020 13:41:09 +0000 (13:41 +0000)]
[gn build] Port d65557d15d4

4 years ago[clangd] Enable some nice clang-tidy checks by default.
Sam McCall [Thu, 2 Apr 2020 23:41:40 +0000 (01:41 +0200)]
[clangd] Enable some nice clang-tidy checks by default.

Reviewers: hokein

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

Tags: #clang

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

4 years agoRevert "Use git-clang-format as Arcanist linter"
Kadir Cetinkaya [Fri, 3 Apr 2020 13:34:37 +0000 (15:34 +0200)]
Revert "Use git-clang-format as Arcanist linter"

This reverts commit 31b6e182f2ce957c86b961e21b9eb82bbcea7c59.

As it was breaking `arc diff` workflow for multiple people.

4 years ago[NFC][XCOFF][AIX] Refactor get/setContainingCsect
jasonliu [Fri, 3 Apr 2020 13:13:13 +0000 (13:13 +0000)]
[NFC][XCOFF][AIX] Refactor get/setContainingCsect

Summary:
For current architect, we always require setContainingCsect to be
called on every MCSymbol got used in XCOFF context.
This is very hard to achieve because symbols gets created everywhere
 and other MCSymbol types(ELF, COFF) do not have similar rules.
It's very easy to miss setting the containing csect, and we would
need to add a lot of XCOFF specialized code around some common code area.

This patch intendeds to do
1. Rely on getFragment().getParent() to get csect from labels.
2. Only use get/setRepresentedCsect (was get/setContainingCsect)
if symbol itself represents a csect.

Reviewers: DiggerLin, hubert.reinterpretcast, daltenty

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

4 years ago[mips][test] Remove redundant and invalid `CHECK-NOT` directives. NFC
Simon Atanasyan [Fri, 3 Apr 2020 13:20:09 +0000 (16:20 +0300)]
[mips][test] Remove redundant and invalid `CHECK-NOT` directives. NFC

1. It's redundant to explicitly check that string does not contain `PAUSE_MM`
   token if check that the `PAUSE` token is followed by an angle bracket.
2. The removed `CHECK-NOT` directives do not have trailing colons.

4 years ago[Alignment][NFC] Deprecate InstrTypes getRetAlignment/getParamAlignment
Guillaume Chatelet [Thu, 2 Apr 2020 15:10:30 +0000 (15:10 +0000)]
[Alignment][NFC] Deprecate InstrTypes getRetAlignment/getParamAlignment

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86][AVX] Add tests showing failure to use chained PACKSS/PACKUS for multi-stage...
Simon Pilgrim [Fri, 3 Apr 2020 12:50:41 +0000 (13:50 +0100)]
[X86][AVX] Add tests showing failure to use chained PACKSS/PACKUS for multi-stage compaction shuffles

The sign/zero extended top bits mean that we could use chained PACK*S ops here

4 years ago[AMDGPU] Allow AGPR in inline asm
Yaxun (Sam) Liu [Thu, 2 Apr 2020 21:16:03 +0000 (17:16 -0400)]
[AMDGPU] Allow AGPR in inline asm

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

4 years ago[lldb][nfc] early exit/continue
Konrad Kleine [Fri, 3 Apr 2020 12:49:47 +0000 (14:49 +0200)]
[lldb][nfc] early exit/continue

Summary:
This commit just tries to invert some `if`'s logic to
`return`/`continue` early.

Reviewers: jankratochvil, teemperor

Reviewed By: jankratochvil, teemperor

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoclang-format: [JS] detect C++ keywords.
Martin Probst [Thu, 2 Apr 2020 14:53:17 +0000 (16:53 +0200)]
clang-format: [JS] detect C++ keywords.

Summary:
C++ defines a number of keywords that are regular identifiers in
JavaScript, e.g. `concept`:

    const concept = 1; // legit JS

This change expands the existing `IsJavaScriptIdentifier(Tok)` function
to return false for C++ keywords that aren't keywords in JS.

Reviewers: krasimir

Subscribers: jfb, cfe-commits

Tags: #clang

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

4 years ago[mlir][vulkan-runner] Add support for 3D memrefs.
Denis Khalikov [Fri, 3 Apr 2020 09:03:00 +0000 (12:03 +0300)]
[mlir][vulkan-runner] Add support for 3D memrefs.

Summary:
Add support for 3D memrefs in mlir-vulkan-runner and simple test.

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

4 years agoDrop unused diagnostic. NFC.
Benjamin Kramer [Fri, 3 Apr 2020 10:46:05 +0000 (12:46 +0200)]
Drop unused diagnostic. NFC.

4 years agoMake helpers static. NFC.
Benjamin Kramer [Fri, 3 Apr 2020 10:45:18 +0000 (12:45 +0200)]
Make helpers static. NFC.

4 years ago[LLD][ELF][ARM] use .reloc directive for Thumb assembler tests
Peter Smith [Mon, 30 Mar 2020 14:04:26 +0000 (15:04 +0100)]
[LLD][ELF][ARM] use .reloc directive for Thumb assembler tests

In the near future llvm-mc will resolve the fixups that generate
R_ARM_THUMB_PC8 and R_ARM_THUMB_PC12 at assembly time (see comments in
D72892), and forbid inter-section references. Change the LLD tests for
these relocations to use .inst and .reloc to avoid LLD tests failing when
this happens. The tests generate the same instructions, relocations
and symbols.

I will need to make equivalent changes for D75349 Arm equivalent
relocations, but this is still in review so these don't need changing
before llvm-mc.

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

4 years ago[Alignment][NFC] Remove unused private functions
Guillaume Chatelet [Thu, 2 Apr 2020 12:24:51 +0000 (12:24 +0000)]
[Alignment][NFC] Remove unused private functions

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Fix CHECK lines
Jay Foad [Fri, 3 Apr 2020 09:06:34 +0000 (10:06 +0100)]
[AMDGPU] Fix CHECK lines

4 years ago[Alignment][NFC] Convert MachineIRBuilder::buildDynStackAlloc to Align
Guillaume Chatelet [Thu, 2 Apr 2020 09:15:06 +0000 (09:15 +0000)]
[Alignment][NFC] Convert MachineIRBuilder::buildDynStackAlloc to Align

Summary:
The change in IRTranslator is not trivial but is NFC as far as I can tell.

This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoUse --style file instead of --style LLVM
Vitaly Buka [Fri, 3 Apr 2020 08:26:51 +0000 (01:26 -0700)]
Use --style file instead of --style LLVM

LLVM includes .clang-format files which must be respected.

4 years ago[DebugInfo] Salvage debug info when sinking loop invariant instructions
OCHyams [Wed, 1 Apr 2020 15:45:33 +0000 (16:45 +0100)]
[DebugInfo] Salvage debug info when sinking loop invariant instructions

Reviewed By: vsk, aprantl, djtodoro

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

4 years ago[NFC] G_DYN_STACKALLOC realign iff align > 1, update documentation
Guillaume Chatelet [Fri, 3 Apr 2020 08:10:59 +0000 (08:10 +0000)]
[NFC] G_DYN_STACKALLOC realign iff align > 1, update documentation

Summary: I think it would be better to require the alignment to be >= 1. It is currently confusing to allow both values.

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoSilence -Wpessimizing-move warning
scentini [Fri, 3 Apr 2020 07:37:12 +0000 (09:37 +0200)]
Silence -Wpessimizing-move warning

4 years ago[X86] Add Indirect Thunk Support to X86 to mitigate Load Value Injection (LVI)
Scott Constable [Fri, 3 Apr 2020 04:59:47 +0000 (21:59 -0700)]
[X86] Add Indirect Thunk Support to X86 to mitigate Load Value Injection (LVI)

This pass replaces each indirect call/jump with a direct call to a thunk that looks like:

lfence
jmpq *%r11

This ensures that if the value in register %r11 was loaded from memory, then
the value in %r11 is (architecturally) correct prior to the jump.
Also adds a new target feature to X86: +lvi-cfi
("cfi" meaning control-flow integrity)
The feature can be added via clang CLI using -mlvi-cfi.

This is an alternate implementation to https://reviews.llvm.org/D75934 That merges the thunk insertion functionality with the existing X86 retpoline code.

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

4 years agoSilence -Wpessimizing-move warning
scentini [Fri, 3 Apr 2020 07:23:59 +0000 (09:23 +0200)]
Silence -Wpessimizing-move warning

4 years ago[DebugInfo] Rename getOffset() to getContribution(). NFC.
Igor Kudrin [Thu, 2 Apr 2020 12:39:56 +0000 (19:39 +0700)]
[DebugInfo] Rename getOffset() to getContribution(). NFC.

The old name was a bit misleading because the functions actually return
contributions to the corresponding sections.

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

4 years ago[DWARF5] Added support for debug_macro section parsing and dumping in llvm-dwarfdump.
Sourabh Singh Tomar [Thu, 26 Mar 2020 07:45:15 +0000 (13:15 +0530)]
[DWARF5] Added support for debug_macro section parsing and dumping in llvm-dwarfdump.

Summary:
This patch adds parsing and dumping DWARFv5 .debug_macro section in llvm-dwarfdump,
it does not introduce any new switch. Existing switch "--debug-macro"
should be used to dump macinfo or macro section.

Reviewed By: dblaikie, ikudrin, jhenderson

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

4 years ago[DAG] Change isGCValue detection for statepoint lowering
Serguei Katkov [Tue, 31 Mar 2020 09:01:28 +0000 (16:01 +0700)]
[DAG] Change isGCValue detection for statepoint lowering

isGCValue should detect whether the deopt value is a GC pointer.
Currently it checks by finding the value in SI.Bases and SI.Ptrs.
However these data structures contain only those values which
have corresponding gc.relocate call. So we can miss GC value if it
does not have gc.relocate call (dead after the call).

Check GC strategy whether pointer is GC one or consider any pointer
to be GC one conservatively.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D77130

4 years agoBugix for buildbot failure at commit 43f031d31264d20cfb8f1ebd606c66e57c231d4d
Xiang1 Zhang [Fri, 3 Apr 2020 05:22:23 +0000 (13:22 +0800)]
Bugix for buildbot failure at commit 43f031d31264d20cfb8f1ebd606c66e57c231d4d
Author: Xiang1 Zhang <xiang1.zhang@intel.com>
Date:   Fri Apr 3 11:25:38 2020 +0800

    Enable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)

4 years ago[X86] Refactor X86IndirectThunks.cpp to Accommodate Mitigations other than Retpoline
Scott Constable [Fri, 3 Apr 2020 04:59:47 +0000 (21:59 -0700)]
[X86] Refactor X86IndirectThunks.cpp to Accommodate Mitigations other than Retpoline

Introduce a ThunkInserter CRTP base class from which new thunk types can inherit, e.g., thunks to mitigate https://software.intel.com/security-software-guidance/software-guidance/load-value-injection.

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

4 years ago[gn build] Port 71e8021d82c
LLVM GN Syncbot [Fri, 3 Apr 2020 04:56:02 +0000 (04:56 +0000)]
[gn build] Port 71e8021d82c

4 years ago[X86][NFC] Generalize the naming of "Retpoline Thunks" and related code to "Indirect...
Scott Constable [Fri, 3 Apr 2020 04:00:44 +0000 (21:00 -0700)]
[X86][NFC] Generalize the naming of "Retpoline Thunks" and related code to "Indirect Thunks"

There are applications for indirect call/branch thunks other than retpoline for Spectre v2, e.g.,

https://software.intel.com/security-software-guidance/software-guidance/load-value-injection

Therefore it makes sense to refactor X86RetpolineThunks as a more general capability.

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

4 years agoUse git-clang-format as Arcanist linter
Siddhartha Bagaria [Fri, 3 Apr 2020 04:34:51 +0000 (04:34 +0000)]
Use git-clang-format as Arcanist linter

D49116 was using clang-format-diff because at the time of its writing,
it needed to handle the subversion repo as well.

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

4 years agoHandle exp2 with proper vectorization and lowering to SVML calls
laith sakka [Fri, 3 Apr 2020 04:10:54 +0000 (21:10 -0700)]
Handle exp2 with proper vectorization and lowering to SVML calls

Summary:
Add mapping from exp2 math functions
to corresponding SVML calls.

This is a follow up and extension for llvm diff
https://reviews.llvm.org/D19544

Test Plan:
- update test case and run ninja check.
- run tests locally

Reviewers: wenlei, hoyFB, mmasten, mzolotukhin, spatel

Reviewed By: spatel

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix a bug in the inliner that causes subsequent double inlining
Hongtao Yu [Fri, 3 Apr 2020 04:07:31 +0000 (21:07 -0700)]
Fix a bug in the inliner that causes subsequent double inlining

Summary:
A recent change in the instruction simplifier enables a call to a function that just returns one of its parameter to be simplified as simply loading the parameter. This exposes a bug in the inliner where double inlining may be involved which in turn may cause compiler ICE when an already-inlined callsite is reused for further inlining.
To put it simply, in the following-like C program, when the function call second(t) is inlined, its code t = third(t) will be reduced to just loading the return value of the callsite first(). This causes the inliner internal data structure to register the first() callsite for the call edge representing the third() call, therefore incurs a double inlining when both call edges are considered an inline candidate. I'm making a fix to break the inliner from reusing a callsite for new call edges.

```
void top()
{
    int t = first();
    second(t);
}

void second(int t)
{
   t = third(t);
   fourth(t);
}

void third(int t)
{
   return t;
}
```
The actual failing case is much trickier than the example here and is only reproducible with the legacy inliner. The way the legacy inliner works is to process each SCC in a bottom-up order. That means in reality function first may be already inlined into top, or function third is either inlined to second or is folded into nothing. To repro the failure seen from building a large application, we need to figure out a way to confuse the inliner so that the bottom-up inlining is not fulfilled. I'm doing this by making the second call indirect so that the alias analyzer fails to figure out the right call graph edge from top to second and top can be processed before second during the bottom-up.  We also need to tweak the test code so that when the inlining of top happens, the function body of second is not that optimized, by delaying the pass of function attribute deducer (i.e, which tells function third has no side effect and just returns its parameter). Since the CGSCC pass is iterative, additional calls are added to top to postpone the inlining of second to the second round right after the first function attribute deducing pass is done. I haven't been able to repro the failure with the new pass manager since the processing order of ininlined callsites is a bit different, but in theory the issue could happen there too.

Note that this fix could introduce a side effect that blocks the simplification of inlined code, specifically for a call site that can be folded to another call site. I hope this can probably be complemented by subsequent inlining or folding, as shown in the attached unit test. The ideal fix should be to separate the use of VMap. However, in reality this failing pattern shouldn't happen often. And even if it happens, there should be a good chance that the non-folded call site will be refolded by iterative inlining or subsequent simplification.

Reviewers: wenlei, davidxl, tejohnson

Reviewed By: wenlei, davidxl

Subscribers: eraman, nikic, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoEnable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)
Xiang1 Zhang [Fri, 3 Apr 2020 03:25:38 +0000 (11:25 +0800)]
Enable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)

Summary:
This patch comes from H.J.'s https://github.com/hjl-tools/llvm-project/commit/2bd54ce7fa9e94fcd1118b948e14d1b6fc54dfd2

**This patch fix the failed llvm unit tests which running on CET machine. **(e.g. ExecutionEngine/MCJIT/MCJITTests)

The reason we enable IBT at "JIT compiled with CET" is mainly that:  the JIT don't know the its caller program is CET enable or not.
If JIT's caller program is non-CET, it is no problem JIT generate CET code or not.
But if JIT's caller program is CET enabled,  JIT must generate CET code or it will cause Control protection exceptions.

I have test the patch at llvm-unit-test and llvm-test-suite at CET machine. It passed.
and H.J. also test it at building and running VNCserver(Virtual Network Console), it works too.
(if not apply this patch, VNCserver will crash at CET machine.)

Reviewers: hjl.tools, craig.topper, LuoYuanke, annita.zhang, pengfei

Subscribers: tstellar, efriedma, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[X86] Add -flax-vector-conversions=none to more of the clang CodeGen tests
Craig Topper [Fri, 3 Apr 2020 02:55:20 +0000 (19:55 -0700)]
[X86] Add -flax-vector-conversions=none to more of the clang CodeGen tests

Thankfully no issues found.

4 years ago[AArch64][GlobalISel] Constrain reg operands in selectBrJT
Jessica Paquette [Thu, 2 Apr 2020 23:33:35 +0000 (16:33 -0700)]
[AArch64][GlobalISel] Constrain reg operands in selectBrJT

This was causing a machine verifier failure on the test suite.

Make sure that we don't end up with a weird register class here.

Failure for reference:

*** Bad machine code: Illegal virtual register for instruction ***
- function:    check_constrain
- basic block: %bb.1  (0x7f8b70839f80)
- instruction: early-clobber %6:gpr64, early-clobber %7:gpr64sp =
  JumpTableDest32 %5:gpr64, %1:gpr64sp, %jump-table.0
- operand 3:   %1:gpr64sp
Expected a GPR64 register, but got a GPR64sp register

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

4 years ago[x86] Fix Intel OpenCL builtin CalleeSavedRegs on skx
Wenju He [Fri, 3 Apr 2020 02:47:55 +0000 (10:47 +0800)]
[x86] Fix Intel OpenCL builtin CalleeSavedRegs on skx

Summary: Align with AVX512 builtins implementations, some of which don't preserve rdi.

Reviewers: yubing, tianqing, craig.topper

Reviewed By: craig.topper

Subscribers: yaxunl, Anastasia, hiraditya

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

4 years ago[PowerPC] Remove unnecessary XSRSP instruction
Qiu Chaofan [Fri, 3 Apr 2020 03:05:14 +0000 (11:05 +0800)]
[PowerPC] Remove unnecessary XSRSP instruction

MI peephole will remove unnecessary FRSP instructions. This patch
removes such unnecessary XSRSP.

Reviewed By: steven.zhang

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

4 years agoThis might actually fix the Windows bots after a16ba6fea.
Nico Weber [Fri, 3 Apr 2020 02:22:54 +0000 (22:22 -0400)]
This might actually fix the Windows bots after a16ba6fea.

4 years ago[coroutines] Don't build promise init with no args
Brian Gesiak [Thu, 21 Nov 2019 18:51:44 +0000 (13:51 -0500)]
[coroutines] Don't build promise init with no args

Summary:
In the case of a coroutine that takes no arguments,
`Sema::buildCoroutinePromise` constructs a list-initialization
(`clang::InitializationKind::InitKind::IK_DirectList`) of the
promise variable, using a list of empty arguments. So, if one were to
dump the promise `VarDecl` immediately after `Sema::ActOnCoroutineBodyStart`
calls `checkCoroutineContext`, for a coroutine function that takes no
arguments, they'd see the following:

```
VarDecl 0xb514490 <test.cpp:26:3> col:3 __promise '<dependent type>' callinit
`-ParenListExpr 0xb514510 <col:3> 'NULL TYPE'
```

But after this patch, the `ParenListExpr` is no longer constructed, and
the promise variable uses default initialization
(`clang::InitializationKind::InitKind::IK_Default`):

```
VarDecl 0x63100012dae0 <test.cpp:26:3> col:3 __promise '<dependent type>'
```

As far as I know, there's no case in which list-initialization with no
arguments differs from default initialization, but if I'm wrong please
let me know (and I'll add a test case that demonstrates the change --
but as-is I can't think of a functional test case for this). I think both
comply with the wording of C++20 `[dcl.fct.def.coroutine]p5`:

> _promise-constructor-arguments_ is determined as follows: overload
  resolution is performed on a promise constructor call created by
  assembling an argument list with lvalues `p1 ... pn`. If a viable
  constructor is found (12.4.2), then _promise-constructor-arguments_
  is `(p1, ... , pn)`, otherwise _promise-constructor-arguments_ is
  empty.

Still, I think this patch is an improvement regardless, because it
reduces the size of the AST.

Reviewers: GorNishanov, rsmith, lewissbaker

Subscribers: EricWF, cfe-commits

Tags: #clang

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

4 years ago[mlir][VectorOps] Implement canonicalization for TransposeOp.
Alex Grosul [Thu, 2 Apr 2020 22:20:38 +0000 (15:20 -0700)]
[mlir][VectorOps] Implement canonicalization for TransposeOp.

Two back-to-back transpose operations are combined into a single transpose, which uses a combination of their permutation vectors.

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

4 years agoHave lldb-vscode update the currently selecte thread and frame when it receives a...
Greg Clayton [Thu, 2 Apr 2020 23:30:33 +0000 (16:30 -0700)]
Have lldb-vscode update the currently selecte thread and frame when it receives a "scopes" request.

Summary: The IDE has no packets that are sent to lldb-vscode that say which thread and frame are selected. The only way we know is we get a request for variables for a stack frame via a "scopes" request. When we receive this packet we make that thread and frame the selected thread and frame in lldb. This way when people execute lldb commands in the debug console by prefixing the expression with the backtick character, we will have the right thread and frame selected. Previously this was not updated as new stack frames were selected.

Reviewers: labath, aadsm, wallace, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoanother wild guess at the win bot-only failures
Nico Weber [Fri, 3 Apr 2020 01:22:15 +0000 (21:22 -0400)]
another wild guess at the win bot-only failures

4 years ago[Coroutines] Simplify implementation using removePredecessor
Jun Ma [Fri, 3 Apr 2020 01:20:07 +0000 (09:20 +0800)]
[Coroutines] Simplify implementation using removePredecessor

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

4 years ago[mlir][Linalg] NFC - Rename Linalg and Vector EDSCs to avoid collisions
Nicolas Vasilache [Fri, 3 Apr 2020 01:06:45 +0000 (21:06 -0400)]
[mlir][Linalg] NFC - Rename Linalg and Vector EDSCs to avoid collisions

A certain number of EDSCs have a named form (e.g. `linalg.matmul`) and a generic form (e.g. `linalg.generic` with matmul traits).
Despite living in different namespaces, using the same name is confusiong in clients.
Rename them as `linalg_matmul` and `linalg_generic_matmul` respectively.

4 years ago[AMDGPU] Handle SMRD signed offset immediate
Austin Kerbow [Mon, 30 Mar 2020 06:32:20 +0000 (23:32 -0700)]
[AMDGPU] Handle SMRD signed offset immediate

Summary:
This fixes a few issues related to SMRD offsets. On gfx9 and gfx10 we have a
signed byte offset immediate, however we can overflow into a negative since we
treat it as unsigned.

Also, the SMRD SOFFSET sgpr is an unsigned offset on all subtargets. We
sometimes tried to use negative values here.

Third, S_BUFFER instructions should never use a signed offset immediate.

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

4 years agoTeach the stripNonLineTableDebugInfo pass about the llvm.dbg.label intrinsic.
Adrian Prantl [Thu, 2 Apr 2020 23:11:49 +0000 (16:11 -0700)]
Teach the stripNonLineTableDebugInfo pass about the llvm.dbg.label intrinsic.

Debug info for labels is not generated at -gline-tables-only, so this
pass should remove them.

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

4 years agoTeach the stripNonLineTableDebugInfo pass about the llvm.dbg.addr intrinsic.
Adrian Prantl [Thu, 2 Apr 2020 23:05:45 +0000 (16:05 -0700)]
Teach the stripNonLineTableDebugInfo pass about the llvm.dbg.addr intrinsic.

This patch also strips llvm.dbg.addr intrinsics when downgrading debug
info to linetables-only.

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

4 years agotry more to appease win bots
Nico Weber [Fri, 3 Apr 2020 00:27:31 +0000 (20:27 -0400)]
try more to appease win bots

4 years agoTry again to get tests passing again on Windows.
Nico Weber [Fri, 3 Apr 2020 00:00:38 +0000 (20:00 -0400)]
Try again to get tests passing again on Windows.

Things pass locally, but some tests on some bots are still unhappy.
I'm not sure why. See if using forward slashes as before helps.

4 years agoRe-apply 0071eaaf089, "[ORC] Export __cxa_atexit ...", with fixes.
Lang Hames [Thu, 2 Apr 2020 22:58:52 +0000 (15:58 -0700)]
Re-apply 0071eaaf089, "[ORC] Export __cxa_atexit ...", with fixes.

Forgot to include part of the testcase. Thank to Nico for spotting that and
reverting!

4 years agoAMDGPU: Fix broken check lines
Matt Arsenault [Thu, 2 Apr 2020 22:50:09 +0000 (18:50 -0400)]
AMDGPU: Fix broken check lines

4 years ago[llvm-objdump][COFF][NFC] Split format-specific interfaces; add namespace
Hubert Tong [Thu, 2 Apr 2020 22:17:52 +0000 (18:17 -0400)]
[llvm-objdump][COFF][NFC] Split format-specific interfaces; add namespace

Summary:
This patch addresses, for the interfaces implemented by `COFFDump.cpp`,
multiple issues identified with the current structure of
`llvm-objdump.h` in the review of D72973.

This patch moves implementation details of the tool into an
`llvm::objdump` namespace for external linkage names, splits the
implementation details into separate headers for each implementation
file, and uses qualified names when declaring members of the
`llvm::objdump` namespace in place of leaving the namespace definition
open.

Reviewers: jhenderson, DiggerLin, jasonliu, daltenty, MaskRay

Reviewed By: jhenderson, MaskRay

Subscribers: MaskRay, rupprecht, llvm-commits

Tags: #llvm

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

4 years agoiOS simulator testing: replace `simctl bootstatus` with boot+shutdown
Julian Lettner [Thu, 2 Apr 2020 19:58:47 +0000 (12:58 -0700)]
iOS simulator testing: replace `simctl bootstatus` with boot+shutdown

rdar://59643443

4 years ago[lit] Refine filter error handling
Julian Lettner [Thu, 2 Apr 2020 18:06:28 +0000 (11:06 -0700)]
[lit] Refine filter error handling

Picking a default filter `.*` that matches everything lets us streamline
some error handling code.

4 years ago[lit] Remove unnecessary indirection in progress_callback
Julian Lettner [Thu, 2 Apr 2020 17:45:57 +0000 (10:45 -0700)]
[lit] Remove unnecessary indirection in progress_callback

On shutdown, the result complete handler is not racing with the main
thread anymore because we are now always waiting for process pool
termination via
```
  finally:
    pool.join()
```

4 years agoAMDGPU: Use 128-bit DS operations by default
Matt Arsenault [Wed, 1 Apr 2020 20:46:10 +0000 (16:46 -0400)]
AMDGPU: Use 128-bit DS operations by default

4 years agoAMDGPU: Add some tests for exotic denormal mode combinations
Matt Arsenault [Wed, 11 Dec 2019 12:42:52 +0000 (18:12 +0530)]
AMDGPU: Add some tests for exotic denormal mode combinations

4 years agoAMDGPU: Remove denormal subtarget features
Matt Arsenault [Mon, 18 Nov 2019 11:18:07 +0000 (16:48 +0530)]
AMDGPU: Remove denormal subtarget features

Switch to using the denormal-fp-math/denormal-fp-math-f32 attributes.

4 years agoclang/AMDGPU: Stop setting old denormal subtarget features
Matt Arsenault [Wed, 1 Apr 2020 17:57:16 +0000 (13:57 -0400)]
clang/AMDGPU: Stop setting old denormal subtarget features

4 years agoAMDGPU: Assume f32 denormals are enabled by default
Matt Arsenault [Fri, 1 Nov 2019 06:32:31 +0000 (23:32 -0700)]
AMDGPU: Assume f32 denormals are enabled by default

This will likely introduce catastrophic performance regressions on
older subtargets, but should be correct. A follow up change will
remove the old fp32-denormals subtarget features, and switch to using
the new denormal-fp-math/denormal-fp-math-f32 attributes. Frontends
should be making sure to add the denormal-fp-math-f32 attribute when
appropriate to avoid performance regressions.

4 years agoutils: Tweak clang-parse-diagnostics-file for modules includes
Duncan P. N. Exon Smith [Thu, 2 Apr 2020 17:27:42 +0000 (10:27 -0700)]
utils: Tweak clang-parse-diagnostics-file for modules includes

Diagnostics from modules do not have a `main-file` listed.  Tweak
`clang-parse-diagnostics-file` to patch this up.  Previously, the call
to `os.path.basename` would crash.

Radar-Id: rdar://problem/59000292

4 years ago[libc++] NFC: Add documentation for writing tests
Louis Dionne [Thu, 2 Apr 2020 21:14:45 +0000 (17:14 -0400)]
[libc++] NFC: Add documentation for writing tests

4 years ago[libc++] Refer to the Filesystem static test env as relative paths
Louis Dionne [Wed, 1 Apr 2020 20:26:31 +0000 (16:26 -0400)]
[libc++] Refer to the Filesystem static test env as relative paths

Instead of hardcoding absolute paths on the build-host in the executables,
use relative paths from the current working directory. Also, use
FILE_DEPENDENCIES to mark the static test env as being required by
the relevant tests.

Given a SSH executor that copies the files to the remote host properly,
the tests can be run on that remote host.

4 years agoReland "Make it possible for lit.site.cfg to contain relative paths, and use it for...
Nico Weber [Thu, 2 Apr 2020 19:51:58 +0000 (15:51 -0400)]
Reland "Make it possible for lit.site.cfg to contain relative paths, and use it for llvm and clang"

The problem on Windows was that the \b in "..\bin" was interpreted
as an escape sequence. Use r"" strings to prevent that.

This reverts commit ab11b9eefa16661017c2c7b3b34c46b069f43fb7,
with raw strings in the lit.site.cfg.py.in files.

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

4 years ago[llvm][TextAPI] adding inlining reexported libraries support
Cyndy Ishida [Wed, 1 Apr 2020 16:41:39 +0000 (09:41 -0700)]
[llvm][TextAPI] adding inlining reexported libraries support

Summary:
[llvm][TextAPI] adding inlining reexported libraries support

* this patch adds reader/writer support for MachO tbd files.
The usecase is to represent reexported libraries in top level library
that won't need to exist for linker indirection because all of the
needed content will be inlined in the same document.

Reviewers: ributzka, steven_wu, jhenderson

Reviewed By: ributzka

Subscribers: JDevlieghere, hiraditya, mgrang, dexonsmith, rupprecht, llvm-commits

Tags: #llvm

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

4 years ago[libc++][test] Partially revert msvc_stdlib_force_include.h _Pragma change
Casey Carter [Thu, 2 Apr 2020 19:59:57 +0000 (12:59 -0700)]
[libc++][test] Partially revert msvc_stdlib_force_include.h _Pragma change

... keep the warning suppression, but revert the `__pragma` to `_Pragma` change because `_Pragma` interacts badly with `/Zc:preprocessor`.

4 years ago[X86] Enable combineExtSetcc for vectors larger than 256 bits when we've disabled...
Craig Topper [Thu, 2 Apr 2020 19:08:56 +0000 (12:08 -0700)]
[X86] Enable combineExtSetcc for vectors larger than 256 bits when we've disabled 512 bit vectors.

The compares are going to be type legalized to 256 bits so we
might as well fold the extend.

4 years agoReland D75382 "[lld] Initial commit for new Mach-O backend"
Fangrui Song [Thu, 2 Apr 2020 18:54:05 +0000 (11:54 -0700)]
Reland D75382 "[lld] Initial commit for new Mach-O backend"

With a fix for http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/3636

Also trims some unneeded dependencies.

4 years agoRevert "Make it possible for lit.site.cfg to contain relative paths, and use it for...
Nico Weber [Thu, 2 Apr 2020 18:58:44 +0000 (14:58 -0400)]
Revert "Make it possible for lit.site.cfg to contain relative paths, and use it for llvm and clang"

This reverts commit fb80b6b2d58c476747a3206bd4371b787108591b and
follow-up 631ee8b24adf36359b61ecb47484e8e82de35be8.

Seems to not work on Windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/31684
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/6512

Let's revert while I investigate.

4 years agoChange pass registration generated code to allow users to selectively register passes
Mehdi Amini [Thu, 2 Apr 2020 17:36:11 +0000 (17:36 +0000)]
Change pass registration generated code to allow users to selectively register passes

This slightly tweaks the generated code from:

  #ifdef GEN_PASS_REGISTRATION
  ::mlir::registerPass("flag1", ...
  ::mlir::registerPass("flag2", ...
  #endif // GEN_PASS_REGISTRATION

to:

  #ifdef GEN_PASS_REGISTRATION
  #define GEN_PASS_REGISTRATION_Pass1
  #define GEN_PASS_REGISTRATION_Pass2
  #endif // GEN_PASS_REGISTRATION

  #ifdef GEN_PASS_REGISTRATION_Pass1
  ::mlir::registerPass("flag1", ...
  #endif
  #ifdef GEN_PASS_REGISTRATION_Pass1
  ::mlir::registerPass("flag2", ...
  #endif

That way the generated code can be included by defining the
`GEN_PASS_REGISTRATION` macro as currenty and register all the passes,
but one can also define only `GEN_PASS_REGISTRATION_Pass1` to register a
subset of the passes.

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

4 years ago[intel-pt] Implement a basic test case
Walter Erquinigo [Tue, 31 Mar 2020 00:26:58 +0000 (17:26 -0700)]
[intel-pt] Implement a basic test case

* This is a reattempted commit due to a previous builtbot failure

- Now using a env var to determine whether to run the test, as
someone might have built liblldbIntelFeatures.so without intelPT
support, which would make this test fail.

Summary:
Depends on D76872.

There was no test for the Intel PT support on LLDB, so I'm creating one, which
will help making progress on solid grounds.

The test is skipped if the Intel PT plugin library is not built.

Reviewers: clayborg, labath, kusmour, aadsm

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoMake fb80b6b2d58c4 actually work.
Nico Weber [Thu, 2 Apr 2020 18:28:34 +0000 (14:28 -0400)]
Make fb80b6b2d58c4 actually work.

I broke it with last-minute changes right before committing.

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

4 years ago[InlineFunction] Update valid return attributes at callsite within callee body
Anna Thomas [Wed, 1 Apr 2020 15:16:11 +0000 (11:16 -0400)]
[InlineFunction] Update valid return attributes at callsite within callee body

Consider a callee function that has a call (C) within it which feeds
into the return. When we inline that callee into a callsite that has
return attributes, we can backward propagate valid attributes to the
call (C) within that inlined callee body.

This is safe to do so only if we can guarantee transfer of execution to
successor in the window of instructions between return value (i.e. the
call C) and the return instruction.

Also, this is valid only for attributes which are a property of a
callsite and not those that are not dependent on the ABI, or a property
of the call itself.

Reviewed-By: reames, jdoerfert
Differential Revision: https://reviews.llvm.org/D76140

4 years agoAMDGPU: Hack out noinline on functions using LDS globals
Matt Arsenault [Thu, 2 Apr 2020 15:52:23 +0000 (11:52 -0400)]
AMDGPU: Hack out noinline on functions using LDS globals

This is a workaround for clang adding noinline to all functions at
-O0. Previously, we would just add alwaysinline, and the verifier
would complain about having both noinline and alwaysinline. We
currently can't truly codegen this case as a freestanding function, so
override the user forcing noinline.

4 years agoMake it possible for lit.site.cfg to contain relative paths, and use it for llvm...
Nico Weber [Tue, 31 Mar 2020 20:35:32 +0000 (16:35 -0400)]
Make it possible for lit.site.cfg to contain relative paths, and use it for llvm and clang

Currently, all generated lit.site.cfg files contain absolute paths.

This makes it impossible to build on one machine, and then transfer the
build output to another machine for test execution. Being able to do
this is useful for several use cases:

1. When running tests on an ARM machine, it would be possible to build
   on a fast x86 machine and then copy build artifacts over after building.

2. It allows running several test suites (clang, llvm, lld) on 3
   different machines, reducing test time from sum(each test suite time) to
   max(each test suite time).

This patch makes it possible to pass a list of variables that should be
relative in the generated lit.site.cfg.py file to
configure_lit_site_cfg(). The lit.site.cfg.py.in file needs to call
`path()` on these variables, so that the paths are converted to absolute
form at lit start time.

The testers would have to have an LLVM checkout at the same revision,
and the build dir would have to be at the same relative path as on the
builder.

This does not yet cover how to figure out which files to copy from the
builder machine to the tester machines. (One idea is to look at the
`--graphviz=test.dot` output and copy all inputs of the `check-llvm`
target.)

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

4 years agoExit unwinding early when at the top of the stack and additional info won't be found.
Sterling Augustine [Mon, 30 Mar 2020 22:20:26 +0000 (15:20 -0700)]
Exit unwinding early when at the top of the stack and additional info won't be found.

Summary:
This patch follows libgcc's lead: When the return-address register is
zero, there won't be additional stack frames to examine, or gather
information about. Exit before spending time looking for something
known not to be found.

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] try to reduce shuffle with bitcasted operand
Sanjay Patel [Thu, 2 Apr 2020 17:44:50 +0000 (13:44 -0400)]
[InstCombine] try to reduce shuffle with bitcasted operand

shuf (bitcast X), undef, Mask --> bitcast X'

The 'inverse shuffles' test (shuf_bitcast_operand) is a pattern
in the motivating examples from PR35454:
https://bugs.llvm.org/show_bug.cgi?id=35454
(see also D76727)

We can deal with this class of patterns in generic instcombine
because we are not creating any new shuffles, just a bitcast.

Alive2 proof:
http://volta.cs.utah.edu:8080/z/mwDUZf

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

4 years ago[VectorCombine] transform bitcasted shuffle to narrower elements
Sanjay Patel [Thu, 2 Apr 2020 17:21:29 +0000 (13:21 -0400)]
[VectorCombine] transform bitcasted shuffle to narrower elements

bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'

We do not attempt this in InstCombine because we do not want to change
types and create new shuffle ops that are potentially not lowered as
well as the original code. Here, we can check the cost model to see if
it is worthwhile.

I've aggressively enabled this transform even if the types are the same
size and/or equal cost because moving the bitcast allows InstCombine to
make further simplifications.

In the motivating cases from PR35454:
https://bugs.llvm.org/show_bug.cgi?id=35454
...this is enough to let instcombine and the backend eliminate the
redundant shuffles, but we probably want to extend VectorCombine to
handle the inverse pattern (shuffle-of-bitcast) to get that
simplification directly in IR.

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

4 years ago[AMDGPU] Fix crash in SILoadStoreOptimizer
Stanislav Mekhanoshin [Wed, 1 Apr 2020 21:58:12 +0000 (14:58 -0700)]
[AMDGPU] Fix crash in SILoadStoreOptimizer

SILoadStoreOptimizer::checkAndPrepareMerge() expects base and
paired instruction to come in order and scans MBB from base to
the paired instruction. An original order can be changed if
there were a dependent instruction in between and base instruction
was moved.

Fixed by bailing the optimization. In theory it might be possible
still to perform a merge by swapping instructions, but on practice
it bails anyway because it finds dependency on that same instruction
which has resulted in the base move.

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

4 years ago[libc++abi] NFC: Add link to review in workaround comment
Louis Dionne [Thu, 2 Apr 2020 17:20:23 +0000 (13:20 -0400)]
[libc++abi] NFC: Add link to review in workaround comment

To avoid wasting the valuable time of contributors, add a link to a
blocked review to document additional issues with the removal of some
GCC 4.9 workaround.