Commit Graph

184284 Commits

Author SHA1 Message Date
Roman Lebedev 817cb7ab7f [InstCombine] Fold '(-1 u/ %x) u< %y' to '@llvm.umul.with.overflow' + overflow bit extraction
Summary:
`(-1 u/ %x) u< %y` is one of (3?) common ways to check that
some unsigned multiplication (will not) overflow.
Currently, we don't catch it. We could:
```
----------------------------------------
Name: no overflow
  %o0 = udiv i4 -1, %x
  %r = icmp ult i4 %o0, %y
=>
  %o0 = udiv i4 -1, %x
  %n0 = umul_overflow i4 %x, %y
  %r = extractvalue {i4, i1} %n0, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: no overflow, swapped
  %o0 = udiv i4 -1, %x
  %r = icmp ugt i4 %y, %o0
=>
  %o0 = udiv i4 -1, %x
  %n0 = umul_overflow i4 %x, %y
  %r = extractvalue {i4, i1} %n0, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: overflow
  %o0 = udiv i4 -1, %x
  %r = icmp uge i4 %o0, %y
=>
  %o0 = udiv i4 -1, %x
  %n0 = umul_overflow i4 %x, %y
  %n1 = extractvalue {i4, i1} %n0, 1
  %r = xor %n1, -1

Done: 1
Optimization is correct!

----------------------------------------
Name: overflow
  %o0 = udiv i4 -1, %x
  %r = icmp ule i4 %y, %o0
=>
  %o0 = udiv i4 -1, %x
  %n0 = umul_overflow i4 %x, %y
  %n1 = extractvalue {i4, i1} %n0, 1
  %r = xor %n1, -1

Done: 1
Optimization is correct!
```

As it can be observed from tests, while simply forming the `@llvm.umul.with.overflow`
is easy, if we were looking for the inverted answer, then more work needs to be done
to cleanup the now-pointless control-flow that was guarding against division-by-zero.
This is being addressed in follow-up patches.

Reviewers: nikic, spatel, efriedma, xbolva00, RKSimon

Reviewed By: nikic, xbolva00

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370347 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 12:47:08 +00:00
Roman Lebedev 07c1e2bdfa [CostModel] Model all extractvalues as free.
Summary:
As disscussed in https://reviews.llvm.org/D65148#1606412,
`extractvalue` don't actually generate any code,
so we should treat them as free.

Reviewers: craig.topper, RKSimon, jnspaulsson, greened, asb, t.p.northover, jmolloy, dmgreen

Reviewed By: jmolloy

