]> granicus.if.org Git - llvm/log
llvm
5 years ago[InstCombine] Cherry-pick NFC cleanups of foldShiftIntoShiftInAnotherHandOfAndInICmp...
Roman Lebedev [Sun, 18 Aug 2019 12:26:33 +0000 (12:26 +0000)]
[InstCombine] Cherry-pick NFC cleanups of foldShiftIntoShiftInAnotherHandOfAndInICmp() from D66383

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369207 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering] Teach computeRegisterProperties to only widen v3i16/v3f16 vectors...
Craig Topper [Sun, 18 Aug 2019 06:28:06 +0000 (06:28 +0000)]
[TargetLowering] Teach computeRegisterProperties to only widen v3i16/v3f16 vectors to the next power of 2 type if that's legal.

These were recently made simple types. This restores their
behavior back to something like their EVT legalization.

We might be able to fix the code in type legalization where the
assert was failing, but I didn't investigate too much as I had
already looked at the computeRegisterProperties code during the
review for v3i16/v3f16.

Most of the test changes restore the X86 codegen back to what
it looked like before the recent change. The test case in
vec_setcc.ll and is a reduced version of the reproducer from
the fuzzer.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16490

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369205 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] Add a node creation debug message to getMachineNode.
Craig Topper [Sun, 18 Aug 2019 06:28:00 +0000 (06:28 +0000)]
[SelectionDAG] Add a node creation debug message to getMachineNode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369204 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Fix iterator error when lowering SI_END_CF
Matt Arsenault [Sun, 18 Aug 2019 00:20:44 +0000 (00:20 +0000)]
AMDGPU: Fix iterator error when lowering SI_END_CF

If the instruction is the last in the block, there is no next
instruction but the iteration still needs to look at the new block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369203 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Disambiguate v3f16 format in load/store tables
Matt Arsenault [Sun, 18 Aug 2019 00:20:43 +0000 (00:20 +0000)]
AMDGPU: Disambiguate v3f16 format in load/store tables

Currently the searchable tables report the number of dwords. These
round to the same number for 3 and 4 component d16
instructions. Change this to report the number of elements so this
isn't ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369202 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTableGen: Revert changes from r369038
Matt Arsenault [Sun, 18 Aug 2019 00:20:42 +0000 (00:20 +0000)]
TableGen: Revert changes from r369038

These aren't needed for a specific use yet, and I meant to not commit
these.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369201 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a one use check to the combineStore code that handles v16i16->v16i8 truncat...
Craig Topper [Sat, 17 Aug 2019 22:46:15 +0000 (22:46 +0000)]
[X86] Add a one use check to the combineStore code that handles v16i16->v16i8 truncate+store by extending to v16i32 and then emitting a v16i32->v16i8 truncstore.

This prevent us from emitting a separate truncate and a truncating
store instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369200 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BPF] Fix bpf llvm-objdump issues.
Yonghong Song [Sat, 17 Aug 2019 22:12:00 +0000 (22:12 +0000)]
[BPF] Fix bpf llvm-objdump issues.

Commit https://reviews.llvm.org/D57939 ("[DWARF] Refactor
RelocVisitor and fix computation of SHT_RELA-typed relocation entries)
made a change for relocation resolution when operating
on an object file.

The change unfortunately broke BPF as given SymbolValue (S) and
Addent (A), previously relocation is resolved to
    S + A
and after the change, it is resolved to
    S

This patch fixed the issue by resolving relocation correctly.

It looks not all relocation resolution reaches here and I did not
trace down exactly when. But I do find if the object file includes
codes in two different ELF sections than default ".text",
the above bug will be triggered.

This patch included a trivial two function source code to
demonstrate this issue. The relocation for .debug_loc is resolved
incorrectly due to this and llvm-objdump cannot display source
annotated assembly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369199 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC][InstCombine] Some tests for 'shift amount reassoc in bit test - trunc-of-lshr...
Roman Lebedev [Sat, 17 Aug 2019 21:35:33 +0000 (21:35 +0000)]
[NFC][InstCombine] Some tests for 'shift amount reassoc in bit test - trunc-of-lshr' (PR42399)

Finally, the fold i was looking forward to :)

The legality check is muddy, i doubt  i've groked the full generalization,
but it handles all the cases i care about, and can come up with:
https://rise4fun.com/Alive/26j

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369197 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting...
George Rimar [Sat, 17 Aug 2019 16:07:18 +0000 (16:07 +0000)]
Recommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API."

Fix: Add a `consumeError` call removed by mistake to 'printStackSize',
this should fix the "Expected<T> must be checked before access or destruction." reported by following bot:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio

Original commit message:
Currently we have the following functions for error reporting:

LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
void reportError(Error Err, StringRef Input);
void reportWarning(Twine Msg);
void reportWarning(StringRef Input, Error Err);
void warn(llvm::Error Err);
void error(std::error_code EC);

Problems are: naming is inconsistent, arguments order is inconsistent,
some of the functions looks excessive.

After applying this patch we have:

void reportError(Error Err, StringRef Input);
void reportError(std::error_code EC, StringRef Input);
void reportWarning(Error Err, StringRef Input);

I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
is used by COFF heavily.

