]> granicus.if.org Git - llvm/log
llvm
5 years ago[SelectionDAG] Widen vector results of SMULFIX/UMULFIX/SMULFIXSAT
Bjorn Pettersson [Sun, 11 Aug 2019 19:27:06 +0000 (19:27 +0000)]
[SelectionDAG] Widen vector results of SMULFIX/UMULFIX/SMULFIXSAT

Summary:
After the commits that changed x86 backend to widen vectors
instead of using promotion some of our downstream tests
started to fail. It was noticed that WidenVectorResult has
been missing support for SMULFIX/UMULFIX/SMULFIXSAT. This
patch adds the missing functionality.

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Simplify some of the type checks in combineSubToSubus.
Craig Topper [Sun, 11 Aug 2019 17:36:49 +0000 (17:36 +0000)]
[X86] Simplify some of the type checks in combineSubToSubus.

If we have SSE2 we can handle any i8/i16 type and let
type legalization deal with it.

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

5 years ago[X86] Don't use SplitOpsAndApply for ISD::USUBSAT.
Craig Topper [Sun, 11 Aug 2019 17:36:45 +0000 (17:36 +0000)]
[X86] Don't use SplitOpsAndApply for ISD::USUBSAT.

Target independent type legalization and custom lowering
should be able to handle it.

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

5 years ago[NFC][CodeGen] Use while loop instead for loop in MachineBlockPlacement::optimizeBran...
Kang Zhang [Sun, 11 Aug 2019 12:58:50 +0000 (12:58 +0000)]
[NFC][CodeGen] Use while loop instead for loop in MachineBlockPlacement::optimizeBranches()
This will pass EXPENSIVE check.

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

5 years ago[ARM] MVE spill vector test. NFC
David Green [Sun, 11 Aug 2019 09:12:57 +0000 (09:12 +0000)]
[ARM] MVE spill vector test. NFC

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

5 years ago[MVE] Don't try to unroll vectorised MVE loops
David Green [Sun, 11 Aug 2019 08:53:18 +0000 (08:53 +0000)]
[MVE] Don't try to unroll vectorised MVE loops

Due to the nature of the beat system in the MVE architecture, along with tail
predication and low-overhead loops, unrolling has less benefit compared to
normal loops. You can not, for example, hide the latency of a load with other
instructions as you can for scalar code. Preventing unrolling also makes the
code easier to read and reason about.

So if a loop contains vector code, don't enable the runtime unrolling. At least
for the time being.

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

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

5 years ago[ARM] Permit auto-vectorization using MVE
David Green [Sun, 11 Aug 2019 08:42:57 +0000 (08:42 +0000)]
[ARM] Permit auto-vectorization using MVE

With enough codegen complete, we can now correctly report the number and size
of vector registers for MVE, allowing auto vectorisation. This also allows FP
auto-vectorization for MVE without -Ofast/-ffast-math, due to support for IEEE
FP arithmetic and parity between scalar and vector FP behaviour.

Patch by David Sherwood.

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

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

5 years agoFix __clang_call_termiante's argument for foreign exceptions
Heejin Ahn [Sun, 11 Aug 2019 06:24:07 +0000 (06:24 +0000)]
Fix __clang_call_termiante's argument for foreign exceptions

Summary:
When exceptions are repeatedly thrown in the middle of handling another
exception, we call `__clang_call_terminate` with the exception pointer
(i32) as an argument. But in case of foreign exceptions, we don't have
the pointer, so we call the function with 0. (This requires
`__clang_call_terminate` can deal with 0 argument, which will be done
later)

But previously the 0 argument was not added as a `i32.const 0` but an
immediate by mistake, causing the `call` instruction to take not an i32
but rather an exnref, because an `exnref` is left on top of the value
stack if `br_on_exn` is not taken.

```
block i32
  br_on_exn 0, __cpp_exception
                               ;; exnref is on top of stack now
  i32.const 0                  ;; This was missing!
  call __clang_call_terminate
  unreachable
end
call __clang_call_terminate    ;; This takes i32 extracted by br_on_exn
```

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[LICM] Make Loop ICM profile aware
Wenlei He [Sun, 11 Aug 2019 06:05:35 +0000 (06:05 +0000)]
[LICM] Make Loop ICM profile aware

Summary:
Hoisting/sinking instruction out of a loop isn't always beneficial. Hoisting an instruction from a cold block inside a loop body out of the loop could hurt performance. This change makes Loop ICM profile aware - it now checks block frequency to make sure hoisting/sinking anly moves instruction to colder block.

Test Plan:

ninja check

Reviewers: asbirlea, sanjoy, reames, nikic, hfinkel, vsk

Reviewed By: asbirlea

Subscribers: fhahn, vsk, davidxl, xbolva00, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoRevert "test commit"
Wenlei He [Sun, 11 Aug 2019 05:59:20 +0000 (05:59 +0000)]
Revert "test commit"

This reverts commit ad92a4a2769425ad0d39ac1dbb6282f6f51a1af7.

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

5 years agotest commit
Wenlei He [Sun, 11 Aug 2019 05:50:28 +0000 (05:50 +0000)]
test commit

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

5 years ago[X86] Remove some more code from combineShuffle that is no longer needed with widenin...
Craig Topper [Sun, 11 Aug 2019 02:17:18 +0000 (02:17 +0000)]
[X86] Remove some more code from combineShuffle that is no longer needed with widening legalization.

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

5 years ago[X86] Remove some code from combineShuffle that seems largely unnecessary with wideni...
Craig Topper [Sun, 11 Aug 2019 02:08:38 +0000 (02:08 +0000)]
[X86] Remove some code from combineShuffle that seems largely unnecessary with widening legalization.

The test case that changed is probably better served through
allowing combineTruncatedArithmetic to create narrow vectors. It
also appears InstCombine would have simplified this test case
to remove the zext and trunc anyway.

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