Subscribers: javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370339 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 11:50:30 +00:00
Jeremy Morse 9df035808c [DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations
The missing line added by this patch ensures that only spilt variable
locations are candidates for being restored from the stack. Otherwise,
register or constant-value information can be interpreted as a spill
location, through a union.

The added regression test replicates a scenario where this occurs: the
stack load from [rsp] causes the register-location DBG_VALUE to be
"restored" to rsi, when it should be left alone. See PR43058 for details.

Un x-fail a test that was suffering from this from a previous patch.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370334 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 11:20:54 +00:00
Simon Pilgrim b915666de3 Fix signed/unsigned comparison warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370333 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 11:18:53 +00:00
Simon Pilgrim 50042b242c Fix shadow variable warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370332 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 11:16:32 +00:00
George Rimar 4db0416016 [yaml2obj] - Allow placing local symbols after globals.
This allows us to produce broken binaries with local
symbols placed after global in '.dynsym'/'.symtab'

Also, simplifies the code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370331 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:58:47 +00:00
George Rimar ec34b0bdef [llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken dynamic relocation.
When we have a dynamic relocation with a broken symbol's st_name,
tools report a useless error: "Invalid data was encountered while parsing the file".

After this change we report a warning + "<corrupt>" as a symbol name.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370330 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:55:57 +00:00
David Green 3f6c742130 [ARM] MVE Masked loads and stores
Masked loads and store fit naturally with MVE, the instructions being easily
predicated. This adds lowering for the simple cases of masked loads and stores.
It does not yet deal with widening/narrowing or pre/post inc.

The llvm masked load intrinsic will accept a "passthru" value, dictating the
values used for the zero masked lanes. In MVE the instructions write 0 to the
zero predicated lanes, so we need to match a passthru that isn't 0 (or undef)
with a select instruction to pull in the correct data after the load.

We also need to do something with unaligned loads/stores. Currently this uses a
similar method used in big endian, using an VLDRB.8 (and potentially a VREV in
BE). This does mean that the predicate mask is converted from, for example, a
v4i1 to a v16i1. The VLDR instructions are defined as using the first bit of
the relevant mask lane, so this could potentially load different results if the
predicate is little odd. As the input is a v4i1 however, I believe this is OK
and all the bits required should be set in the predicate, making the VLDRB.8
load the same data.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370329 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:54:35 +00:00
Jeremy Morse 228c7780c5 [DebugInfo] LiveDebugValues should always revisit backedges if it skips them
The "join" method in LiveDebugValues does not attempt to join unseen
predecessor blocks if their out-locations aren't yet initialized, instead
the block should be re-visited later to see if any locations have changed
validity. However, because the set of blocks were all being "process"'d
once before "join" saw them, that logic in "join" was actually ignoring
legitimate out-locations on the first pass through. This meant that some
invalidated locations were not removed from the head of loops, allowing
illegal locations to persist.

Fix this by removing the run of "process" before the main join/process loop
in ExtendRanges. Now the unseen predecessors that "join" skips truly are
uninitialized, and we come back to the block at a later time to re-run
"join", see the @baz function added.

This also fixes another fault where stack/register transfers in the entry
block (or any other before-any-loop-block) had their tranfers initially
ignored, and were then never revisited. The MIR test added tests for this
behaviour.

XFail a test that exposes another bug; a fix for this is coming in D66895.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370328 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:53:29 +00:00
Roman Lebedev 161b88e517 [X86][CodeGen][NFC] Delay combineIncDecVector() from DAGCombine to X86DAGToDAGISel
Summary:
We were previously doing it in DAGCombine.
But we also want to do `sub %x, C` -> `add %x, (sub 0, C)` for vectors in DAGCombine.
So if we had `sub %x, -1`, we'll transform it to `add %x, 1`,
which `combineIncDecVector()` will immediately transform back into `sub %x, -1`,
and here we go again...

I've marked this as NFC since not a single test changes,
but since that 'changes' DAGCombine, probably this isn't fully NFC.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370327 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:50:09 +00:00
Amaury Sechet ae86cd45ea [DAGCombiner] (insert_vector_elt (vector_shuffle X, Y), (extract_vector_elt X, N), IdxC) -> (vector_shuffle X, Y)
Summary: This is beneficial when the shuffle is only used once and end up being generated in a few places when some node is combined into a shuffle.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370326 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:35:51 +00:00
David Green dc9ffcf01f [ARM] Masked load and store and predicate tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370325 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:32:12 +00:00
Roman Lebedev f2cb8a934d [InstCombine] Shift amount reassociation in bittest: trunc-of-lshr (PR42399)
Summary:
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

I.e. we can perform the fold if **any** of the following is true:
* The shift amount is either zero or one less than widest bitwidth
* Either of the values being shifted has at most lowest bit set
* The value that is being shifted by `shl` (which is not truncated) should have no less leading zeros than the total shift amount;
* The value that is being shifted by `lshr` (which **is** truncated) should have no less leading zeros than the widest bit width minus total shift amount minus one

I strongly suspect there is some better generalization, but i'm not aware of it as of right now.
For now i also avoided using actual `computeKnownBits()`, but restricted it to constants.

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370324 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:26:23 +00:00
Simon Pilgrim c122b862b7 LegalizeSetCCCondCode - Reduce scope of NeedSwap to fix cppcheck warning. NFCI.
No need for this to be defined outside the only switch case its used in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370320 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:11:34 +00:00
Simon Pilgrim 688e45942a Fix variable set but no used warnings on NDEBUG builds. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370319 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 10:08:45 +00:00
Simon Pilgrim 63cd984c94 Fix variable set but no used warning on NDEBUG builds. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370317 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 09:58:47 +00:00
Martin Storsjo e5896b56ec [COFF] Add a ResourceSectionRef method for getting the data entry, print it in llvm-readobj
Differential Revision: https://reviews.llvm.org/D66819

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370311 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 09:00:14 +00:00
Martin Storsjo 013811b395 [COFF] Add a bounds checking helper for iterating a coff_resource_dir_table
Instead of blindly incrementing pointers in llvm-readobj, use this
helper, which does bounds checking against the available section
data.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370310 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 08:59:56 +00:00
Martin Storsjo 6fcee03618 [COFF] Fix error handling in ResourceSectionRef
Previously, the expression (Reader.readFoo()) was expanded twice,
triggering asserts as one of the Error types ends up not checked
(and as it was expanded twice, the method would end up called twice
if it failed first).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370309 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 08:59:41 +00:00
Martin Storsjo 14e37b0cf2 [llvm-readobj] Print the resource type textually for .res files
This already is done when dumping resources from coff objects.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370308 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 08:59:31 +00:00
Martin Storsjo 9520c04dce [llvm-readobj] Remove a leftover string trim operation. NFC.
This became unnecessary in SVN r359153.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370307 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 08:59:05 +00:00
Craig Topper f5202e0609 [X86] Remove isel patterns with X86VBroadcast+scalar_to_vector+load.
The DAG should have these as X86VBroadcast+load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 06:36:16 +00:00
Craig Topper c9e94c86f3 [X86] Remove some unneeded X86VBroadcast isel patterns that have larger than 128 bit input types.
We should always be shrinking the input to 128 bits or smaller
when the node is created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370296 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 06:02:11 +00:00
Hideto Ueno 2c071ee73d [Attributor] Deduce "noalias" attribute
Summary:
This patch adds very basic deduction for noalias.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Tags: LLVM

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370295 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 05:52:00 +00:00
Craig Topper 10e92dd797 [X86] Add a DAG combine to combine INSERTPS and VBROADCAST of a scalar load. Remove corresponding isel patterns.
We had an isel pattern to perform this, but its better to
do it in DAG combine as a simplification. This also fixes the lack
of patterns for AVX512 targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370294 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 05:48:48 +00:00
Craig Topper 9d0873fb30 [X86] Make inline assembly 'x' and 'v' constraints work for f128.
Including a type legalizer fix to make bitcast operand promotion
work correctly when getSoftenedFloat returns f128 instead of i128.

Fixes PR43157

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370293 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 05:13:56 +00:00
Florian Hahn c9064e8745 [LoopUnroll] Use Lazy strategy for DTU used for MergeBlockIntoPredecessor.
We do not access the DT in the loop, so we do not have to apply updates
eagerly. We can apply them lazyly and flush them after we are done
merging blocks.

As follow-up work, we might be able to use the DTU above as well,
instead of manually updating the DT.

This brings the example from PR43134 from ~100s to ~4s for a relase +
assertions build on my machine.

Reviewers: efriedma, kuhar, asbirlea, brzycki

Reviewed By: kuhar, brzycki

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370292 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 04:26:29 +00:00
Vitaly Buka 6f01631817 [ObjectYAML] Fix lifetime issue in dumpDebugLines
Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370289 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 02:36:48 +00:00
Johannes Doerfert 632c7e8319 [Attributor] Improve messages in iteration verify mode
When we now verify the iteration count we will see the actual count
and the expected count before the assertion is triggered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370285 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:29:44 +00:00
Johannes Doerfert 4044ba2cf8 [Attributor][NFC] Add const to map key
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370284 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:28:30 +00:00
Johannes Doerfert c1b56af013 [Attributor][Fix] Indicate change correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370283 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:26:58 +00:00
Johannes Doerfert f82eedb6b6 [Attributor] Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370282 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:26:09 +00:00
Matt Arsenault 0013bc0cab AMDGPU: Don't use frame virtual registers
SGPR spills aren't really handled after SILowerSGPRSpills. In order to
directly control what happens if the scavenger needs to spill, the
scavenger needs to be used directly. There is an alternative to
spilling in these contexts anyway since the frame register can be
increment and restored.

This does present another possible issue if spilling is needed for the
unused carry out if an add is needed. I think this can be avoided by
using a scalar add (although that clobbers SCC, which happens anyway).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370281 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:13:47 +00:00
Matt Arsenault cef7580a71 GlobalISel/TableGen: Handle setcc patterns
This is a special case because one node maps to two different G_
instructions, and the operand order is changed.

This mostly enables G_FCMP for AMDPGPU. G_ICMP is still manually
selected for now since it has the SALU and VALU complication to deal
with.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370280 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 01:13:41 +00:00
Richard Trieu ecb26c9a2f Add requirement to test.
-debug-only option for llc is only available in debug builds so
"REQUIRES: asserts" is needed in the tes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370279 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 00:46:57 +00:00
Craig Topper 47fcddca28 [X86] Fix a couple isel patterns to not shrink a volatile load.
Also add a FIXME because I'm not sure why these patterns exist. Looks like a missing combine.

And another FIXME because the AVX512 equivalent one of the patterns is missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370276 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 23:45:10 +00:00
Shiva Chen 3767f18861 [RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall
The patch fixed the issue that RV64 didn't clear the upper bits
when return complex floating value with lp64 ABI.

float _Complex
complex_add(float _Complex a, float _Complex b)
{
   return a + b;
}

RealResult = zero_extend(RealA + RealB)
ImageResult = ImageA + ImageB
Return (RealResult | (ImageResult << 32))

The patch introduces shouldExtendTypeInLibCall target hook to suppress
the AssertZext generation when lowering floating LibCall.

Thanks to Eli's comments from the Bugzilla
https://bugs.llvm.org/show_bug.cgi?id=42820

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370275 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 23:40:37 +00:00
Heejin Ahn 7d610ade1d [WebAssembly] Add atomic.fence instruction
Summary:
This adds `atomic.fence` instruction:
https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#fence-operator

And we now emit the new `atomic.fence` instruction for multithread
fences, rather than the prevous `atomic.rmw` hack.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jfb, tlively, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370272 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 23:13:43 +00:00
Tom Stellard db58724403 [LLVM-C] Fix omission of INSTALL_WITH_TOOLCHAIN to llvm_add_library()
Due to a misstake with r365902 that tried to simplify the install with
toolchain logic LLVM-C.dll was no longer being installed.

Patch By: Jakob Bornecrantz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370271 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 22:59:04 +00:00
Simon Atanasyan 51666364d4 [mips] Add an empty line to separate different patterns. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370269 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 22:32:16 +00:00
Simon Atanasyan cde191212f [mips] Fix 64-bit address loading in case of applying 32-bit mask to the result
If result of 64-bit address loading combines with 32-bit mask, LLVM
tries to optimize the code and remove "redundant" loading of upper
32-bits of the address. It leads to incorrect code on MIPS64 targets.

MIPS backend creates the following chain of commands to load 64-bit
address in the `MipsTargetLowering::getAddrNonPICSym64` method:
```
(add (shl (add (shl (add %highest(sym), %higher(sym)),
                    16),
               %hi(sym)),
          16),
     %lo(%sym))
```

If the mask presents, LLVM decides to optimize the chain of commands. It
really does not make sense to load upper 32-bits because the 0x0fffffff
mask anyway clears them. After removing redundant commands we get this
chain:
```
(add (shl (%hi(sym), 16), %lo(%sym))
```

There is no patterns matched `(MipsHi (i64 symbol))`. Due a bug in `SYM_32`
predicate definition, backend incorrectly selects a pattern for a 32-bit
symbols and uses the `lui` instruction for loading `%hi(sym)`.

As a result we get incorrect set of instructions with unnecessary 16-bit
left shifting:
```
lui     at,0x0
    R_MIPS_HI16     foo
dsll    at,at,0x10
daddiu  at,at,0
    R_MIPS_LO16     foo
```

This patch resolves two problems:
- Fix `SYM_32/SYM_64` predicates to prevent selection of patterns dedicated
  to 32-bit symbols in case of using N64 ABI.
- Add missed patterns for 64-bit symbols for `%hi/%lo`.

Fix PR42736.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370268 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 22:32:10 +00:00
Jessica Paquette f28b6a50e6 Add tie-breaker for register class sorting in getSuperRegForSubReg
llvm::stable_sort is apparently not sufficient.

Use the same tie-breaker/sorting style as TopoOrderRC fix bot failures.

E.g.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/19401/steps/test-check-all/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370267 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 22:03:05 +00:00
Artur Pilipenko b98de8c76b Fix for "DICompileUnit not listed in llvm.dbg.cu" verification error after ...
...cloning a function from a different module

Currently when a function with debug info is cloned from a different module, the 
cloned function may have hanging DICompileUnits, so that the module with the 
cloned function fails debug info verification.

The proposed fix inserts all DICompileUnits reachable from the cloned function 
to "llvm.dbg.cu" metadata operands of the cloned function module. 

Reviewed By: aprantl, efriedma

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

Patch by Oleg Pliss (Oleg.Pliss@azul.com)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370265 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 21:27:50 +00:00
Jason Liu 0575f5892a [llvm-readobj][XCOFF][NFC] Add return statement to avoid -Wimplicit-fallthrough warning
This is to fix the commit in r370097.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370260 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 20:59:17 +00:00
Julian Lettner b35a6f3e1a [ASan] Make insertion of version mismatch guard configurable
By default ASan calls a versioned function
`__asan_version_mismatch_check_vXXX` from the ASan module constructor to
check that the compiler ABI version and runtime ABI version are
compatible. This ensures that we get a predictable linker error instead
of hard-to-debug runtime errors.

Sometimes, however, we want to skip this safety guard. This new command
line option allows us to do just that.

rdar://47891956

Reviewed By: kubamracek

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370258 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 20:40:55 +00:00
James Y Knight 7a0044c420 Ignore object files that lack coverage information.
Before this change, if multiple binary files were presented, all of them must have been instrumented or the load would fail with coverage_map_error::no_data_found.

Patch by Dean Sturtevant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370257 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 20:35:50 +00:00
Philip Reames 8bee6f71bb Use the handle --check-prefixes mechanism to de-verbosify a couple atomics tests [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370256 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 20:27:39 +00:00
Jessica Paquette c6ee9a1aee [GlobalISel] Import patterns containing SUBREG_TO_REG
Reuse the logic for INSERT_SUBREG to also import SUBREG_TO_REG patterns.

- Split `inferSuperRegisterClass` into two functions, one which tries to use
  an existing TreePatternNode (`inferSuperRegisterClassForNode`), and one that
  doesn't. SUBREG_TO_REG doesn't have a node to leverage, which is the cause
  for the split.

- Rename GlobalISelEmitterInsertSubreg.td to GlobalISelEmitterSubreg.td and
  update it.

- Update impacted tests in the AArch64 and X86 backends.

This is kind of a hit/miss for code size improvements/regressions. E.g. in
add-ext.ll, we now get some identity copies. This isn't really anything the
importer can handle, since it's caused by a later pass introducing the copy for
the sake of correctness.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370254 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 20:12:31 +00:00
Nico Weber 37f2296ec9 gn build: Merge r370249
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370251 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 19:38:59 +00:00
Scott Linder 4bd6a4544d [AMDGPU] Fix bug when calculating user_spgr_count for Code Object V3 assembler
Stop counting explicitly disabled user_spgr's in the user_sgpr_count field of the kernel descriptor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370250 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 19:38:15 +00:00