Test cases were updated, they show an improvement introduced.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369194 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r369190, r369192 ([llvm-readobj/llvm-readelf] - Improve/cleanup the error...
George Rimar [Sat, 17 Aug 2019 15:36:06 +0000 (15:36 +0000)]
Revert r369190, r369192 ([llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.)

It caused multiple BB failtures:

http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/26042/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Astack-sizes.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369193 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] - An attemp to fix BB after r369191.
George Rimar [Sat, 17 Aug 2019 15:24:16 +0000 (15:24 +0000)]
[llvm-readobj] - An attemp to fix BB after r369191.

Few BB failed with the following error:

Command Output (stderr):
--
/home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/test/tools/llvm-readobj/stack-sizes.test:263:19: error: BADSECTION-OUT: expected string not found in input
# BADSECTION-OUT: 8 ?
                  ^
<stdin>:4:1: note: scanning from here

^

It doesn't reproduce on ubuntu/windows I have. Also, seems many of the bots
are happy too.

This slightly reorders the code to make fouts().flush() call earlier,
like it was before the r369191.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369192 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks
Kang Zhang [Sat, 17 Aug 2019 14:37:05 +0000 (14:37 +0000)]
[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Summary:

Fix a bug of preducessors.

In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
But the `early-ret` pass is before `block-placement`, we don't want to run it again.
This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.

Reviewed By: efriedma

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369191 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.
George Rimar [Sat, 17 Aug 2019 14:36:40 +0000 (14:36 +0000)]
[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.

urrently we have the following functions for error reporting:

--
LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
void reportError(Error Err, StringRef Input);
void reportWarning(Twine Msg);
void reportWarning(StringRef Input, Error Err);
void warn(llvm::Error Err);
void error(std::error_code EC);
---

Problems are: naming is inconsistent, arguments order is inconsistent,
some of the functions looks excessive.

After applying this patch we have:

---
LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input);
LLVM_ATTRIBUTE_NORETURN void reportError(std::error_code EC, StringRef Input);
void reportWarning(Error Err, StringRef Input);
---

I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
is used by COFF heavily.

Test cases were updated, they show an improvement introduced.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369190 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test] - Remove precomiled openbsd-phdrs.elf-x86-64 objects.
George Rimar [Sat, 17 Aug 2019 14:23:30 +0000 (14:23 +0000)]
[test] - Remove precomiled openbsd-phdrs.elf-x86-64 objects.

There are 2 similar openbsd-phdrs.elf-x86-64 objects committed and
used in test/Object and test/tools/llvm-objdump test cases.

There is no reason to have them, we can use YAML instead. Patch does that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369189 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[circular_raw_ostream] Delegate is_displayed to contained stream
Troy A. Johnson [Sat, 17 Aug 2019 14:20:41 +0000 (14:20 +0000)]
[circular_raw_ostream] Delegate is_displayed to contained stream

raw_ostream has an is_displayed() member function that determines if the stream
is connected to a console for display or is connected to a file/pipe. By
default, is_displayed() returns false, and derived classes like raw_fd_ostream
override it. Because circular_raw_ostream wraps another stream, its result for
is_displayed() should be the same as that stream.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369188 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta...
Paul Walker [Sat, 17 Aug 2019 09:22:36 +0000 (09:22 +0000)]
Revert Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

This reverts r369132 (git commit 19301d75f086caae1a495d267f5d0264b225942d)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369186 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instruc...
Paul Walker [Sat, 17 Aug 2019 09:22:28 +0000 (09:22 +0000)]
Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

This reverts r369133 (git commit 2632c677f85cba1ac2aef5d68aaf8af0f5b3c944)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369185 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Loop passes should mark MSSA preserved when available.
Alina Sbirlea [Sat, 17 Aug 2019 01:02:12 +0000 (01:02 +0000)]
[MemorySSA] Loop passes should mark MSSA preserved when available.

This patch applies only to the new pass manager.
Currently, when MSSA Analysis is available, and pass to each loop pass, it will be preserved by that loop pass.
Hence, mark the analysis preserved based on that condition, vs the current `EnableMSSALoopDependency`. This leaves the global flag to affect only the entry point in the loop pass manager (in FunctionToLoopPassAdaptor).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369181 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] Unwrap the value first to avoid the error
Petr Hosek [Sat, 17 Aug 2019 00:07:26 +0000 (00:07 +0000)]
[llvm-readobj] Unwrap the value first to avoid the error

This addresses the issue introduced in r369169, we need to unwrap
the value first before we can check whether it's empty. This also
swaps the two branches to put the common path first which should
be NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369177 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd LLDB dataformatters for llvm::StringRef and lldb_private::ConstString
Adrian Prantl [Fri, 16 Aug 2019 23:47:57 +0000 (23:47 +0000)]
Add LLDB dataformatters for llvm::StringRef and lldb_private::ConstString

These data formatters make the string value appear in Xcode's
variables view (and on the command line) without having to expand the
data structure.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369175 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r367891 - "[InstCombine] combine mul+shl separated by zext"
Sanjay Patel [Fri, 16 Aug 2019 23:36:28 +0000 (23:36 +0000)]
Revert r367891 - "[InstCombine] combine mul+shl separated by zext"

This reverts commit 5dbb90bfe14ace30224239cac7c61a1422fa5144.

As noted in the post-commit thread for r367891, this can create
a multiply that is lowered to a libcall that may not exist.

We need to improve the backend decomposition for integer multiply
before trying to re-land this (if it's still worthwhile after
doing the backend work).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369174 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReland "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 23:30:16 +0000 (23:30 +0000)]
Reland "[ARM] push LR before __gnu_mcount_nc"

This relands r369147 with fixes to unit tests.

https://reviews.llvm.org/D65019

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369173 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Fix an assertion during G_UNMERGE selection for s128 types.
Amara Emerson [Fri, 16 Aug 2019 23:23:40 +0000 (23:23 +0000)]
[AArch64][GlobalISel] Fix an assertion during G_UNMERGE selection for s128 types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369172 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Re-introduce self-dependence accidentally dropped from a unit test.
Lang Hames [Fri, 16 Aug 2019 23:20:54 +0000 (23:20 +0000)]
[ORC] Re-introduce self-dependence accidentally dropped from a unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369171 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] Fallback to PT_NOTE if file doesn't have sections
Petr Hosek [Fri, 16 Aug 2019 23:15:40 +0000 (23:15 +0000)]
[llvm-readobj] Fallback to PT_NOTE if file doesn't have sections