5 years ago[InstCombine][NFC] Use SimplifyAddInst() instead of SimplifyBinOp(Instruction::Binary...
Roman Lebedev [Sat, 10 Aug 2019 19:29:10 +0000 (19:29 +0000)]
[InstCombine][NFC] Use SimplifyAddInst() instead of SimplifyBinOp(Instruction::BinaryOps::Add, )

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

5 years ago[NFC][InstCombine] Tests for shift amount reassociation in bittest with truncated...
Roman Lebedev [Sat, 10 Aug 2019 19:29:03 +0000 (19:29 +0000)]
[NFC][InstCombine] Tests for shift amount reassociation in bittest with truncated shl (PR42399)

trunc-of-shl:
  https://rise4fun.com/Alive/zGx
  https://rise4fun.com/Alive/sl0L
I.e. no extra legality check needed.

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

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

5 years ago[InstCombine] Shift amount reassociation in bittest: relax one-use check when shiftin...
Roman Lebedev [Sat, 10 Aug 2019 19:28:54 +0000 (19:28 +0000)]
[InstCombine] Shift amount reassociation in bittest: relax one-use check when shifting constant

If one of the values being shifted is a constant, since the new shift
amount is known-constant, the new shift will end up being constant-folded
so, we don't need that one-use restriction then.

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

5 years ago[InstCombine] Shift amount reassociation in bittest: drop pointless one-use restriction
Roman Lebedev [Sat, 10 Aug 2019 19:28:44 +0000 (19:28 +0000)]
[InstCombine] Shift amount reassociation in bittest: drop pointless one-use restriction

That one-use restriction is not needed for correctness - we have already
ensured that one of the shifts will go away, so we know we won't increase
the instruction count. So there is no need for that restriction.

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

5 years ago[NFC][InstCombine] Tests for shift amount reassociation in bittest with shift of...
Roman Lebedev [Sat, 10 Aug 2019 19:28:12 +0000 (19:28 +0000)]
[NFC][InstCombine] Tests for shift amount reassociation in bittest with shift of const

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

5 years ago[X86][SSE] Lower shuffle as ANY_EXTEND_VECTOR_INREG
Simon Pilgrim [Sat, 10 Aug 2019 16:46:07 +0000 (16:46 +0000)]
[X86][SSE] Lower shuffle as ANY_EXTEND_VECTOR_INREG

On SSE41+ targets we always lower vector shuffles to ZERO_EXTEND_VECTOR_INREG, even if we don't need the extended bits.

This patch relaxes this so that we lower to ANY_EXTEND_VECTOR_INREG if we can, meaning that shuffle combines have a better idea of what elements need to be kept zero. This helps the multiple reduction code as we can now combine away a lot more of the pack+extend codes.

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

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

5 years ago[NFC][CodeGen] Modify the PI++ to ++PI in MachineBlockPlacement::optimizeBranches()
Kang Zhang [Sat, 10 Aug 2019 16:23:17 +0000 (16:23 +0000)]
[NFC][CodeGen] Modify the PI++ to ++PI in MachineBlockPlacement::optimizeBranches()

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

5 years ago[TableGen] Correct the shift to the proper bit width.
Michael Liao [Sat, 10 Aug 2019 16:15:06 +0000 (16:15 +0000)]
[TableGen] Correct the shift to the proper bit width.

- Replace the previous 32-bit shift with 64-bit one matching `OpInit`.

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

5 years ago[Reassociate] try harder to convert negative FP constants to positive
Sanjay Patel [Sat, 10 Aug 2019 13:17:54 +0000 (13:17 +0000)]
[Reassociate] try harder to convert negative FP constants to positive

This is an extension of a transform that tries to produce positive floating-point
constants to improve canonicalization (and hopefully lead to more reassociation
and CSE).

The original patches were:
D4904
D5363 (rL221721)

But as the test diffs show, these were limited to basic patterns by walking from
an instruction to its single user rather than recursively moving up the def-use
sequence. No fast-math is required here because we're only rearranging implicit
FP negations in intermediate ops.

A motivating bug is:
https://bugs.llvm.org/show_bug.cgi?id=32939

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368512 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, 10 Aug 2019 09:58:52 +0000 (09:58 +0000)]
[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Summary:

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@368509 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Match the IR pattern form movmsk on SSE1 only targets where v4i32 isn't legal
Craig Topper [Sat, 10 Aug 2019 07:51:13 +0000 (07:51 +0000)]
[X86] Match the IR pattern form movmsk on SSE1 only targets where v4i32 isn't legal

Summary:
This patch adds a special DAG combine for SSE1 to recognize the IR pattern InstCombine gives us for movmsk. This only does the recognition for a few cases where its obvious the input won't be scalarized resulting in building a vector just do to the movmsk. I've made it separate from our existing matching for movmsk since that's called in multiple places and I didn't spend time to see if the other callers would make sense here. Plus the restrictions and additional checks would complicate that.

This fixes the case from PR42870. Buts its probably still broken the presence of logic ops feeding the movmsk pattern which would further hide the v4f32 type.

Reviewers: spatel, RKSimon, xbolva00

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Improve the diagnostic for larger than 4-bit immediate for vpermil2pd/ps. Only...
Craig Topper [Sat, 10 Aug 2019 04:28:52 +0000 (04:28 +0000)]
[X86] Improve the diagnostic for larger than 4-bit immediate for vpermil2pd/ps. Only allow MCConstantExprs.

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

5 years ago[X86] Fix stack probe issue on windows32.
Luo, Yuanke [Sat, 10 Aug 2019 02:49:02 +0000 (02:49 +0000)]
[X86] Fix stack probe issue on windows32.

Summary:
On windows if the frame size exceed 4096 bytes, compiler need to
generate a call to _alloca_probe. X86CallFrameOptimization pass
changes the reserved stack size and cause of stack probe function
not be inserted. This patch fix the issue by detecting the call
frame size, if the size exceed 4096 bytes, drop X86CallFrameOptimization.

Reviewers: craig.topper, wxiao3, annita.zhang, rnk, RKSimon

Reviewed By: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[MemDep] allow to select block-scan-limit when constructing MemoryDependenceAnalysis
Fedor Sergeev [Sat, 10 Aug 2019 01:23:38 +0000 (01:23 +0000)]
[MemDep] allow to select block-scan-limit when constructing MemoryDependenceAnalysis

Introducing non-global control for default block-scan-limit in MemDep analysis.
Useful when there are many compilations per initialized LLVM instance (e.g. JIT).

Reviewed By: asbirlea
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65806

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

5 years agocfi-icall: Allow the jump table to be optionally made non-canonical.
Peter Collingbourne [Fri, 9 Aug 2019 22:31:59 +0000 (22:31 +0000)]
cfi-icall: Allow the jump table to be optionally made non-canonical.

The default behavior of Clang's indirect function call checker will replace
the address of each CFI-checked function in the output file's symbol table
with the address of a jump table entry which will pass CFI checks. We refer
to this as making the jump table `canonical`. This property allows code that
was not compiled with ``-fsanitize=cfi-icall`` to take a CFI-valid address
of a function, but it comes with a couple of caveats that are especially
relevant for users of cross-DSO CFI:

- There is a performance and code size overhead associated with each
  exported function, because each such function must have an associated
  jump table entry, which must be emitted even in the common case where the
  function is never address-taken anywhere in the program, and must be used
  even for direct calls between DSOs, in addition to the PLT overhead.

- There is no good way to take a CFI-valid address of a function written in
  assembly or a language not supported by Clang. The reason is that the code
  generator would need to insert a jump table in order to form a CFI-valid
  address for assembly functions, but there is no way in general for the
  code generator to determine the language of the function. This may be
  possible with LTO in the intra-DSO case, but in the cross-DSO case the only
  information available is the function declaration. One possible solution
  is to add a C wrapper for each assembly function, but these wrappers can
  present a significant maintenance burden for heavy users of assembly in
  addition to adding runtime overhead.

For these reasons, we provide the option of making the jump table non-canonical
with the flag ``-fno-sanitize-cfi-canonical-jump-tables``. When the jump
table is made non-canonical, symbol table entries point directly to the
function body. Any instances of a function's address being taken in C will
be replaced with a jump table address.

This scheme does have its own caveats, however. It does end up breaking
function address equality more aggressively than the default behavior,
especially in cross-DSO mode which normally preserves function address
equality entirely.

Furthermore, it is occasionally necessary for code not compiled with
``-fsanitize=cfi-icall`` to take a function address that is valid
for CFI. For example, this is necessary when a function's address
is taken by assembly code and then called by CFI-checking C code. The
``__attribute__((cfi_jump_table_canonical))`` attribute may be used to make
the jump table entry of a specific function canonical so that the external
code will end up taking a address for the function that will pass CFI checks.

Fixes PR41972.

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

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

5 years agoAdd missing REQUIRES to r368487
Daniel Sanders [Fri, 9 Aug 2019 22:16:16 +0000 (22:16 +0000)]
Add missing REQUIRES to r368487

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

5 years ago[Bugpoint redesign] Fix nonlocal URI link in doc
Diego Trevino Ferrer [Fri, 9 Aug 2019 21:48:47 +0000 (21:48 +0000)]
[Bugpoint redesign] Fix nonlocal URI link in doc

Summary: Fixes documentation bot build  http://lab.llvm.org:8011/builders/llvm-sphinx-docs

Reviewers: JDevlieghere

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[DAGCombiner] exclude x*2.0 from normal negation profitability rules
Sanjay Patel [Fri, 9 Aug 2019 21:37:32 +0000 (21:37 +0000)]
[DAGCombiner] exclude x*2.0 from normal negation profitability rules

This is the codegen part of fixing:
https://bugs.llvm.org/show_bug.cgi?id=32939

Even with the optimal/canonical IR that is ideally created by D65954,
we would reverse that transform in DAGCombiner and end up with the same
asm on AArch64 or x86.

I see 2 options for trying to correct this:

  1. Limit isNegatibleForFree() by special-casing the fmul pattern (this patch).
  2. Avoid creating (fmul X, 2.0) in the 1st place by adding a special-case
     transform to SelectionDAG::getNode() and/or SelectionDAGBuilder::visitFMul()
     that matches the transform done by DAGCombiner.

This seems like the less intrusive patch, but if there's some other reason to
prefer 1 option over the other, we can change to the other option.

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

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

5 years agoRemove leftover MF->dump()'s from r368487 that break release builds
Daniel Sanders [Fri, 9 Aug 2019 21:33:31 +0000 (21:33 +0000)]
Remove leftover MF->dump()'s from r368487 that break release builds

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

5 years ago[globalisel] Add G_SEXT_INREG
Daniel Sanders [Fri, 9 Aug 2019 21:11:20 +0000 (21:11 +0000)]
[globalisel] Add G_SEXT_INREG

Summary:
Targets often have instructions that can sign-extend certain cases faster
than the equivalent shift-left/arithmetic-shift-right. Such cases can be
identified by matching a shift-left/shift-right pair but there are some
issues with this in the context of combines. For example, suppose you can
sign-extend 8-bit up to 32-bit with a target extend instruction.
  %1:_(s32) = G_SHL %0:_(s32), i32 24 # (I've inlined the G_CONSTANT for brevity)
  %2:_(s32) = G_ASHR %1:_(s32), i32 24
  %3:_(s32) = G_ASHR %2:_(s32), i32 1
would reasonably combine to:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 25
which no longer matches the special case. If your shifts and extend are
equal cost, this would break even as a pair of shifts but if your shift is
more expensive than the extend then it's cheaper as:
  %2:_(s32) = G_SEXT_INREG %0:_(s32), i32 8
  %3:_(s32) = G_ASHR %2:_(s32), i32 1
It's possible to match the shift-pair in ISel and emit an extend and ashr.
However, this is far from the only way to break this shift pair and make
it hard to match the extends. Another example is that with the right
known-zeros, this:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 24
  %3:_(s32) = G_MUL %2:_(s32), i32 2
can become:
  %1:_(s32) = G_SHL %0:_(s32), i32 24
  %2:_(s32) = G_ASHR %1:_(s32), i32 23

All upstream targets have been configured to lower it to the current
G_SHL,G_ASHR pair but will likely want to make it legal in some cases to
handle their faster cases.

To follow-up: Provide a way to legalize based on the constant. At the
moment, I'm thinking that the best way to achieve this is to provide the
MI in LegalityQuery but that opens the door to breaking core principles
of the legalizer (legality is not context sensitive). That said, it's
worth noting that looking at other instructions and acting on that
information doesn't violate this principle in itself. It's only a
violation if, at the end of legalization, a pass that checks legality
without being able to see the context would say an instruction might not be
legal. That's a fairly subtle distinction so to give a concrete example,
saying %2 in:
  %1 = G_CONSTANT 16
  %2 = G_SEXT_INREG %0, %1
is legal is in violation of that principle if the legality of %2 depends
on %1 being constant and/or being 16. However, legalizing to either:
  %2 = G_SEXT_INREG %0, 16
or:
  %1 = G_CONSTANT 16
  %2:_(s32) = G_SHL %0, %1
  %3:_(s32) = G_ASHR %2, %1
depending on whether %1 is constant and 16 does not violate that principle
since both outputs are genuinely legal.

Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, arsenm

Subscribers: sdardis, jvesely, wdng, nhaehnle, rovka, kristof.beyls, javed.absar, hiraditya, jrtc27, atanasyan, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years agoRemove variable only used in an assert.
Eric Christopher [Fri, 9 Aug 2019 21:02:47 +0000 (21:02 +0000)]
Remove variable only used in an assert.

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

5 years agoRevert the test commit
Taewook Oh [Fri, 9 Aug 2019 20:52:39 +0000 (20:52 +0000)]
Revert the test commit

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

5 years agoTest commit.
Taewook Oh [Fri, 9 Aug 2019 20:48:53 +0000 (20:48 +0000)]
Test commit.

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

5 years ago[X86] Remove custom handling for extloads from LowerLoad.
Craig Topper [Fri, 9 Aug 2019 20:27:22 +0000 (20:27 +0000)]
[X86] Remove custom handling for extloads from LowerLoad.

We don't appear to need this with widening legalization.

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

5 years ago[CodeGen] Require a name for a block addr target
Bill Wendling [Fri, 9 Aug 2019 20:18:30 +0000 (20:18 +0000)]
[CodeGen] Require a name for a block addr target

Summary:
A block address may be used in inline assembly. In which case it
requires a name so that the asm parser has something to parse. Creating
a name for every block address is a large hammer, but is necessary
because at the point when a temp symbol is created we don't necessarily
know if it's used in inline asm. This ensures that it exists regardless.

Reviewers: nickdesaulniers, craig.topper

Subscribers: nathanchance, javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[MC] Don't recreate a label if it's already used
Bill Wendling [Fri, 9 Aug 2019 20:16:31 +0000 (20:16 +0000)]
[MC] Don't recreate a label if it's already used

Summary:
This patch keeps track of MCSymbols created for blocks that were
referenced in inline asm. It prevents creating a new symbol which
doesn't refer to the block.

Inline asm may have a reference to a label. The asm parser however
doesn't recognize it as a label and tries to create a new symbol. The
result being that instead of the original symbol (e.g. ".Ltmp0") the
parser replaces it in the inline asm with the new one (e.g. ".Ltmp00")
without updating it in the symbol table. So the machine basic block
retains the "old" symbol (".Ltmp0"), but the inline asm uses the new one
(".Ltmp00").

Reviewers: nickdesaulniers, craig.topper

Subscribers: nathanchance, javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[Docs][llvm-strip] Fix an indentation issue.
Michael Pozulp [Fri, 9 Aug 2019 19:41:13 +0000 (19:41 +0000)]
[Docs][llvm-strip] Fix an indentation issue.

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

5 years agogn build: Merge r368432.
Peter Collingbourne [Fri, 9 Aug 2019 19:28:53 +0000 (19:28 +0000)]
gn build: Merge r368432.

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

5 years agogn build: Merge r368439.
Peter Collingbourne [Fri, 9 Aug 2019 19:28:44 +0000 (19:28 +0000)]
gn build: Merge r368439.

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

5 years agogn build: Merge r368402.
Peter Collingbourne [Fri, 9 Aug 2019 19:28:35 +0000 (19:28 +0000)]
gn build: Merge r368402.

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

5 years agogn build: Merge r368392.
Peter Collingbourne [Fri, 9 Aug 2019 19:28:26 +0000 (19:28 +0000)]
gn build: Merge r368392.

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

5 years agogn build: Merge r368358.
Peter Collingbourne [Fri, 9 Aug 2019 19:28:17 +0000 (19:28 +0000)]
gn build: Merge r368358.

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

5 years ago[Docs][llvm-strip] Add help text to llvm-strip rst doc
Michael Pozulp [Fri, 9 Aug 2019 19:10:55 +0000 (19:10 +0000)]
[Docs][llvm-strip] Add help text to llvm-strip rst doc

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=42383

Reviewers: jhenderson, alexshap, rupprecht

Reviewed By: jhenderson

Subscribers: wolfgangp, jakehehrlich, llvm-commits

Tags: #llvm

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

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

5 years ago[TableGen] Add "InitValue": Handle operands with set bit values in decoder methods
Daniel Sanders [Fri, 9 Aug 2019 17:30:33 +0000 (17:30 +0000)]
[TableGen] Add "InitValue": Handle operands with set bit values in decoder methods

Summary:
The problem:
  When an operand had bits explicitly set to "1" (as in the InitValue.td test case attached), the decoder was ignoring those bits, and the DecoderMethod was receiving an input where the bits were still zero.

The solution:
  We added an "InitValue" variable that stores the initial value of the operand based on what bits were explicitly initialized to 1 in TableGen code. The generated decoder code then uses that initial value to initialize the "tmp" variable, then calls fieldFromInstruction to read the values for the remaining bits that were left unknown in TableGen.

This is mainly useful when there are variations of an instruction that differ based on what bits are set in the operands, since this change makes it possible to access those bits in a DecoderMethod. The DecoderMethod can use those bits to know how to handle the input.

Patch by Nicolas Guillemot

Reviewers: craig.topper, dsanders, fhahn

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

5 years ago[InstCombine] Refactor optimizeExp2() (NFC)
Evandro Menezes [Fri, 9 Aug 2019 17:22:56 +0000 (17:22 +0000)]
[InstCombine] Refactor optimizeExp2() (NFC)

Refactor `LibCallSimplifier::optimizeExp2()` to use the new
`emitBinaryFloatFnCall()` version that fetches the function name from TLI.

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

5 years ago[Transforms] Add a emitBinaryFloatFnCall() version that fetches the function name...
Evandro Menezes [Fri, 9 Aug 2019 17:06:46 +0000 (17:06 +0000)]
[Transforms] Add a emitBinaryFloatFnCall() version that fetches the function name from TLI

Add the counterpart to a similar function for single operands.

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

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

5 years ago[Transforms] Fix comments for hasFloatFn() and getFloatFnName() (NFC)
Evandro Menezes [Fri, 9 Aug 2019 16:59:14 +0000 (16:59 +0000)]
[Transforms] Fix comments for hasFloatFn() and getFloatFnName() (NFC)

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

5 years agoPrint reasonable representations of type names in llvm-nm, readelf and readobj
Sunil Srivastava [Fri, 9 Aug 2019 16:54:51 +0000 (16:54 +0000)]
Print reasonable representations of type names in llvm-nm, readelf and readobj

For type values that do not have proper names, print reasonable representation
in llvm-nm, llvm-readobj and llvm-readelf, matching GNU tools.s

Fixes PR41713.

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

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

5 years agoTitle: Improve Loop Cache Analysis LIT tests.
Whitney Tsang [Fri, 9 Aug 2019 16:18:22 +0000 (16:18 +0000)]
Title: Improve Loop Cache Analysis LIT tests.
Summary: Make LIT tests unsensitive to analysis output order.
Authored By: etiotto

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

5 years ago[Transforms] Rename hasUnaryFloatFn() and getUnaryFloatFn() (NFC)
Evandro Menezes [Fri, 9 Aug 2019 16:04:18 +0000 (16:04 +0000)]
[Transforms] Rename hasUnaryFloatFn() and getUnaryFloatFn() (NFC)

Rename `hasUnaryFloatFn()` to `hasFloatFn()` and `getUnaryFloatFn()` to `getFloatFnName()`.

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

5 years ago[NFC] Added tests for D65898
David Bolvansky [Fri, 9 Aug 2019 15:52:26 +0000 (15:52 +0000)]
[NFC] Added tests for D65898

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

5 years ago[AArch64][x86] add tests for pessimization of expression with X*2.0 (PR32939); NFC
Sanjay Patel [Fri, 9 Aug 2019 14:52:31 +0000 (14:52 +0000)]
[AArch64][x86] add tests for pessimization of expression with X*2.0 (PR32939); NFC

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

5 years ago[DAGCombiner] remove redundant fold for X*1.0; NFC
Sanjay Patel [Fri, 9 Aug 2019 14:30:59 +0000 (14:30 +0000)]
[DAGCombiner] remove redundant fold for X*1.0; NFC

This is handled at node creation time (similar to X/1.0)
after:
rL357029
(no fast-math-flags needed)

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

5 years ago[MachinePipeliner] Avoid indeterminate order in FuncUnitSorter
Jinsong Ji [Fri, 9 Aug 2019 14:10:57 +0000 (14:10 +0000)]
[MachinePipeliner] Avoid indeterminate order in FuncUnitSorter

Summary:
This is exposed by adding a new testcase in PowerPC in
https://reviews.llvm.org/rL367732

The testcase got different output on different platform, hence breaking
buildbots.

The problem is that we get differnt FuncUnitOrder when calculateResMII.

The root cause is:
1. Two MachineInstr might get SAME priority(MFUsx) from minFuncUnits.
2. Current comparison operator() will return `MFUs1 > MFUs2`.
3. We use iterators for MachineInstr, so the input to FuncUnitSorter
   might be different on differnt platform due to the iterator nature.

So for two MI with same MFU, their order is actually depends on the
iterator order, which is platform (implemtation) dependent.

This is risky, and may cause cross-compiling problems.

The fix is to check make sure we assign a determine order when they are
equal.

Reviewers: bcahoon, hfinkel, jmolloy

Subscribers: nemanjai, hiraditya, MaskRay, llvm-commits

Tags: #llvm

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

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

5 years agoTitle: Loop Cache Analysis
Whitney Tsang [Fri, 9 Aug 2019 13:56:29 +0000 (13:56 +0000)]
Title: Loop Cache Analysis
Summary: Implement a new analysis to estimate the number of cache lines
required by a loop nest.
The analysis is largely based on the following paper:

Compiler Optimizations for Improving Data Locality
By: Steve Carr, Katherine S. McKinley, Chau-Wen Tseng
http://www.cs.utexas.edu/users/mckinley/papers/asplos-1994.pdf
The analysis considers temporal reuse (accesses to the same memory
location) and spatial reuse (accesses to memory locations within a cache
line). For simplicity the analysis considers memory accesses in the
innermost loop in a loop nest, and thus determines the number of cache
lines used when the loop L in loop nest LN is placed in the innermost
position.

The result of the analysis can be used to drive several transformations.
As an example, loop interchange could use it determine which loops in a
perfect loop nest should be interchanged to maximize cache reuse.
Similarly, loop distribution could be enhanced to take into
consideration cache reuse between arrays when distributing a loop to
eliminate vectorization inhibiting dependencies.

The general approach taken to estimate the number of cache lines used by
the memory references in the inner loop of a loop nest is:

Partition memory references that exhibit temporal or spatial reuse into
reference groups.
For each loop L in the a loop nest LN: a. Compute the cost of the
reference group b. Compute the 'cache cost' of the loop nest by summing
up the reference groups costs
For further details of the algorithm please refer to the paper.
Authored By: etiotto
Reviewers: hfinkel, Meinersbur, jdoerfert, kbarton, bmahjour, anemet,
fhahn
Reviewed By: Meinersbur
Subscribers: reames, nemanjai, MaskRay, wuzish, Hahnfeld, xusx595,
venkataramanan.kumar.llvm, greened, dmgreen, steleman, fhahn, xblvaOO,
Whitney, mgorny, hiraditya, mgrang, jsji, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D63459

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

5 years ago[X86][SSE] Swap X86ISD::BLENDV inputs with an inverted selection mask (PR42825)
Simon Pilgrim [Fri, 9 Aug 2019 12:44:20 +0000 (12:44 +0000)]
[X86][SSE] Swap X86ISD::BLENDV inputs with an inverted selection mask (PR42825)

As discussed on PR42825, if we are inverting the selection mask we can just swap the inputs and avoid the inversion.

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

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

5 years ago[GlobalOpt] prevent crashing on large integer types (PR42932)
Sanjay Patel [Fri, 9 Aug 2019 12:43:25 +0000 (12:43 +0000)]
[GlobalOpt] prevent crashing on large integer types (PR42932)

This is a minimal fix (copy the predicate for the assert) to
prevent the crashing seen in:
https://bugs.llvm.org/show_bug.cgi?id=42932
...when converting a constant integer of arbitrary width to uint64_t.

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

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

5 years ago[MCA] Fix MSVC 19.16 build with libc++
Andrea Di Biagio [Fri, 9 Aug 2019 12:41:24 +0000 (12:41 +0000)]
[MCA] Fix MSVC 19.16 build with libc++

MSVC (19.16) wants to see the definition of Instruction in
`std::pair<unsigned, const Instruction &> SourceRef` to decide
if it is assignable.

Patch by Orivej Desh.

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

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

5 years ago[llvm-readelf]Print filename for multiple inputs and fix formatting regression
James Henderson [Fri, 9 Aug 2019 12:30:08 +0000 (12:30 +0000)]
[llvm-readelf]Print filename for multiple inputs and fix formatting regression

This patch addresses two closely related bugs:
https://bugs.llvm.org/show_bug.cgi?id=42930 and
https://bugs.llvm.org/show_bug.cgi?id=42931.

GNU readelf prints the file name for every input unless there is only
one input and that input is not an archive. This patch adds the printing
for multiple inputs. A previous change did it for archives, but
introduced a regression with GNU compatibility for single-output
formatting, resulting in a spurious initial blank line. This is fixed in
this patch too.

Reviewed by: grimar, MaskRay

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

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

5 years ago[Mips][Codegen] Fix fast-isel mixing of FGR64 and AFGR64 registers
Simon Atanasyan [Fri, 9 Aug 2019 12:02:32 +0000 (12:02 +0000)]
[Mips][Codegen] Fix fast-isel mixing of FGR64 and AFGR64 registers

Fast-isel was picking AFGR64 register class for processing call
arguments when +fp64 options was used. We simply check is option +fp64
is used and pick appropriate register.

Patch by Mirko Brkusanin.

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

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

5 years ago[MCA] Add flag -show-encoding to llvm-mca.
Andrea Di Biagio [Fri, 9 Aug 2019 11:26:27 +0000 (11:26 +0000)]
[MCA] Add flag -show-encoding to llvm-mca.

Flag -show-encoding enables the printing of instruction encodings as part of the
the instruction info view.

Example (with flags -mtriple=x86_64--  -mcpu=btver2):

Instruction Info:
[1]: #uOps
[2]: Latency
[3]: RThroughput
[4]: MayLoad
[5]: MayStore
[6]: HasSideEffects (U)
[7]: Encoding Size

[1]    [2]    [3]    [4]    [5]    [6]    [7]    Encodings:     Instructions:
 1      2     1.00                         4     c5 f0 59 d0    vmulps   %xmm0, %xmm1, %xmm2
 1      4     1.00                         4     c5 eb 7c da    vhaddps  %xmm2, %xmm2, %xmm3
 1      4     1.00                         4     c5 e3 7c e3    vhaddps  %xmm3, %xmm3, %xmm4

In this example, column Encoding Size is the size in bytes of the instruction
encoding. Column Encodings reports the actual instruction encodings as byte
sequences in hex (objdump style).

The computation of encodings is done by a utility class named mca::CodeEmitter.

In future, I plan to expose the CodeEmitter to the instruction builder, so that
information about instruction encoding sizes can be used by the simulator. That
would be a first step towards simulating the throughput from the decoders in the
hardware frontend.

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

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

5 years ago[AArch64] Set pref. func. align to 8 bytes on Neoverse E1 & Cortex-A65
Pablo Barrio [Fri, 9 Aug 2019 11:05:15 +0000 (11:05 +0000)]
[AArch64] Set pref. func. align to 8 bytes on Neoverse E1 & Cortex-A65

Summary:
The Arm Neoverse E1 and Cortex-A65 Software Optimization Guide [1][2],
Section "4.7 Branch instruction alignment" state:

"It is preferable for branch targets, including subroutine entry points,
to be placed on aligned 64-bit boundaries to maximize instruction fetch
efficiency."

This patch sets the preferred function alignment on Neoverse E1 and
Cortex-A65 to 2^3=8B. This was already the case in some Cortex-A CPUs
such as Cortex-A53.

[1] https://developer.arm.com/docs/swog466751/latest/arm-neoversetm-e1-core-software-optimization-guide
[2] https://developer.arm.com/docs/swog010045/latest/arm-cortex-a65-core-software-optimization-guide

Reviewers: dmgreen, fhahn, samparker

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

Tags: #llvm

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

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

5 years ago[llvm-readobj] - Remove `error(llvm::Expected<T> &&E)`
George Rimar [Fri, 9 Aug 2019 11:03:21 +0000 (11:03 +0000)]
[llvm-readobj] - Remove `error(llvm::Expected<T> &&E)`

This is a bit strange method. It works like a unwrapOrError,
but named error. It does not report an Input name.
I removed it.

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

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

5 years ago[llvm-readobj] - Remove deprecated unwrapOrError(Expected<T> EO).
George Rimar [Fri, 9 Aug 2019 10:53:12 +0000 (10:53 +0000)]
[llvm-readobj] - Remove deprecated unwrapOrError(Expected<T> EO).

This patch changes the code to use a modern unwrapOrError(StringRef Input, Expected<T> EO)
version that contains the input source name and removes the deprecated version.

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

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

5 years agoAArch64: support TLS on Darwin platforms in GlobalISel.
Tim Northover [Fri, 9 Aug 2019 09:32:38 +0000 (09:32 +0000)]
AArch64: support TLS on Darwin platforms in GlobalISel.

All TLS access on Darwin is in the "general dynamic" form where we call
a function to resolve the address, so implementation is pretty simple.

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

5 years ago[llvm-readobj] - Remove unwrapOrError(ErrorOr<T> EO) helper.
George Rimar [Fri, 9 Aug 2019 08:29:26 +0000 (08:29 +0000)]
[llvm-readobj] - Remove unwrapOrError(ErrorOr<T> EO) helper.

It is outdated. Using of Expected<> is preferred, also it does
not provide a way to report a file name.

I updated the code to use the modern version of unwrapOrError instead.

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

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

5 years agoGlobalISel: pack various parameters for lowerCall into a struct.
Tim Northover [Fri, 9 Aug 2019 08:26:38 +0000 (08:26 +0000)]
GlobalISel: pack various parameters for lowerCall into a struct.

I've now needed to add an extra parameter to this call twice recently. Not only
is the signature getting extremely unwieldy, but just updating all of the
callsites and implementations is a pain. Putting the parameters in a struct
sidesteps both issues.

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

5 years ago[ARM][ParallelDSP] Replace SExt uses
Sam Parker [Fri, 9 Aug 2019 07:48:50 +0000 (07:48 +0000)]
[ARM][ParallelDSP] Replace SExt uses

As loads are combined and widened, we replaced their sext users
operands whereas we should have been replacing the uses of the sext.
I've added a load of tests, with only a few of them originally
causing assertion failures, the rest improve pattern coverage.

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

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

5 years ago[InstSimplify] Report "Changed" also when only deleting dead instructions
Bjorn Pettersson [Fri, 9 Aug 2019 07:08:25 +0000 (07:08 +0000)]
[InstSimplify] Report "Changed" also when only deleting dead instructions

Summary:
Make sure that we report that changes has been made
by InstSimplify also in situations when only trivially
dead instructions has been removed. If for example a call
is removed the call graph must be updated.

Bug seem to have been introduced by llvm-svn r367173
(commit 02b9e45a7e4b81), since the code in question
was rewritten in that commit.

Reviewers: spatel, chandlerc, foad

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Remove code that expands truncating stores from combineStore.
Craig Topper [Fri, 9 Aug 2019 06:59:53 +0000 (06:59 +0000)]
[X86] Remove code that expands truncating stores from combineStore.

We shouldn't form trunc stores that need to be expanded now that
we are using widening legalization.

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

5 years agoFix rpath for MacOS/iOS
Haibo Huang [Fri, 9 Aug 2019 06:05:32 +0000 (06:05 +0000)]
Fix rpath for MacOS/iOS

Summary: libs can be installed to ../lib64.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Remove stale FIXME from combineMaskedStore. NFC
Craig Topper [Fri, 9 Aug 2019 05:55:41 +0000 (05:55 +0000)]
[X86] Remove stale FIXME from combineMaskedStore. NFC

I believe PR34584 was tracking that FIXME, but its since been
closed and a test case was added.

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

5 years ago[X86] Remove DAG combine expansion of extending masked load and truncating masked...
Craig Topper [Fri, 9 Aug 2019 05:53:37 +0000 (05:53 +0000)]
[X86] Remove DAG combine expansion of extending masked load and truncating masked store.

The only way to generate these was through promoting legalization
of narrow vectors, but we widen those types now. So we shouldn't
produce these nodes.

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

5 years ago[X86] Remove handler for (U/S)(ADD/SUB)SAT from ReplaceNodeResults. Remove TypeWidenV...
Craig Topper [Fri, 9 Aug 2019 05:17:52 +0000 (05:17 +0000)]
[X86] Remove handler for (U/S)(ADD/SUB)SAT from ReplaceNodeResults. Remove TypeWidenVector check from code that handles X86ISD::VPMADDWD and X86ISD::AVG.

More unneeded code since we now legalize narrow vectors by widening.

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

5 years ago[X86] Remove ISD::SETCC handling from ReplaceNodeResults.
Craig Topper [Fri, 9 Aug 2019 05:17:48 +0000 (05:17 +0000)]
[X86] Remove ISD::SETCC handling from ReplaceNodeResults.

This is no longer needed since we widen v2i32 instead of promoting.

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

5 years ago[X86] Simplify ISD::LOAD handling in ReplaceNodeResults and ISD::STORE handling in...
Craig Topper [Fri, 9 Aug 2019 03:09:43 +0000 (03:09 +0000)]
[X86] Simplify ISD::LOAD handling in ReplaceNodeResults and ISD::STORE handling in LowerStore now that v2i32 is widened to v4i32.

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

5 years ago[X86] Merge v2f32 and v2i32 gather/scatter handling in ReplaceNodeResults/LowerMSCATT...
Craig Topper [Fri, 9 Aug 2019 03:09:28 +0000 (03:09 +0000)]
[X86] Merge v2f32 and v2i32 gather/scatter handling in ReplaceNodeResults/LowerMSCATTER now that v2i32 is also widened like v2f32.

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

5 years ago[X86] Now unreachable handling for f64->v2i32/v4i16/v8i8 bitcasts from ReplaceNodeRes...
Craig Topper [Fri, 9 Aug 2019 03:09:19 +0000 (03:09 +0000)]
[X86] Now unreachable handling for f64->v2i32/v4i16/v8i8 bitcasts from ReplaceNodeResults.

We rely on the generic type legalizer for this now.

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

5 years ago[X86] Simplify ReplaceNodeResults handling for FP_TO_SINT/UINT for vectors to only...
Craig Topper [Fri, 9 Aug 2019 03:09:10 +0000 (03:09 +0000)]
[X86] Simplify ReplaceNodeResults handling for FP_TO_SINT/UINT for vectors to only handle widening.

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

5 years ago[X86] Simplify ReplaceNodeResults handling for SIGN_EXTEND/ZERO_EXTEND/TRUNCATE for...
Craig Topper [Fri, 9 Aug 2019 03:08:54 +0000 (03:08 +0000)]
[X86] Simplify ReplaceNodeResults handling for SIGN_EXTEND/ZERO_EXTEND/TRUNCATE for vectors to only handle widening.

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

5 years ago[X86] Simplify ReplaceNodeResults handling for UDIV/UREM/SDIV/SREM for vectors to...
Craig Topper [Fri, 9 Aug 2019 03:08:45 +0000 (03:08 +0000)]
[X86] Simplify ReplaceNodeResults handling for UDIV/UREM/SDIV/SREM for vectors to only handle widening.

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

5 years ago[X86] Remove vector promotion handling from the ReplaceNodeResults ISD::MUL handling...
Craig Topper [Fri, 9 Aug 2019 03:08:28 +0000 (03:08 +0000)]
[X86] Remove vector promotion handling from the ReplaceNodeResults ISD::MUL handling code.

We now widen illegal vector types so we don't need this anymore.

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

5 years agoDebugInfo/DWARF: Provide some (pretty half-hearted) error handling access when parsin...
David Blaikie [Fri, 9 Aug 2019 01:14:33 +0000 (01:14 +0000)]
DebugInfo/DWARF: Provide some (pretty half-hearted) error handling access when parsing units

This isn't the most robust error handling API, but does allow clients to
opt-in to getting Errors they can handle. I suspect the long-term
solution would be to move away from the lazy unit parsing and have an
explicit step that parses the unit and then allows access to the other
APIs that require a parsed unit.

llvm-dwarfdump could be expanded to use this (or newer/better API) to
demonstrate the benefit of it - but for now lld will use this in a
follow-up cl which ensures lld can exit non-zero on errors like this (&
provide more descriptive diagnostics including which object file the
error came from).

(error access to later errors when parsing nested DIEs would be good too
- but, again, exposing that without it being a hassle for every consumer
may be tricky)

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

5 years agoChange the return type of UpgradeARCRuntimeCalls to void
Akira Hatanaka [Thu, 8 Aug 2019 23:33:17 +0000 (23:33 +0000)]
Change the return type of UpgradeARCRuntimeCalls to void

Nothing is using the function return.

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

5 years agoRemove else-after-return
David Blaikie [Thu, 8 Aug 2019 23:17:23 +0000 (23:17 +0000)]
Remove else-after-return

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

5 years agoFix -DBUILD_SHARED_LIBS=ON build after rL368358
Sam Clegg [Thu, 8 Aug 2019 23:00:28 +0000 (23:00 +0000)]
Fix -DBUILD_SHARED_LIBS=ON build after rL368358

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

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

5 years agoFix llvm.aarch64.irg properties.
Evgeniy Stepanov [Thu, 8 Aug 2019 22:42:48 +0000 (22:42 +0000)]
Fix llvm.aarch64.irg properties.

Summary:
IRG does not access any memory.
Replace IntrInaccessibleMemOnly with IntrNoMem | IntrHasSideEffects.

Reviewers: chill

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

Tags: #llvm

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

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

5 years ago[InstCombine][NFC] Added comments about constants in tests for pow->exp2 fold
David Bolvansky [Thu, 8 Aug 2019 22:37:51 +0000 (22:37 +0000)]
[InstCombine][NFC] Added comments about constants in tests for pow->exp2 fold

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

5 years agoAdded Delta IR Reduction Tool
Diego Trevino Ferrer [Thu, 8 Aug 2019 22:16:33 +0000 (22:16 +0000)]
Added Delta IR Reduction Tool

Summary: Tool parses input IR file, and runs the delta debugging algorithm to reduce the functions inside the input file.

Reviewers: alexshap, chandlerc

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 368071

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

5 years agoLinker: Add support for GlobalIFunc.
Peter Collingbourne [Thu, 8 Aug 2019 22:09:18 +0000 (22:09 +0000)]
Linker: Add support for GlobalIFunc.

GlobalAlias and GlobalIFunc ought to be treated the same by the IR
linker, so we can generalize the code to be in terms of their common
base class GlobalIndirectSymbol.

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

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

5 years ago[LICM] Support unary FNeg in LICM
Cameron McInally [Thu, 8 Aug 2019 21:38:31 +0000 (21:38 +0000)]
[LICM] Support unary FNeg in LICM

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

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

5 years ago[X86] Improve codegen of v8i64->v8i16 and v16i32->v16i8 truncate with avx512vl, avx51...
Craig Topper [Thu, 8 Aug 2019 21:36:47 +0000 (21:36 +0000)]
[X86] Improve codegen of v8i64->v8i16 and v16i32->v16i8 truncate with avx512vl, avx512bw, min-legal-vector-width<=256 and prefer-vector-width=256

Under this configuration we'll want to split the v8i64 or v16i32 into two vectors. The default legalization will try to truncate each of those 256-bit pieces one step to 128-bit, concatenate those, then truncate one more time from the new 256 to 128 bits.

With this patch we now truncate the two splits to 64-bits then concatenate those. We have to do this two different ways depending on whether have widening legalization enabled. Without widening legalization we have to manually construct X86ISD::VTRUNC to prevent the ISD::TRUNCATE with a narrow result being promoted to 128 bits with a larger element type than what we want followed by something like a pshufb to grab the lower half of each element to finish the job. With widening legalization we just get the right thing. When we switch to widening by default we can just delete the other code path.

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

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

5 years ago[SelectionDAG][X86] Move setcc mask splitting for mload/mstore/mgather/mscatter from...
Craig Topper [Thu, 8 Aug 2019 21:14:08 +0000 (21:14 +0000)]
[SelectionDAG][X86] Move setcc mask splitting for mload/mstore/mgather/mscatter from DAGCombiner to the type legalizer.

We may be able to look to how VSELECT is handled to further
improve this, but this appears to be neutral or an improvement
on the test cases we have.

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

5 years ago[LegalizeTypes] Remove SplitVSETCC helper and just call SplitVecRes_SETCC.
Craig Topper [Thu, 8 Aug 2019 21:13:58 +0000 (21:13 +0000)]
[LegalizeTypes] Remove SplitVSETCC helper and just call SplitVecRes_SETCC.

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

5 years ago[Attributor][NFC] Include only what is needed
Johannes Doerfert [Thu, 8 Aug 2019 20:54:23 +0000 (20:54 +0000)]
[Attributor][NFC] Include only what is needed

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

5 years ago[MBP] Disable aggressive loop rotate in plain mode
Guozhi Wei [Thu, 8 Aug 2019 20:25:23 +0000 (20:25 +0000)]
[MBP] Disable aggressive loop rotate in plain mode

Patch https://reviews.llvm.org/D43256 introduced more aggressive loop layout optimization which depends on profile information. If profile information is not available, the statically estimated profile information(generated by BranchProbabilityInfo.cpp) is used. If user program doesn't behave as BranchProbabilityInfo.cpp expected, the layout may be worse.

To be conservative this patch restores the original layout algorithm in plain mode. But user can still try the aggressive layout optimization with -force-precise-rotation-cost=true.

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

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

5 years agogn build: Merge r368331.
Peter Collingbourne [Thu, 8 Aug 2019 20:11:23 +0000 (20:11 +0000)]
gn build: Merge r368331.

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