This is useful when trying to read notes from stripped files and matches
the behavior of GNU readelf and eu-readelf.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369169 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGenPrepare] Fix use-after-free
Sanjay Patel [Fri, 16 Aug 2019 23:10:34 +0000 (23:10 +0000)]
[CodeGenPrepare] Fix use-after-free

If OptimizeExtractBits() encountered a shift instruction with no operands at all,
it would erase the instruction, but still return false.

This previously didn’t matter because its caller would always return after
processing the instruction, but https://reviews.llvm.org/D63233 changed the
function’s caller to fall through if it returned false, which would then cause
a use-after-free detectable by ASAN.

This change makes OptimizeExtractBits return true if it removes a shift
instruction with no users, terminating processing of the instruction.

Patch by: @brentdax (Brent Royal-Gordon)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369168 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using...
Jordan Rupprecht [Fri, 16 Aug 2019 23:08:56 +0000 (23:08 +0000)]
Revert [X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using DemandedElts mask (reapplied)

This reverts r368662 (git commit 1a8d790cf5f89c1df718844f13e934e39bef6ef5)

The compile-time regression repro is in https://bugs.llvm.org/show_bug.cgi?id=43024

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369167 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - check branch_weights too
Roman Lebedev [Fri, 16 Aug 2019 23:06:37 +0000 (23:06 +0000)]
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - check branch_weights too

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369166 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine][NFC] Revisit tests in reuse-constant-from-select-in-icmp.ll
Roman Lebedev [Fri, 16 Aug 2019 22:40:06 +0000 (22:40 +0000)]
[InstCombine][NFC] Revisit tests in reuse-constant-from-select-in-icmp.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369163 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Preserve liveness in ARMConstantIslands.
Eli Friedman [Fri, 16 Aug 2019 22:20:14 +0000 (22:20 +0000)]
[ARM] Preserve liveness in ARMConstantIslands.

We currently don't use liveness information after this point, but it can
be useful to catch bugs using -verify-machineinstrs, and optimizations
could potentially use this information in the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369162 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Fix: Do not partially resolve returned calls.
Johannes Doerfert [Fri, 16 Aug 2019 21:59:52 +0000 (21:59 +0000)]
[Attributor] Fix: Do not partially resolve returned calls.

By partially resolving returned calls we did not record that they were
not fully resolved which caused odd behavior down the line. We could
also end up with some, but not all, returned values of the callee in the
returned values map of the caller, another odd behavior we want to
avoid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369160 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Fix: Make sure we set the changed flag
Johannes Doerfert [Fri, 16 Aug 2019 21:55:01 +0000 (21:55 +0000)]
[Attributor] Fix: Make sure we set the changed flag

The flag was updated *before* we actually run the visitor callback so we
might miss updates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369159 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CaptureTracking] Allow null to be in either icmp operand
Johannes Doerfert [Fri, 16 Aug 2019 21:53:49 +0000 (21:53 +0000)]
[CaptureTracking] Allow null to be in either icmp operand

Summary:
Before we required the comparison against null to be "canonical", hence
null to be operand #1. This patch allows null to be in either operand,
similar to the handling of loaded globals that follows.

Reviewers: sanjoy, hfinkel, aykevl, sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369158 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGenPrepare] fix RUN line settings
Sanjay Patel [Fri, 16 Aug 2019 21:37:49 +0000 (21:37 +0000)]
[CodeGenPrepare] fix RUN line settings

I'm not sure if this was running as expected with a broken triple.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369156 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Add all missing attribute definitions/symbols
Johannes Doerfert [Fri, 16 Aug 2019 21:31:11 +0000 (21:31 +0000)]
[Attributor] Add all missing attribute definitions/symbols

As a preparation to "on-demand" abstract attribute generation we need
implementations for all attributes (as they can be queried and then
created on-demand where we now fail to find one).

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369155 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RWMutex] Simplify availability check
Jonas Devlieghere [Fri, 16 Aug 2019 21:25:40 +0000 (21:25 +0000)]
[RWMutex] Simplify availability check

Check for the actual version number for the scenarios where the macOS
version isn't available (__MAC_10_12).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369154 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use Register/MCRegister in more places in X86
Craig Topper [Fri, 16 Aug 2019 20:50:23 +0000 (20:50 +0000)]
[X86] Use Register/MCRegister in more places in X86

This was a quick pass through some obvious places. I haven't tried the clang-tidy check.

I also replaced the zeroes in getX86SubSuperRegister with X86::NoRegister which is the real sentinel name.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369151 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 20:40:21 +0000 (20:40 +0000)]
Revert "[ARM] push LR before __gnu_mcount_nc"

This reverts commit f4cf3b959333f62b7a7b2d7771f7010c9d8da388.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369149 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] push LR before __gnu_mcount_nc
Jian Cai [Fri, 16 Aug 2019 20:21:08 +0000 (20:21 +0000)]
[ARM] push LR before __gnu_mcount_nc

Push LR register before calling __gnu_mcount_nc as it expects the value of LR register to be the top value of
the stack on ARM32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369147 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Towards a more structured deduction pattern
Johannes Doerfert [Fri, 16 Aug 2019 19:51:23 +0000 (19:51 +0000)]
[Attributor] Towards a more structured deduction pattern

Summary:
This is the first commit aiming to structure the attribute deduction.
The base idea is that we have default propagation patterns as listed
below on top of which we can add specific, e.g., context sensitive,
logic.

Deduction patterns used in this patch:
  - argument states are determined from call site argument states,
    see AAAlignArgument and AAArgumentFromCallSiteArguments.
  - call site argument states are determined as if they were floating
    values, see AAAlignCallSiteArgument and AAAlignFloating.
  - floating value states are determined by traversing the def-use chain
    and combining the states determined for the leaves, see
    AAAlignFloating and genericValueTraversal.
  - call site return states are determined from function return states,
    see AAAlignCallSiteReturned and AACallSiteReturnedFromReturned.
  - function return states are determined from returned value states,
    see AAAlignReturned and AAReturnedFromReturnedValues.

Through this strategy all logic for alignment is concentrated in the
AAAlignFloating::updateImpl method.

Note: This commit works on its own but is part of a larger change that
involves "on-demand" creation of abstract attributes that will
participate in the fixpoint iteration. Without this part, we sometimes
do not have an AAAlign abstract attribute to query, loosing information
we determined before. All tests have appropriate FIXMEs and the
information will be recovered once we added all parts.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369144 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Introduce aliases for call site attributes
Johannes Doerfert [Fri, 16 Aug 2019 19:49:00 +0000 (19:49 +0000)]
[Attributor][NFC] Introduce aliases for call site attributes

Until we have call site specific liveness and/or value information there
is no need to do call site specific deduction. Though, we need the
symbols in follow up patches that make Attributor::getAAFor return a
reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369143 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Introduce initialize calls and move code to keep attributes concise
Johannes Doerfert [Fri, 16 Aug 2019 19:36:17 +0000 (19:36 +0000)]
[Attributor] Introduce initialize calls and move code to keep attributes concise

Summary:
This patch should not change the behavior except that the added
initialize methods might indicate an optimistic fixpoint earlier. The
code movement is done to keep the attribute definitions in a single
block where it makes sense. No functional changes intended there.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369142 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] Remove some stray debugging output accidentally left in r368707
Lang Hames [Fri, 16 Aug 2019 19:33:37 +0000 (19:33 +0000)]
[ORC] Remove some stray debugging output accidentally left in r368707

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369141 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] canonicalize a scalar-select-of-vectors to vector select
Sanjay Patel [Fri, 16 Aug 2019 18:51:30 +0000 (18:51 +0000)]
[InstCombine] canonicalize a scalar-select-of-vectors to vector select

This pattern may arise more frequently with an enhancement to SLP vectorization suggested in PR42755:
https://bugs.llvm.org/show_bug.cgi?id=42755
...but we should handle this pattern to make things easier for the backend either way.

For all in-tree targets that I looked at, codegen for typical vector sizes looks better when we change
to a vector select, so this is safe to do without a cost model (in other words, as a target-independent
canonicalization).

For example, if the condition of the select is a scalar, we end up with something like this on x86:

vpcmpgtd %xmm0, %xmm1, %xmm0
vpextrb $12, %xmm0, %eax
testb $1, %al
jne LBB0_2
  ## %bb.1:
vmovaps %xmm3, %xmm2
  LBB0_2:
vmovaps %xmm2, %xmm0

Rather than the splat-condition variant:

vpcmpgtd %xmm0, %xmm1, %xmm0
vpshufd $255, %xmm0, %xmm0      ## xmm0 = xmm0[3,3,3,3]
vblendvps %xmm0, %xmm2, %xmm3, %xmm0

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369140 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoEscape % in printf format string.
Evgeniy Stepanov [Fri, 16 Aug 2019 18:23:54 +0000 (18:23 +0000)]
Escape % in printf format string.

Fixes branch-relax-block-size.mir on the ASan builder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369138 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Forbid use of EM_ASM with setjmp/longjmp
Guanzhong Chen [Fri, 16 Aug 2019 18:21:08 +0000 (18:21 +0000)]
[WebAssembly] Forbid use of EM_ASM with setjmp/longjmp

Summary:
We tried to support EM_ASM with setjmp/longjmp in binaryen. But with dynamic
linking thrown into the mix, the code is no longer understandable and cannot
be maintained. We also discovered more bugs in the EM_ASM handling code.

To ensure maintainability and correctness of the binaryen code, EM_ASM will
no longer be supported with setjmp/longjmp. This is probably fine since the
support was added recently and haven't be published.

Reviewers: tlively, sbc100, jgravelle-google, kripken

Reviewed By: tlively, kripken

Subscribers: dschuff, hiraditya, aheejin, sunfish, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369137 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] resolveTargetShuffleInputs - add DemandedElts variant. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 18:13:22 +0000 (18:13 +0000)]
[X86] resolveTargetShuffleInputs - add DemandedElts variant. NFCI.

Nothing calls this yet, everything still goes through the non (all) DemandedElts wrapper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369136 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Lower G_SHUFFLE_VECTOR with 1 elt src and 1 elt mask.
Amara Emerson [Fri, 16 Aug 2019 18:06:53 +0000 (18:06 +0000)]
[AArch64][GlobalISel] Lower G_SHUFFLE_VECTOR with 1 elt src and 1 elt mask.

Again, it's weird that these are allowed. Since lowering support was added in
r368709 we started crashing on compiling the neon intrinsics test in the test
suite. This fixes the lowering to fold the 1 elt src/mask case into copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369135 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] combineExtractWithShuffle - handle extract(truncate(x), 0)
Simon Pilgrim [Fri, 16 Aug 2019 17:35:08 +0000 (17:35 +0000)]
[X86] combineExtractWithShuffle - handle extract(truncate(x), 0)

Eventually we need to generalize combineExtractWithShuffle to handle all faux shuffles and handle truncate (and X86ISD::VTRUNC etc.) there, but we're not ready yet (still creates nodes on the fly, incomplete DemandedElts support, bad use of recursive Depth limit).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369134 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.
Paul Walker [Fri, 16 Aug 2019 17:29:53 +0000 (17:29 +0000)]
[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

Recommit with fixes for mac builders.

Summary:
AArch64InstrInfo::getInstSizeInBytes is incorrectly treating meta
instructions (e.g. CFI_INSTRUCTION) as normal instructions and
giving them a size of 4.

This results in branch relaxation calculating block sizes wrong.
Branch relaxation also considers alignment and thus a single
mistake can result in later blocks being incorrectly sized even
when they themselves do not contain meta instructions.

The net result is we might not relax a branch whose destination is
not within range.

Reviewers: nickdesaulniers, peter.smith

Reviewed By: peter.smith

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 369111

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369133 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instruc...
Paul Walker [Fri, 16 Aug 2019 17:29:42 +0000 (17:29 +0000)]
Revert [AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

This reverts r369111 (git commit 3ccee5f7c4087ed119dbeba537f3df1b048a4dff)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369132 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLPVectorizer] Make the scheduler aware of the TreeEntry operands.
Vasileios Porpodas [Fri, 16 Aug 2019 17:21:18 +0000 (17:21 +0000)]
[SLPVectorizer] Make the scheduler aware of the TreeEntry operands.

Summary:
The scheduler's dependence graph gets the use-def dependencies by accessing the operands of the instructions in a bundle. However, buildTree_rec() may change the order of the operands in TreeEntry, and the scheduler is currently not aware of this. This is not causing any functional issues currently, because reordering is restricted to the operands of a single instruction. Once we support operand reordering across multiple TreeEntries, as shown here: http://www.llvm.org/devmtg/2019-04/slides/Poster-Porpodas-Supernode_SLP.pdf , the scheduler will need to get the correct operands from TreeEntry and not from the individual instructions.

In short, this patch:
- Connects the scheduler's bundle with the corresponding TreeEntry. It introduces new TE and Lane fields in ScheduleData.
- Moves the location where the operands of the TreeEntry are initialized. This used to take place in newTreeEntry() setting one operand at a time, but is now moved pre-order just before the recursion of buildTree_rec(). This is required because the scheduler needs to access both operands of the TreeEntry in tryScheduleBundle().
- Updates the scheduler to access the instruction operands through the TreeEntry operands instead of accessing the instruction operands directly.

Reviewers: ABataev, RKSimon, dtemirbulatov, Ayal, dorit, hfinkel

Reviewed By: ABataev

Subscribers: hiraditya, llvm-commits, lebedev.ri, rcorcs

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369131 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ADT] Remove llvm::make_unique utility.
Jonas Devlieghere [Fri, 16 Aug 2019 17:19:57 +0000 (17:19 +0000)]
[ADT] Remove llvm::make_unique utility.

All uses of llvm::make_unique should have been replaced with
std::make_unique. This patch represents the last part of the migration
and removes the utility from LLVM.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369130 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix llvm-config support for CMake build-mode-style builds
Jordan Rose [Fri, 16 Aug 2019 17:17:45 +0000 (17:17 +0000)]
Fix llvm-config support for CMake build-mode-style builds

At some point we and/or CMake changed our build-mode-style builds from
  $LLVM_OBJ_ROOT/bin/$CMAKE_CFG_INTDIR/
to
  $LLVM_OBJ_ROOT/$CMAKE_CFG_INTDIR/bin/
which is way easier to use. But no one updated llvm-config.

https://reviews.llvm.org/D66326

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369129 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLP] add tests for PR16739; NFC
Sanjay Patel [Fri, 16 Aug 2019 17:01:26 +0000 (17:01 +0000)]
[SLP] add tests for PR16739; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369127 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Alphabetize pass initialization definitions. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 16:41:38 +0000 (16:41 +0000)]
[X86] Alphabetize pass initialization definitions. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369126 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen/Analysis] Intrinsic llvm.assume should not block tail call optimization
Guozhi Wei [Fri, 16 Aug 2019 16:26:12 +0000 (16:26 +0000)]
[CodeGen/Analysis] Intrinsic llvm.assume should not block tail call optimization

In function Analysis.cpp:isInTailCallPosition, instructions between call and ret are checked to see if they block tail call optimization. If an instruction is an intrinsic call, only llvm.lifetime_end is allowed and other intrinsic functions block tail call. When compiling tcmalloc, we found llvm.assume between a hot function call and ret, it blocks the optimization. But llvm.assume doesn't generate instructions, it should not block tail call.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369125 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Hexagon] Generate min/max instructions for 64-bit vectors
Krzysztof Parzyszek [Fri, 16 Aug 2019 16:16:27 +0000 (16:16 +0000)]
[Hexagon] Generate min/max instructions for 64-bit vectors

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369124 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRelanding r368987 [AArch64] Change location of frame-record within callee-save area.
Sander de Smalen [Fri, 16 Aug 2019 15:42:28 +0000 (15:42 +0000)]
Relanding r368987 [AArch64] Change location of frame-record within callee-save area.

Changes:
There was a condition for `!NeedsFrameRecord` missing in the assert. The
assert in question has changed to:

+    assert((!RPI.isPaired() || !NeedsFrameRecord || RPI.Reg2 != AArch64::FP ||
+            RPI.Reg1 == AArch64::LR) &&
+           "FrameRecord must be allocated together with LR");

This addresses PR43016.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369122 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Simplify pow(2.0, itofp(y)) to ldexp(1.0, y)
Evandro Menezes [Fri, 16 Aug 2019 15:33:41 +0000 (15:33 +0000)]
[InstCombine] Simplify pow(2.0, itofp(y)) to ldexp(1.0, y)

Simplify `pow(2.0, itofp(y))` to `ldexp(1.0, y)`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369120 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TextAPI] Update reader to be supported by lib/Object
Cyndy Ishida [Fri, 16 Aug 2019 15:30:48 +0000 (15:30 +0000)]
[TextAPI] Update reader to be supported by lib/Object

Summary:
To be able to use the TextAPI/Reader for tbd file consumption (by libObject)
it gets passed a MemoryBufferRef which isn't castable to MemoryBuffer.
Updated the tests to expect that input as well.

Reviewers: ributzka, steven_wu

Reviewed By: steven_wu

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369119 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] MVE sext of a load is free
David Green [Fri, 16 Aug 2019 15:13:37 +0000 (15:13 +0000)]
[ARM] MVE sext of a load is free

MVE also has some sext of loads, which will be free just as scalar
instructions are.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369118 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Shift amount reassociation in bittest: trunc-of-shl (PR42399)
Roman Lebedev [Fri, 16 Aug 2019 15:10:41 +0000 (15:10 +0000)]
[InstCombine] Shift amount reassociation in bittest: trunc-of-shl (PR42399)

Summary:
This is continuation of D63829 / https://bugs.llvm.org/show_bug.cgi?id=42399

I thought naive pattern would solve my issue, but nope, it involved truncation,
thus more folds needed.. This isn't really the fold i'm interested in,
i need trunc-of-lshr, but i'we decided to start with `shl` because it's simpler.

In this case, no extra legality checks are needed:
https://rise4fun.com/Alive/CAb

We should be careful about not increasing instruction count,
since we need to produce `zext` because `and` is done in wider type.

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369117 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:47:59 +0000 (14:47 +0000)]
[X86][SSE] Add shuffled load tests from PR16739

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369116 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert rL369112 : [X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:31:45 +0000 (14:31 +0000)]
Revert rL369112 : [X86][SSE] Add shuffled load tests from PR16739

I left typos in this from a WIP copy - reverting and I'll recommit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369115 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Convert registers from unsigned to Register
Luis Marques [Fri, 16 Aug 2019 14:27:50 +0000 (14:27 +0000)]
[RISCV] Convert registers from unsigned to Register

Only in public interfaces that have not yet been converted should there remain
registers with unsigned type.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369114 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add shuffled load tests from PR16739
Simon Pilgrim [Fri, 16 Aug 2019 14:26:11 +0000 (14:26 +0000)]
[X86][SSE] Add shuffled load tests from PR16739

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369112 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.
Paul Walker [Fri, 16 Aug 2019 14:17:52 +0000 (14:17 +0000)]
[AArch64InstrInfo] Stop getInstSizeInBytes returning non-zero for meta instructions.

Summary:
AArch64InstrInfo::getInstSizeInBytes is incorrectly treating meta
instructions (e.g. CFI_INSTRUCTION) as normal instructions and
giving them a size of 4.

This results in branch relaxation calculating block sizes wrong.
Branch relaxation also considers alignment and thus a single
mistake can result in later blocks being incorrectly sized even
when they themselves do not contain meta instructions.

The net result is we might not relax a branch whose destination is
not within range.

Reviewers: nickdesaulniers, peter.smith

Reviewed By: peter.smith

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369111 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove unused include. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 14:05:46 +0000 (14:05 +0000)]
[X86] Remove unused include. NFCI.

We don't use anything from TargetOptions.h directly and its included via TargetLowering.h anyhow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369110 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Correct register for narrowing and widening MVE loads and stores.
David Green [Fri, 16 Aug 2019 13:42:39 +0000 (13:42 +0000)]
[ARM] Correct register for narrowing and widening MVE loads and stores.

The widening and narrowing MVE instructions like VLDRH.32 are only permitted to
use low tGPR registers. This means that if they are used for a stack slot,
where the register used is only decided during frame setup, we need to be able
to correctly pick a thumb1 register over a normal GPR.

This attempts to add the required logic into eliminateFrameIndex and
rewriteT2FrameIndex, only picking the FrameReg if it is a valid register for
the operands register class, and picking a valid scratch register for the
register class.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369108 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] fix fdiv test; NFC
Sanjay Patel [Fri, 16 Aug 2019 13:31:23 +0000 (13:31 +0000)]
[x86] fix fdiv test; NFC

The test was just added with rL369106, but forgot to update the instruction
along with the test name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369107 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add tests for fdiv with variable operands; NFC
Sanjay Patel [Fri, 16 Aug 2019 13:23:52 +0000 (13:23 +0000)]
[x86] add tests for fdiv with variable operands; NFC

D66050 proposes to change the estimate sequence, but we
don't seem to have test coverage for the common case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369106 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the...
Florian Hahn [Fri, 16 Aug 2019 13:19:29 +0000 (13:19 +0000)]
Revert [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

This reverts r368997 (git commit 2a903c0b679bae1919f9fc01f78e4bc6cff2add0)

It looks like this commit adds invalid predecessors to MBBs. The example
below fails the verifier after MachineBlockPlacement (run llc
-verify-machineinstrs):

@global.4 = external constant i8*

declare i32 @zot(...)

define i16* @snork.67() personality i8* bitcast (i32 (...)* @zot to i8*) {
bb:
  invoke void undef()
          to label %bb5 unwind label %bb4

bb4:                                              ; preds = %bb
  %tmp = landingpad { i8*, i32 }
          catch i8* null
  unreachable

bb5:                                              ; preds = %bb
  %tmp6 = load i32, i32* null, align 4
  %tmp7 = icmp eq i32 %tmp6, 0
  br i1 %tmp7, label %bb14, label %bb8

bb8:                                              ; preds = %bb11, %bb5
  invoke void undef()
          to label %bb9 unwind label %bb11

bb9:                                              ; preds = %bb8
  %tmp10 = invoke i16* undef()
          to label %bb14 unwind label %bb11

bb11:                                             ; preds = %bb9, %bb8
  %tmp12 = landingpad { i8*, i32 }
          cleanup
          catch i8* bitcast (i8** @global.4 to i8*)
  %tmp13 = icmp ult i64 undef, undef
  br i1 %tmp13, label %bb8, label %bb14

bb14:                                             ; preds = %bb11, %bb9, %bb5
  %tmp15 = phi i16* [ null, %bb5 ], [ null, %bb11 ], [ %tmp10, %bb9 ]
  ret i16* %tmp15
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369104 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT
Bjorn Pettersson [Fri, 16 Aug 2019 13:16:48 +0000 (13:16 +0000)]
[DAGCombiner] Add simple folds for SMULFIX/UMULFIX/SMULFIXSAT

Summary:
Add the following DAGCombiner folds for mulfix being
one of SMULFIX/UMULFIX/SMULFIXSAT:
  (mulfix x, undef, scale) -> 0
  (mulfix x, 0, scale) -> 0

Also added canonicalization of constants to RHS.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369103 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test case for future MULFIX DAG combine folds. NFC
Bjorn Pettersson [Fri, 16 Aug 2019 13:16:38 +0000 (13:16 +0000)]
[X86] Add test case for future MULFIX DAG combine folds. NFC

Add some test cases displaying the lack of DAG combine
folds for SMULFIX/UMULFIX/SMULFIXSAT when either
multiplicand is undef or zero.

It seems like widening vector legalization for X86 can
introduce fixed point multiplication of undef values.
So that is one way that such operations could appear
during ISel.

Multiplication with zero is probably more unlikely, and
could potentially be handled by InstCombine. But I do
not think it would hurt to do such folds in DAGCombiner.

This patch only adds the test case. The folds will be
added in a follow up patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369102 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Don't pretend we know how to generate MVE VLDn
David Green [Fri, 16 Aug 2019 13:06:49 +0000 (13:06 +0000)]
[ARM] Don't pretend we know how to generate MVE VLDn

We don't yet know how to generate these instructions for MVE. And in the case
of VLD3, we don't even have the instruction. For the moment don't tell the
vectoriser that we have VLD4, just to end up serialising the results.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369101 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Allow parsing of bare symbols with offsets
Lewis Revill [Fri, 16 Aug 2019 12:00:56 +0000 (12:00 +0000)]
[RISCV] Allow parsing of bare symbols with offsets

This patch allows symbols followed by an expression for an offset to be
parsed as bare symbols.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369097 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[CallGraph] Refine call graph for indirect calls with !callees metadata"
Benjamin Kramer [Fri, 16 Aug 2019 10:59:18 +0000 (10:59 +0000)]
Revert "[CallGraph] Refine call graph for indirect calls with !callees metadata"

This reverts commit r369025. Crashes clang, test case is on the mailing
list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369096 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Lower inline asm constraint A for RISC-V
Lewis Revill [Fri, 16 Aug 2019 10:28:34 +0000 (10:28 +0000)]
[RISCV] Lower inline asm constraint A for RISC-V

This allows arguments with the constraint A to be lowered to input nodes
for RISC-V, which implies a memory address stored in a register.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

https://reviews.llvm.org/D54296

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369095 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLPVectorizer] Silence null dereference warning. NFCI.
Simon Pilgrim [Fri, 16 Aug 2019 10:28:23 +0000 (10:28 +0000)]
[SLPVectorizer] Silence null dereference warning. NFCI.

cppcheck + MSVC analyzer both over zealously warn that we might dereference a null Bundle pointer - add an assertion to check for null to silence the warning, plus its a good idea to check that we succeeded in finding a schedule bundle anyway....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369094 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Handle complex expressions with spills in LiveDebugValues
Jeremy Morse [Fri, 16 Aug 2019 10:04:17 +0000 (10:04 +0000)]
[DebugInfo] Handle complex expressions with spills in LiveDebugValues

In r369026 we disabled spill-recognition in LiveDebugValues for anything
that has a complex expression. This is because it's hard to recover the
complex expression once the spill location is baked into it.

This patch re-enables spill-recognition and slightly adjusts the DBG_VALUE
insts that LiveDebugValues tracks: instead of tracking the last DBG_VALUE
for a variable, it tracks the last _unspilt_ DBG_VALUE. The spill-restore
code is then able to access and copy the original complex expression; but
the rest of LiveDebugValues has to be aware of the slight semantic shift,
and produce a new spilt location if a spilt location is propagated between
blocks.

The test added produces an incorrect variable location (see FIXME), which
will be the subject of future work.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369092 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAssumptionCache: remove old affected values after RAUW.
Tim Northover [Fri, 16 Aug 2019 09:34:27 +0000 (09:34 +0000)]
AssumptionCache: remove old affected values after RAUW.

If they're left in the cache then they can't be removed efficiently when the
cache is notified to unlink a @llvm.assume call, and that can lead to values
from different functions entirely remaining there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369091 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ValueTracking] Fix recurrence detection to check both PHI operands.
Florian Hahn [Fri, 16 Aug 2019 09:15:02 +0000 (09:15 +0000)]
[ValueTracking] Fix recurrence detection to check both PHI operands.

Summary:
Currently we fail to compute known bits for recurrences where the
first incoming value is the start value of the recurrence.

Instead of exiting the loop when the first incoming value is not
the step of the recurrence, continue to check the second incoming
value.

The original code uses a loop to handle both cases, but incorrectly
exits instead of continuing.

Reviewers: lebedev.ri, spatel, nikic

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369088 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Manually reimplement getTargetInsertSubreg in X86DAGToDAGISel::matchBitExtract...
Craig Topper [Fri, 16 Aug 2019 04:47:44 +0000 (04:47 +0000)]
[X86] Manually reimplement getTargetInsertSubreg in X86DAGToDAGISel::matchBitExtract so we can call insertDAGNode on the target constant.

This is needed to maintain the topological sort order.

Fixes PR42992.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369084 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove the temporary code. NFC.
Igor Kudrin [Fri, 16 Aug 2019 03:40:04 +0000 (03:40 +0000)]
Remove the temporary code. NFC.

That should have been done in rL368156 but somehow was missed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369082 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r368987, it caused PR43016.
Nico Weber [Fri, 16 Aug 2019 02:21:21 +0000 (02:21 +0000)]
Revert r368987, it caused PR43016.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369080 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC] add testcases for folding frame offset - NFC
Chen Zheng [Fri, 16 Aug 2019 01:52:50 +0000 (01:52 +0000)]
[PowerPC] add testcases for folding frame offset - NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369077 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369064
Nico Weber [Fri, 16 Aug 2019 00:04:48 +0000 (00:04 +0000)]
gn build: Merge r369064

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369074 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369061
Nico Weber [Fri, 16 Aug 2019 00:04:42 +0000 (00:04 +0000)]
gn build: Merge r369061

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369073 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugLine] Don't try to guess the path style
Jonas Devlieghere [Thu, 15 Aug 2019 23:53:15 +0000 (23:53 +0000)]
[DebugLine] Don't try to guess the path style

In r368879 I made an attempt to guess the path style from the files in
the line table. After some consideration I now think this is a poor
idea. This patch undoes that behavior and instead adds an optional
argument to specify the path style. This allows us to make that decision
elsewhere where we have more information. In case of LLDB based on the
Unit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369072 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] CSEMIRBuilder: Add support for G_GEP
Volkan Keles [Thu, 15 Aug 2019 23:45:45 +0000 (23:45 +0000)]
[GlobalISel] CSEMIRBuilder: Add support for G_GEP

Summary:
This patch adds G_GEP to `shouldCSEOpc` so that it can be CSEd. It also refactors
`translateGetElementPtr` by replacing `createGenericVirtualRegister` calls with types.

Reviewers: aditya_nandakumar, arsenm, dsanders, paquette, aemerson

Reviewed By: aditya_nandakumar

Subscribers: wdng, rovka, javed.absar, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369070 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][LowOverheadLoops] Fix generated code for "revert".
Eli Friedman [Thu, 15 Aug 2019 23:35:53 +0000 (23:35 +0000)]
[ARM][LowOverheadLoops] Fix generated code for "revert".

Two issues:

1. t2CMPri shouldn't use CPSR if it isn't predicated. This doesn't
really have any visible effect at the moment, but it might matter in the
future.
2. The t2CMPri generated for t2WhileLoopStart might need to use a
register that isn't LR.

My team found this because we have a patch to track register liveness
late in the pass pipeline. I'll look into upstreaming it to help catch
issues like this earlier.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369069 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM][PassInstrumentation] Fix test added in r369024.
David L. Jones [Thu, 15 Aug 2019 23:24:14 +0000 (23:24 +0000)]
[NewPM][PassInstrumentation] Fix test added in r369024.

llvm-lto2 doesn't treat "-" as stdout, so the test added in r369024 creates a
file named "-.0". This patch makes the test look more like other tests that use
llvm-lto2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369066 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Re-introduce the RWMutexImpl for macOS < 10.12
Jonas Devlieghere [Thu, 15 Aug 2019 23:07:20 +0000 (23:07 +0000)]
[Support] Re-introduce the RWMutexImpl for macOS < 10.12

In r369018, Benjamin replaced the custom RWMutex implementation with
their C++14 counterpart. Unfortunately, std::shared_timed_mutex is only
available on macOS 10.12 and later. This prevents LLVM from compiling
even on newer versions of the OS when you have an older deployment
target. This patch reintroduced the old RWMutexImpl but guards it by the
macOS availability macro.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369064 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMove isPointerOffset function to ValueTracking (NFC).
Evgeniy Stepanov [Thu, 15 Aug 2019 22:58:28 +0000 (22:58 +0000)]
Move isPointerOffset function to ValueTracking (NFC).

Summary: To be reused in MemTag sanitizer.

Reviewers: pcc, vitalybuka, ostannard

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369062 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Bugpoint redesign] Added Pass to Remove Global Variables
Diego Trevino Ferrer [Thu, 15 Aug 2019 22:54:09 +0000 (22:54 +0000)]
[Bugpoint redesign] Added Pass to Remove Global Variables

Summary:
This pass tries to remove Global Variables, as well as their derived uses. For example if a variable `@x` is used by `%call1` and `%call2`, both these uses and the definition of `@x` are deleted. Moreover if `%call1` or `%call2` are used elsewhere those uses are also deleted, and so on recursively.

I'm still uncertain if this pass should remove derived uses, I'm open to suggestions.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368918

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369061 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Bugpoint redesign] Output option can now print to STDOUT
Diego Trevino Ferrer [Thu, 15 Aug 2019 22:39:43 +0000 (22:39 +0000)]
[Bugpoint redesign] Output option can now print to STDOUT

Summary:
This also changes all the outs() statements to errs() so the output and
progress streams don't get mixed.

This has been added because D64176 had flaky tests, which I believe were because the reduced file was being catted into `FileCheck`, instead of being pass from STDOUT directly.

Reviewers: chandlerc, dblaikie, xbolva00

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369060 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[Support] Re-introduce the RWMutexImpl for macOS < 10.12"
Jonas Devlieghere [Thu, 15 Aug 2019 22:24:21 +0000 (22:24 +0000)]
Revert "[Support] Re-introduce the RWMutexImpl for macOS < 10.12"

This doesn't work (yet).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369059 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AIX] For XL, pick GCC-compatible std & default warning options
Hubert Tong [Thu, 15 Aug 2019 22:23:53 +0000 (22:23 +0000)]
[AIX] For XL, pick GCC-compatible std & default warning options

Summary:
LLVM now requires C++14. For IBM XL compilers with C++14 support, this
can be done with the GCC-style options. The relevant block in the CMake
file is split up into smaller parts as part of this patch to allow the
common cases to be shared.

Reviewers: jfb, jasonliu, daltenty, xingxue

Reviewed By: jfb, xingxue

Subscribers: mstorsjo, mgorny, dexonsmith, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369058 91177308-0d34-0410-b5e6-96231b3b80d8