]> granicus.if.org Git - llvm/log
llvm
5 years ago[JITLink] Don't under-align zero-fill sections.
Lang Hames [Tue, 27 Aug 2019 15:22:23 +0000 (15:22 +0000)]
[JITLink] Don't under-align zero-fill sections.

If content sections have lower alignment than zero-fill sections then bump the
overall segment alignment to avoid under-aligning the zero-fill sections.

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

5 years ago[DAGCombiner] cancel fnegs from multiplied operands of FMA
Sanjay Patel [Tue, 27 Aug 2019 15:17:46 +0000 (15:17 +0000)]
[DAGCombiner] cancel fnegs from multiplied operands of FMA

(-X) * (-Y) + Z --> X * Y + Z

This is a missing optimization that shows up as a potential regression in D66050,
so we should solve it first. We appear to be partly missing this fold in IR as well.

We do handle the simpler case already:
(-X) * (-Y) --> X * Y

And it might be beneficial to make the constraint less conservative (eg, if both
operands are cheap, but not necessarily cheaper), but that causes infinite looping
for the existing fmul transform.

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

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

5 years agoHandle local commons for XCOFF object file writing
Jason Liu [Tue, 27 Aug 2019 15:14:45 +0000 (15:14 +0000)]
Handle local commons for XCOFF object file writing

Summary:
Adds support for emitting common local global symbols to an XCOFF object file.
Local commons are emitted into the .bss section with a storage class of
C_HIDEXT.

Patch by: daltenty

Reviewers: sfertile, hubert.reinterpretcast

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

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

5 years agoRevert "[CodeGen] Do the Simple Early Return in block-placement pass to optimize...
Jinsong Ji [Tue, 27 Aug 2019 14:59:08 +0000 (14:59 +0000)]
Revert "[CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks"

This reverts commit b3d258fc44b588f06eb35f8e4b9a6d1fc859acec.

@skatkov is reporting crash in D63972#1646303
Contacted @ZhangKang, and revert the commit on behalf of him.

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

5 years ago[MIPS GlobalISel] ClampScalar G_SHL, G_ASHR and G_LSHR
Petar Avramovic [Tue, 27 Aug 2019 14:41:44 +0000 (14:41 +0000)]
[MIPS GlobalISel] ClampScalar G_SHL, G_ASHR and G_LSHR

ClampScalar G_SHL, G_ASHR and G_LSHR to s32 for MIPS32.

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

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

5 years ago[GlobalISel] Factor narrowScalar for G_ASHR and G_LSHR. NFC
Petar Avramovic [Tue, 27 Aug 2019 14:33:05 +0000 (14:33 +0000)]
[GlobalISel] Factor narrowScalar for G_ASHR and G_LSHR. NFC

Main difference is in the way Hi for Long shift (HiL) is made.
G_LSHR fills HiL with zeros, while G_ASHR fills HiL with sign bit value.

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

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

5 years ago[GlobalISel] Fix narrowScalar for shifts to match algorithm from SDAG
Petar Avramovic [Tue, 27 Aug 2019 14:22:32 +0000 (14:22 +0000)]
[GlobalISel] Fix narrowScalar for shifts to match algorithm from SDAG

Fix typos. Use Hi and Lo prefixes for Or instead of LHS and RHS
to match names of surrounding variables.

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

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

5 years ago[DAGCombiner] Add node to the worklist in topological order in parallelizeChainedStores
Amaury Sechet [Tue, 27 Aug 2019 13:27:57 +0000 (13:27 +0000)]
[DAGCombiner] Add node to the worklist in topological order in parallelizeChainedStores

Summary: As per title.

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

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[X86][AVX] Add SimplifyDemandedVectorElts support for KSHIFTL/KSHIFTR
Simon Pilgrim [Tue, 27 Aug 2019 13:13:17 +0000 (13:13 +0000)]
[X86][AVX] Add SimplifyDemandedVectorElts support for KSHIFTL/KSHIFTR

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

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

5 years ago[IntrinsicEmitter] Support scalable vectors in intrinsics
Cullen Rhodes [Tue, 27 Aug 2019 12:57:09 +0000 (12:57 +0000)]
[IntrinsicEmitter] Support scalable vectors in intrinsics

Summary:
This patch adds support for scalable vectors in intrinsics, enabling
intrinsics such as the following to be defined:

    declare <vscale x 4 x i32> @llvm.something.nxv4i32(<vscale x 4 x i32>)

Support for this is implemented by defining a new type descriptor for
scalable vectors and adding mangling support for scalable vector types
in the name mangling scheme used by 'any' types in intrinsic signatures.

Tests have been added for IRBuilder to test scalable vectors work as
expected when using intrinsics through this interface. This required
implementing an intrinsic that is explicitly defined with scalable
vectors, e.g.  LLVMType<nxv4i32>, an SVE floating-point convert
intrinsic was used for this.  The behaviour of the overloaded type
LLVMScalarOrSameVectorWidth with scalable vectors is tested using the
existing masked load intrinsic. Also added an .ll test to test the
Verifier catches a bad intrinsic argument when passing a fixed-width
predicate (mask) to the masked.load intrinsic where a scalable is
expected.

Patch by Paul Walker

Reviewed By: sdesmalen

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

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

5 years ago[NFC] Added tests for D66651
David Bolvansky [Tue, 27 Aug 2019 11:41:03 +0000 (11:41 +0000)]
[NFC] Added tests for D66651

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

5 years agoAdd error handling to the DataExtractor class
Pavel Labath [Tue, 27 Aug 2019 11:24:08 +0000 (11:24 +0000)]
Add error handling to the DataExtractor class

Summary:
This is motivated by D63591, where we realized that there isn't a really
good way of telling whether a DataExtractor is reading actual data, or
is it just returning default values because it reached the end of the
buffer.

This patch resolves that by providing a new "Cursor" class. A Cursor
object encapsulates two things:
- the current position/offset in the DataExtractor
- an error object

Storing the error object inside the Cursor enables one to use the same
pattern as the std::{io}stream API, where one can blindly perform a
sequence of reads and only check for errors once at the end of the
operation. Similarly to the stream API, as soon as we encounter one
error, all of the subsequent operations are skipped (return default
values) too, even if the would suceed with clear error state. Unlike the
std::stream API (but in line with other llvm APIs), we force the error
state to be checked through usage of llvm::Error.

Reviewers: probinson, dblaikie, JDevlieghere, aprantl, echristo

Subscribers: kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[DAGCombiner] Add node to the worklist in topological order after relegalization.
Amaury Sechet [Tue, 27 Aug 2019 11:06:09 +0000 (11:06 +0000)]
[DAGCombiner] Add node to the worklist in topological order after relegalization.

Summary: As per title.

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

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Fold select with ctlz to cttz
David Bolvansky [Tue, 27 Aug 2019 10:22:40 +0000 (10:22 +0000)]
[InstCombine] Fold select with ctlz to cttz

Summary:
Handle pattern [0]:

int ctz(unsigned int a)
{
  int c = __clz(a & -a);
  return a ? 31 - c : c;
}

In reality, the compiler can generate much better code for cttz, so fold away this pattern.

https://godbolt.org/z/c5kPtV

 [0] https://community.arm.com/community-help/f/discussions/2114/count-trailing-zeros

Reviewers: spatel, nikic, lebedev.ri, dmgreen, hfinkel

Reviewed By: hfinkel

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

Tags: #llvm

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

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

5 years agoAArch64: avoid creating cycle in DAG for post-increment NEON ops.
Tim Northover [Tue, 27 Aug 2019 10:21:11 +0000 (10:21 +0000)]
AArch64: avoid creating cycle in DAG for post-increment NEON ops.

Inserting a value into Visited has the effect of terminating a search for
predecessors if that node is seen. This is legitimate for the base address, and
acts as a slight performance optimization, but the vector-building node can be
paert of a legitimate cycle so we shouldn't stop searching there.

PR43056.

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

5 years ago[llvm-objdump] - Remove one overload of reportError. NFCI.
George Rimar [Tue, 27 Aug 2019 10:03:45 +0000 (10:03 +0000)]
[llvm-objdump] - Remove one overload of reportError. NFCI.

There is a problem with reportError we have.
Declaration says we have ArchiveName
that follows the FileName:

reportError(Error E, StringRef FileName, StringRef ArchiveName,...

Though implementation have them reversed. I cleaned it up and
removed an excessive reportError(Error E, StringRef File) version.

Rebased on top of D66418.

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

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

5 years ago[yaml2obj] - Don't allow setting StOther and Other/Visibility at the same time.
George Rimar [Tue, 27 Aug 2019 09:58:39 +0000 (09:58 +0000)]
[yaml2obj] - Don't allow setting StOther and Other/Visibility at the same time.

This is a follow up discussed in the comments of D66583.

Currently, if for example, we have both StOther and Other set in YAML document for a symbol,
then yaml2obj reports an "unknown key 'Other'" error.
It happens because 'mapOptional()' is never called for 'Other/Visibility' in this case,
leaving those unhandled.

This message does not describe the reason of the error well. This patch fixes it.

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

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

5 years ago[SelectionDAGBuilder] Hide existence of ConstantDataVector vector from visitGetElemen...
Craig Topper [Tue, 27 Aug 2019 06:39:50 +0000 (06:39 +0000)]
[SelectionDAGBuilder] Hide existence of ConstantDataVector vector from visitGetElementPtr.

ConstantDataVector is a specialized verison of ConstantVector
that stores data in a packed array of bits instead of as
individual pointers to other Constants. But we really shouldn't
expose that if we can void it. And we should handle regular
ConstantVector equally well.

This removes a dyn_cast to ConstantDataVector and just calls
getSplatValue directly on a Constant* if the type is a vector.

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

5 years ago[SelectionDAGBuilder] Fix typo in comment. NFC
Craig Topper [Tue, 27 Aug 2019 06:38:51 +0000 (06:38 +0000)]
[SelectionDAGBuilder] Fix typo in comment. NFC

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

5 years ago[ValueTracking] Add AllowNonInbounds parameter to GetPointerBaseWithConstantOffset...
Hideto Ueno [Tue, 27 Aug 2019 06:30:33 +0000 (06:30 +0000)]
[ValueTracking] Add AllowNonInbounds parameter to GetPointerBaseWithConstantOffset function

This commit was part of D65402.

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

5 years ago[Attributor] Clamp operator to extend known state
Hideto Ueno [Tue, 27 Aug 2019 06:02:56 +0000 (06:02 +0000)]
[Attributor] Clamp operator to extend known state

Summary:
Similar to `^=` operator for IntegerState, this patch introduces a `+=` operator to "clamp" known information.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[Attributor] Introduce an API to delete stuff
Johannes Doerfert [Tue, 27 Aug 2019 04:57:54 +0000 (04:57 +0000)]
[Attributor] Introduce an API to delete stuff

Summary:
During the fixpoint iteration, including the manifest stage, we should
not delete stuff as other abstract attributes might have a reference to
the value. Through the API this can now be done safely at the very end.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Replace the FIXME I added in rL369989 with a comment clarifying the current...
Philip Reames [Tue, 27 Aug 2019 04:52:35 +0000 (04:52 +0000)]
[NFC] Replace the FIXME I added in rL369989 with a comment clarifying the current code

The current approach is restrictive (as all of geps must be multiples of the alignment), but correct.

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

5 years agoRevert r369927 - [DAGCombiner] Remove a bunch of redundant AddToWorklist calls.
Richard Trieu [Tue, 27 Aug 2019 02:04:11 +0000 (02:04 +0000)]
Revert r369927 - [DAGCombiner] Remove a bunch of redundant AddToWorklist calls.

This change causes instrumented builds of Clang to have a fatal error in the
backend.  https://reviews.llvm.org/D66537 has the details.

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

5 years ago[WinEH] Allocate space in funclets stack to save XMM CSRs
Pengfei Wang [Tue, 27 Aug 2019 01:53:24 +0000 (01:53 +0000)]
[WinEH] Allocate space in funclets stack to save XMM CSRs

Summary:
This is an alternate approach to D63396

Currently funclets reuse the same stack slots that are used in the
parent function for saving callee-saved xmm registers. If the parent
function modifies a callee-saved xmm register before an excpetion is
thrown, the catch handler will overwrite the original saved value.

This patch allocates space in funclets stack for saving callee-saved xmm
registers and uses RSP instead RBP to access memory.

Signed-off-by: Pengfei Wang <pengfei.wang@intel.com>
Reviewers: rnk, RKSimon, craig.topper, annita.zhang, LuoYuanke, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

Signed-off-by: Pengfei Wang <pengfei.wang@intel.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370005 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Analysis] In EmitGEPOffset, use Constant::getUniqueInteger to handle struct indices...
Craig Topper [Tue, 27 Aug 2019 01:07:37 +0000 (01:07 +0000)]
[Analysis] In EmitGEPOffset, use Constant::getUniqueInteger to handle struct indices in vector GEPs.

We previously called getSplatValue if the index had a vector type,
but getSplatValue returns null for non-splats. This would cause
a nullptr dereference if it wasn't a splat.

Using getUniqueInteger gives us an assert if its a vector type,
but the value isn't a splat. This is what is used in
SelectionDAGBuilder's code that expands GEPs as well.

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

5 years ago[MemorySSA] Fix insertUse.
Alina Sbirlea [Tue, 27 Aug 2019 00:34:47 +0000 (00:34 +0000)]
[MemorySSA] Fix insertUse.

Actually call the renamePass on inserted Phis.
Fixes PR42940.

Subscribers: llvm-commits

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

5 years agoAdd PhaseOrdering/lifetime-sanitizer.ll tests
Vitaly Buka [Tue, 27 Aug 2019 00:18:28 +0000 (00:18 +0000)]
Add PhaseOrdering/lifetime-sanitizer.ll tests

Reviewers: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Combine directly on mul24 intrinsics
Matt Arsenault [Tue, 27 Aug 2019 00:18:09 +0000 (00:18 +0000)]
AMDGPU: Combine directly on mul24 intrinsics

The problem these are supposed to work around can occur before the
intrinsics are lowered into the nodes. Try to directly simplify them
so they are matched before the bit assert operations can be optimized
out.

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

5 years agoAMDGPU: Run AMDGPUCodeGenPrepare after scalar opts
Matt Arsenault [Tue, 27 Aug 2019 00:08:31 +0000 (00:08 +0000)]
AMDGPU: Run AMDGPUCodeGenPrepare after scalar opts

The mul24 matching could interfere with SLSR and the other addressing
mode related passes. This probably is not the optimal placement, but
is an intermediate step. This should probably be moved after all the
generic IR passes, particularly LSR. Moving this after LSR seems to
help in some cases, and hurts others.

As-is in this patch, in idiv-licm, it saves 1-2 instructions inside
some of the loop bodies, but increases the number in others. Moving
this later helps these loops. In the new lsr tests in
mul24-pass-ordering, the intrinsic prevents introducing more
instructions in the loop preheader, so moving this later ends up
hurting them. This shouldn't be any worse than before the intrinsics
were introduced in r366094, and LSR should probably be smarter. I
think it's because it doesn't know the and inside the loop will be
folded away.

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

5 years agoReorganize code and add a fixme to point out a bug in existing code [NFC]
Philip Reames [Mon, 26 Aug 2019 23:57:27 +0000 (23:57 +0000)]
Reorganize code and add a fixme to point out a bug in existing code [NFC]

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

5 years ago[mips] Fix indentation. NFC
Simon Atanasyan [Mon, 26 Aug 2019 22:40:34 +0000 (22:40 +0000)]
[mips] Fix indentation. NFC

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

5 years ago[mips] clang-format the code. NFC
Simon Atanasyan [Mon, 26 Aug 2019 22:40:28 +0000 (22:40 +0000)]
[mips] clang-format the code. NFC

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

5 years ago[X86] Delay combineIncDecVector until after op legalization.
Craig Topper [Mon, 26 Aug 2019 22:17:54 +0000 (22:17 +0000)]
[X86] Delay combineIncDecVector until after op legalization.

Probably better to keep add over sub in early DAG combines.

It might make sense to push this to lowering or delay it all
the way to isel. But this was the simplest change.

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

5 years agomsan, codegen, instcombine: Keep more lifetime markers used for msan
Vitaly Buka [Mon, 26 Aug 2019 22:15:50 +0000 (22:15 +0000)]
msan, codegen, instcombine: Keep more lifetime markers used for msan

Reviewers: eugenis

Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years ago[WebAssembly] Fix SSA rebuilding in SjLj transformation
Heejin Ahn [Mon, 26 Aug 2019 21:51:35 +0000 (21:51 +0000)]
[WebAssembly] Fix SSA rebuilding in SjLj transformation

Summary:
Previously we skipped uses within the same BB as a def when rebuilding
SSA after SjLj transformation. For example, before transformation,
```
for.cond:
  %0 = phi i32 [ %var, %for.inc ] ...
  %var = ...
  br label %for.inc

for.inc:                               ; preds = %for.cond
  call i32 @setjmp(...)
  br %for.cond
```

In this BB, %var should be defined in all paths from %for.inc to make %0
valid. In the input it was true; %for.inc's only predecessor was
%for.cond. But after SjLj transformation, it is possible that %for.inc
has other predecessors that are reachable without reaching %for.cond.
```
entry.split:
  ...
  br i1 %a, label %bb.1, label %for.inc

for.cond:
  %0 = phi i32 [ %var, %for.inc ] ...  ; Not valid!
  %var = ...
  br label %for.inc

for.inc:                               ; preds = %for.cond, %entry.split
  call i32 @setjmp(...)
  ...
  br %for.cond
```

In this case, we can't use %var in the `phi` instruction in %for.cond,
because %var is not defined in all paths through %for.inc (If the
control flow is %entry -> %entry.split -> %for.inc -> %for.cond, %var
has not been defined until we reach the `phi`). But the previous code
excluded users within the same BB, skipping instructions within the same
BB so they are not rewritten properly. User instructions within the same
BB also should be candidates for rewriting if they are _before_ the
original definition.

Fixes PR43097.

Reviewers: dschuff

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

Tags: #llvm

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

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

5 years ago[hwasan] Fix test failure in r369721.
Evgeniy Stepanov [Mon, 26 Aug 2019 21:44:55 +0000 (21:44 +0000)]
[hwasan] Fix test failure in r369721.

Try harder to emulate "old runtime" in the test.
To get the old behavior with the new runtime library, we need both
disable personality function wrapping and enable landing pad
instrumentation.

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

5 years ago[ORC] Make sure that queries on emitted-but-not-ready symbols fail correctly.
Lang Hames [Mon, 26 Aug 2019 21:42:51 +0000 (21:42 +0000)]
[ORC] Make sure that queries on emitted-but-not-ready symbols fail correctly.

In r369808 the failure scheme for ORC symbols was changed to make
MaterializationResponsibility objects responsible for failing the symbols
they represented. This simplifies error logic in the case where symbols are
still covered by a MaterializationResponsibility, but left a gap in error
handling: Symbols that have been emitted but are not yet ready (due to a
dependence on some unemitted symbol) are not covered by a
MaterializationResponsibility object. Under the scheme introduced in r369808
such symbols would be moved to the error state, but queries on those symbols
were never notified. This led to deadlocks when such symbols were failed.

This commit updates error logic to immediately fail queries on any symbol that
has already been emitted if one of its dependencies fails.

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

5 years ago[ORC] Fix an overly aggressive assert.
Lang Hames [Mon, 26 Aug 2019 21:42:47 +0000 (21:42 +0000)]
[ORC] Fix an overly aggressive assert.

Symbols that have not been queried will not have MaterializingInfo entries,
so remove the assert that all failed symbols should have these entries.
Also updates the loop to only remove entries that were found earlier.

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

5 years ago[WebAssembly] Combine emscripten SjLj tests
Heejin Ahn [Mon, 26 Aug 2019 21:41:17 +0000 (21:41 +0000)]
[WebAssembly] Combine emscripten SjLj tests

Summary:
Combine a test in lower-em-sjlj-longjmp-only.ll into lower-em-sjlj.ll,
because the test command is the same and I don't see any reason it
should be a separate file. Also converted tabs into spaces and fixed
indentations in lower-em-sjlj-sret.ll. (lower-em-sjlj.ll uses a
different test command (llc), so it couldn't be combined)

Reviewers: dschuff

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

Tags: #llvm

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

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

5 years ago[GlobalISel] Import patterns containing INSERT_SUBREG
Jessica Paquette [Mon, 26 Aug 2019 21:38:57 +0000 (21:38 +0000)]
[GlobalISel] Import patterns containing INSERT_SUBREG

This teaches the importer to handle INSERT_SUBREG instructions.

We were missing patterns involving INSERT_SUBREG in AArch64. It appears in
AArch64InstrInfo.td 107 times, and 14 times in AArch64InstrFormats.td.

To meaningfully import it, the GlobalISelEmitter needs to know how to infer a
super register class for a given register class.

This patch introduces the following:

- `getSuperRegForSubReg`, a function which finds the largest register class
which supports a value type and subregister index

- `inferSuperRegisterClass`, a function which finds the appropriate super
register class for an INSERT_SUBREG'

- `inferRegClassFromPattern`, a function which allows for some trivial
lookthrough into instructions

- `getRegClassFromLeaf`, a helper function which returns the register class for
a leaf `TreePatternNode`

- Support for subregister index operands in `importExplicitUseRenderer`

It also

- Updates tests in each backend which are impacted by the change

- Adds GlobalISelEmitterSubreg.td to test that we import and skip the expected
patterns

As a result of this patch, INSERT_SUBREG patterns in X86 may use the
LOW32_ADDR_ACCESS_RBP register class instead of GR32. This is correct, since the
register class contains the same registers as GR32 (except with the addition of
RBP). So, this also teaches X86 to handle that register class. This is in line
with X86ISelLowering, which treats this as a GR class.

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

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

5 years agoDebug Info: Support for DW_AT_export_symbols for anonymous structs
Shafik Yaghmour [Mon, 26 Aug 2019 20:59:44 +0000 (20:59 +0000)]
Debug Info: Support for DW_AT_export_symbols for anonymous structs

This implements the DWARF 5 feature described in:

http://dwarfstd.org/ShowIssue.php?issue=141212.1

To support recognizing anonymous structs:

  struct A {
    struct { // Anonymous struct
        int y;
    };
  } a

This patch adds support for the new flag in constructTypeDIE(...) and test to verify this change.

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

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

5 years ago[DWARF] Rename getDwarf5OrGNUCallSite{Attr,Tag}, NFC
Vedant Kumar [Mon, 26 Aug 2019 20:53:34 +0000 (20:53 +0000)]
[DWARF] Rename getDwarf5OrGNUCallSite{Attr,Tag}, NFC

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

5 years ago[DWARF] Pick the DWARF5 OP_entry_value opcode on Darwin
Vedant Kumar [Mon, 26 Aug 2019 20:53:12 +0000 (20:53 +0000)]
[DWARF] Pick the DWARF5 OP_entry_value opcode on Darwin

Use the GNU extension for OP_entry_value consistently (i.e. whenever GNU
extensions are used for TAG_call_site).

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

5 years ago[test] Remove extra spaces from a test, NFC
Vedant Kumar [Mon, 26 Aug 2019 20:49:26 +0000 (20:49 +0000)]
[test] Remove extra spaces from a test, NFC

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

5 years agoAdd a clarify comment for meaning of SafePointes [NFC]
Philip Reames [Mon, 26 Aug 2019 20:48:35 +0000 (20:48 +0000)]
Add a clarify comment for meaning of SafePointes [NFC]

Extracted from D66688 as requested.

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

5 years ago[ADT] Make StringRef(const char*) constexpr
Benjamin Kramer [Mon, 26 Aug 2019 20:47:56 +0000 (20:47 +0000)]
[ADT] Make StringRef(const char*) constexpr

This should let us get rid of StringLiteral in the long term and avoid
chasing accidental StringRef globals once and for all.

This requires C++14, I godbolted it on every compiler I know we support
so I hope there won't be much fallout.

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

5 years agoPreland test cases for D66688 to make diffs clear.
Philip Reames [Mon, 26 Aug 2019 20:37:06 +0000 (20:37 +0000)]
Preland test cases for D66688 to make diffs clear.

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

5 years agogn build: Merge r369918
Nico Weber [Mon, 26 Aug 2019 19:27:26 +0000 (19:27 +0000)]
gn build: Merge r369918

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

5 years agoRecommit [PowerPC] Update P9 vector costs for insert/extract
Roland Froese [Mon, 26 Aug 2019 19:26:08 +0000 (19:26 +0000)]
Recommit [PowerPC] Update P9 vector costs for insert/extract

Now that the v1i128 smin regression has been fixed, recommit the P9 cost
updates from D60160.

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

5 years agogn build: color linker errors when using lld
Nico Weber [Mon, 26 Aug 2019 19:22:41 +0000 (19:22 +0000)]
gn build: color linker errors when using lld

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

5 years agogn build: (manually) merge r369741
Nico Weber [Mon, 26 Aug 2019 19:22:39 +0000 (19:22 +0000)]
gn build: (manually) merge r369741

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

5 years ago[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null for...
Philip Reames [Mon, 26 Aug 2019 19:11:49 +0000 (19:11 +0000)]
[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null for vectors

Extend the transform introduced in https://reviews.llvm.org/D66608 to work for vector geps as well.

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

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

5 years agogn build: (manually) merge r369940
Nico Weber [Mon, 26 Aug 2019 19:08:43 +0000 (19:08 +0000)]
gn build: (manually) merge r369940

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

5 years ago[Hexagon] Improve generated code for test-if-bit-clear
Krzysztof Parzyszek [Mon, 26 Aug 2019 19:08:08 +0000 (19:08 +0000)]
[Hexagon] Improve generated code for test-if-bit-clear

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

5 years ago[Attributor] Adjust and test the iteration bound of tests
Johannes Doerfert [Mon, 26 Aug 2019 18:55:47 +0000 (18:55 +0000)]
[Attributor] Adjust and test the iteration bound of tests

Summary:
Try to verify how many iterations we need for a fixpoint in our tests.
This patch adjust the way we count to make it easier to follow. It also
adjusts the bounds to actually account for a fixpoint and not only the
minimum number to pass all checks.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years agoFileManager: Use llvm::Expected in new getFileRef API
Duncan P. N. Exon Smith [Mon, 26 Aug 2019 18:29:51 +0000 (18:29 +0000)]
FileManager: Use llvm::Expected in new getFileRef API

`FileManager::getFileRef` is a modern API which we expect to convert to
over time.  We should modernize the error handling as well, using
`llvm::Expected` instead of `llvm::ErrorOr`, to help clients that care
about errors to ensure nothing is missed.

However, not all clients care.  I've also added another path for those
that don't:

- `FileEntryRef` is now copy- and move-assignable (using a pointer
  instead of a reference).
- `FileManager::getOptionalFileRef` returns an `llvm::Optional` instead
  of `llvm::Expected`.
- Added an `llvm::expectedToOptional` utility in case this is useful
  elsewhere.

https://reviews.llvm.org/D66705

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

5 years ago[X86] Add a hack to combinePMULDQ to manually turn SIGN_EXTEND_VECTOR_INREG/ZERO_EXTE...
Craig Topper [Mon, 26 Aug 2019 18:23:26 +0000 (18:23 +0000)]
[X86] Add a hack to combinePMULDQ to manually turn SIGN_EXTEND_VECTOR_INREG/ZERO_EXTEND_VECTOR_INREG inputs into an ANY_EXTEND_VECTOR_INREG style shuffle

ANY_EXTEND_VECTOR_INREG isn't currently marked Legal which prevents SimplifyDemandedBits from turning SIGN/ZERO_EXTEND_VECTOR_INREG into it after op legalization. And even if we did make it Legal, combineExtInVec doesn't do shuffle combining on the VECTOR_INREG nodes until AVX1.

This patch adds a quick hack to combinePMULDQ to directly emit a vector shuffle corresponding to an ANY_EXTEND_VECTOR_INREG operation. This avoids both of those issues without creating any other regressions on our tests. The xop-ifma.ll change here also showed up when I tried to resurrect D56306 and seemed to be the only improvement that patch creates now. This is a more direct way to get the benefit.

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

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

5 years ago[DAGCombiner][X86] Teach SimplifyVBinOp to fold VBinOp (concat X, undef/constant...
Craig Topper [Mon, 26 Aug 2019 17:59:11 +0000 (17:59 +0000)]
[DAGCombiner][X86] Teach SimplifyVBinOp to fold VBinOp (concat X, undef/constant), (concat Y, undef/constant) -> concat (VBinOp X, Y), VecC

This improves the combine I included in D66504 to handle constants in the upper operands of the concat. If we can constant fold them away we can pull the concat after the bin op. This helps with chains of madd reductions on X86 from loop unrolling. The loop madd reduction pattern creates pmaddwd with half the width of the add that follows it using zeroes to fill the upper bits. If we have two of these added together we can pull the zeroes through the accumulating add and then shrink it.

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

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

5 years ago[Attributor] Further cut down on non-determinism
Johannes Doerfert [Mon, 26 Aug 2019 17:51:23 +0000 (17:51 +0000)]
[Attributor] Further cut down on non-determinism

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

5 years ago[Attributor] Allow explicit dependence tracking
Johannes Doerfert [Mon, 26 Aug 2019 17:48:05 +0000 (17:48 +0000)]
[Attributor] Allow explicit dependence tracking

By default, the Attributor tracks potential dependences between abstract
attributes based on the issued Attributor::getAAFor queries. This
simplifies the development of new abstract attributes but it can also
lead to spurious dependences that might increase compile time and make
internalization harder (D63312). With this patch, abstract attributes
can opt-out of implicit dependence tracking and instead register
dependences explicitly. It is up to the implementation to make sure all
existing dependences are registered.

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

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

5 years ago[DAGCombiner] Remove a bunch of redundant AddToWorklist calls.
Amaury Sechet [Mon, 26 Aug 2019 17:02:12 +0000 (17:02 +0000)]
[DAGCombiner] Remove a bunch of redundant AddToWorklist calls.

Summary:
This comes as a first step toward processing the DAG nodes in topological orders. Doing so ensure that arguments of a node are combined before the node itself is combined, which exposes ore opportunities for optimization and/or reduce the amount of patterns a node has to match for.

DAGCombiner adding nodes to the worklist is various places causes the nodes to be in a different order from what is expected. In addition, this is reduant because these nodes end up being added to the worklist anyways due to the machinery at line 1621.

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

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[PowerPC] add tests for fma with negated ops; NFC
Sanjay Patel [Mon, 26 Aug 2019 16:20:09 +0000 (16:20 +0000)]
[PowerPC] add tests for fma with negated ops; NFC

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

5 years ago[SampleFDO] Extract the code calling each section reader to readOneSection.
Wei Mi [Mon, 26 Aug 2019 15:54:16 +0000 (15:54 +0000)]
[SampleFDO] Extract the code calling each section reader to readOneSection.

This is a followup of https://reviews.llvm.org/D66513. The code calling each
section reader should be put into a separate function (readOneSection), so
SampleProfileExtBinaryReader can override it. Otherwise, the base class
SampleProfileExtBinaryBaseReader will need to be aware of all different kinds
of section readers. That is not right.

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

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

5 years ago[X86] Automatically generate various tests. NFC
Amaury Sechet [Mon, 26 Aug 2019 13:53:29 +0000 (13:53 +0000)]
[X86] Automatically generate various tests. NFC

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

5 years ago[NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txt
Gabor Buella [Mon, 26 Aug 2019 09:42:30 +0000 (09:42 +0000)]
[NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txt

To avoid the following error message (using cmake version 3.13.4) :

```
CMake Error at tools/llvm-config/CMakeLists.txt:37 (string):
Syntax error in cmake code  when parsing string-std=[^ ]\+Invalid escape sequence \+
```

Reviewed By: mgorny

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

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

5 years ago[LoopUnroll] Handle certain PHIs in full unrolling properly
Bjorn Pettersson [Mon, 26 Aug 2019 09:29:53 +0000 (09:29 +0000)]
[LoopUnroll] Handle certain PHIs in full unrolling properly

Summary:
When reconstructing the CFG of the loop after unrolling,
LoopUnroll could in some cases remove the phi operands of
loop-carried values instead of preserving them, resulting
in undef phi values after loop unrolling.

When doing this reconstruction, avoid removing incoming
phi values for phis in the successor blocks if the successor
is the block we are jumping to anyway.

Patch-by: ebevhan
Reviewers: fhahn, efriedma

Reviewed By: fhahn

Subscribers: bjope, lebedev.ri, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][Regalloc] Add testcases for D66576
Zi Xuan Wu [Mon, 26 Aug 2019 05:06:30 +0000 (05:06 +0000)]
[NFC][Regalloc] Add testcases for D66576

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

5 years ago[X86] Automatically generate stack folding tests. NFC
Amaury Sechet [Sun, 25 Aug 2019 20:48:14 +0000 (20:48 +0000)]
[X86] Automatically generate stack folding tests. NFC

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

5 years ago[Hexagon] remove noise from tests; NFC
Sanjay Patel [Sun, 25 Aug 2019 18:34:07 +0000 (18:34 +0000)]
[Hexagon] remove noise from tests; NFC

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

5 years ago[Hexagon][x86] add tests for bit-test; NFC
Sanjay Patel [Sun, 25 Aug 2019 18:25:22 +0000 (18:25 +0000)]
[Hexagon][x86] add tests for bit-test; NFC

More coverage for D66687
(assuming we make this a generic combine with TLI hook).

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

5 years ago[X86][DAGCombiner] Teach narrowShuffle to use concat_vectors instead of inserting...
Craig Topper [Sun, 25 Aug 2019 17:59:49 +0000 (17:59 +0000)]
[X86][DAGCombiner] Teach narrowShuffle to use concat_vectors instead of inserting into undef

Summary:
Concat_vectors is more canonical during early DAG combine. For example, its what's used by SelectionDAGBuilder when converting IR shuffles into SelectionDAG shuffles when element counts between inputs and mask don't match. We also have combines in DAGCombiner than can pull concat_vectors through a shuffle. See partitionShuffleOfConcats. So it seems like concat_vectors is a better operation to use here. I had to teach DAGCombiner's SimplifyVBinOp to also handle concat_vectors with undef. I haven't checked yet if we can remove the INSERT_SUBVECTOR version in there or not.

I didn't want to mess with the other caller of getShuffleHalfVectors that's used during shuffle lowering where insert_subvector probably is what we want to produce so I've enabled this via a boolean passed to the function.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Add test case for inserting/extracting from two shuffled vectors. NFC
Amaury Sechet [Sun, 25 Aug 2019 15:49:29 +0000 (15:49 +0000)]
[X86] Add test case for inserting/extracting from two shuffled vectors. NFC

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

5 years ago[X86] Add test case for inserting/extracting from shuffled vectors. NFC
Amaury Sechet [Sun, 25 Aug 2019 15:19:20 +0000 (15:19 +0000)]
[X86] Add test case for inserting/extracting from shuffled vectors. NFC

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

5 years ago[PowerPC][AIX] Adds support for writing the .data section in assembly files
Xing Xue [Sun, 25 Aug 2019 15:17:25 +0000 (15:17 +0000)]
[PowerPC][AIX] Adds support for writing the .data section in assembly files

Summary:
Adds support for generating the .data section in assembly files for global variables with a non-zero initialization. The support for writing the .data section in XCOFF object files will be added in a follow-on patch. Any relocations are not included in this patch.

Reviewers: hubert.reinterpretcast, sfertile, jasonliu, daltenty, Xiangling_L

Reviewed by: hubert.reinterpretcast

Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, wuzish, shchenz, DiggerLin, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Downgrade from StringLiteral to const char* in an attempt to make GCC 5...
Benjamin Kramer [Sun, 25 Aug 2019 12:47:31 +0000 (12:47 +0000)]
[AMDGPU] Downgrade from StringLiteral to const char* in an attempt to make GCC 5 happy

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

5 years agoFixup in test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
Bjorn Pettersson [Sun, 25 Aug 2019 10:54:44 +0000 (10:54 +0000)]
Fixup in test/DebugInfo/X86/live-debug-vars-discard-invalid.mir

The test case used invalid source operands as input
to BTS64rr instructions (feeding register operands with
immediates). This patch changes those instruction into
using BTS64ri8 instead, which seems to better match the
operand types.

Fixes problems seen in https://reviews.llvm.org/D63973.

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

5 years ago[TableGen] Correct comments for end of namespace. NFC
Bjorn Pettersson [Sun, 25 Aug 2019 10:47:30 +0000 (10:47 +0000)]
[TableGen] Correct comments for end of namespace. NFC

Summary:
Update end-of-namespace comments generated by
tablegen emitters to fulfill the rules setup by
clang-tidy's llvm-namespace-comment checker.

Fixed a few end-of-namespace comments in the
tablegen source code as well.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, stoklund, dschuff, sbc100, jgravelle-google, aheejin, llvm-commits

Tags: #llvm

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

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

5 years ago[SDAG] Fold umul_lohi with 0 or 1 multiplicand
Nikita Popov [Sun, 25 Aug 2019 08:04:22 +0000 (08:04 +0000)]
[SDAG] Fold umul_lohi with 0 or 1 multiplicand

These can turn up during multiplication legalization. In principle
these should also apply to smul_lohi, but I wasn't able to figure
out how to produce those with the necessary operands.

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

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

5 years ago[X86] Teach -Os immediate sharing code to not count constant uses that will become...
Craig Topper [Sun, 25 Aug 2019 05:22:40 +0000 (05:22 +0000)]
[X86] Teach -Os immediate sharing code to not count constant uses that will become INC/DEC.

INC/DEC don't use an immediate so we don't need to count it. We
also shouldn't use the custom isel for it.

Fixes PR42998.

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

5 years ago[X86] Add test cases for PR42998. NFC
Craig Topper [Sun, 25 Aug 2019 05:22:36 +0000 (05:22 +0000)]
[X86] Add test cases for PR42998. NFC

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

5 years agoRemoving block comments from CodeView records in assembly files & related code cleanup
Nilanjana Basu [Sun, 25 Aug 2019 01:09:11 +0000 (01:09 +0000)]
Removing block comments from CodeView records in assembly files & related code cleanup

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

5 years ago[X86] Add isel patterns to match vpdpwssd avx512vnni instruction from add+pmaddwd...
Craig Topper [Sat, 24 Aug 2019 23:14:57 +0000 (23:14 +0000)]
[X86] Add isel patterns to match vpdpwssd avx512vnni instruction from add+pmaddwd nodes.

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

5 years agoAMDGPU: Add baseline test for mul24 ordering issues
Matt Arsenault [Sat, 24 Aug 2019 22:22:38 +0000 (22:22 +0000)]
AMDGPU: Add baseline test for mul24 ordering issues

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

5 years agoAMDGPU: Preserve value name when inserting mul24 intrinsic
Matt Arsenault [Sat, 24 Aug 2019 22:17:10 +0000 (22:17 +0000)]
AMDGPU: Preserve value name when inserting mul24 intrinsic

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

5 years agoAMDGPU: Introduce a flag to disable mul24 intrinsic formation
Matt Arsenault [Sat, 24 Aug 2019 22:14:41 +0000 (22:14 +0000)]
AMDGPU: Introduce a flag to disable mul24 intrinsic formation

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

5 years agoAMDGPU: Generate check lines
Matt Arsenault [Sat, 24 Aug 2019 22:14:37 +0000 (22:14 +0000)]
AMDGPU: Generate check lines

Checking all the instructions will help catch LICM changes when passes
are reordered. Also switch to using gfx9 since global stores make the
relevant instructions more obvious.

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

5 years ago[TLI] Simplify code. NFCI.
Benjamin Kramer [Sat, 24 Aug 2019 17:30:12 +0000 (17:30 +0000)]
[TLI] Simplify code. NFCI.

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

5 years agoHack around a GCC ICE that was fixed in GCC 6.2
Benjamin Kramer [Sat, 24 Aug 2019 16:19:32 +0000 (16:19 +0000)]
Hack around a GCC ICE that was fixed in GCC 6.2

lib/Target/X86/AsmParser/X86AsmParser.cpp: In member function ‘void {anonymous}::X86AsmParser::SwitchMode(unsigned int)’:
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76:   in constexpr expansion of ‘AllModes.llvm::FeatureBitset::FeatureBitset(std::initializer_list<unsigned int>{((const unsigned int*)(& ._157)), 3u})’
include/llvm/MC/SubtargetFeature.h:56:12:   in constexpr expansion of ‘llvm::FeatureBitset::set(I)’
lib/Target/X86/AsmParser/X86AsmParser.cpp:927:76: internal compiler error: in fold_binary_loc, at fold-const.c:9921
     FeatureBitset AllModes({X86::Mode64Bit, X86::Mode32Bit, X86::Mode16Bit});
                                                                            ^

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

5 years agoTry to make MSVC 2017 happy.
Benjamin Kramer [Sat, 24 Aug 2019 15:46:49 +0000 (15:46 +0000)]
Try to make MSVC 2017 happy.

AArch64BaseInfo.h(316): error C3615: constexpr function 'llvm::SysAlias::SysAlias' cannot result in a constant expression
AArch64BaseInfo.h(316): note: failure was caused by call of undefined function or one not declared 'constexpr'
AArch64BaseInfo.h(316): note: see usage of 'llvm::FeatureBitset::FeatureBitset'

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

5 years agoFix some accidental global initializers by using StringLiteral instead of StringRef
Benjamin Kramer [Sat, 24 Aug 2019 15:24:25 +0000 (15:24 +0000)]
Fix some accidental global initializers by using StringLiteral instead of StringRef

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

5 years agoUpdate tablegen test after r369847.
Benjamin Kramer [Sat, 24 Aug 2019 15:11:41 +0000 (15:11 +0000)]
Update tablegen test after r369847.

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

5 years ago[llvm-reduce] Silence -Wdocumentation
Benjamin Kramer [Sat, 24 Aug 2019 15:04:33 +0000 (15:04 +0000)]
[llvm-reduce] Silence -Wdocumentation

ReduceGlobalVars.cpp:17:6: warning: '@returns' command used in a comment that is attached to a function returning void

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

5 years agoUse a bit of relaxed constexpr to make FeatureBitset costant intializable
Benjamin Kramer [Sat, 24 Aug 2019 15:02:44 +0000 (15:02 +0000)]
Use a bit of relaxed constexpr to make FeatureBitset costant intializable

This requires std::intializer_list to be a literal type, which it is
starting with C++14. The downside is that std::bitset is still not
constexpr-friendly so this change contains a re-implementation of most
of it.

Shrinks clang by ~60k.

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

5 years ago[Constant] Add 'isElementWiseEqual()' method
Roman Lebedev [Sat, 24 Aug 2019 06:49:51 +0000 (06:49 +0000)]
[Constant] Add 'isElementWiseEqual()' method

Promoting it from InstCombine's tryToReuseConstantFromSelectInComparison().

Return true if this constant and a constant 'Y' are element-wise equal.
This is identical to just comparing the pointers, with the exception that
for vectors, if only one of the constants has an `undef` element in some
lane, the constants still match.

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

5 years ago[InstCombine] matchThreeWayIntCompare(): commutativity awareness
Roman Lebedev [Sat, 24 Aug 2019 06:49:36 +0000 (06:49 +0000)]
[InstCombine] matchThreeWayIntCompare(): commutativity awareness

Summary:
`matchThreeWayIntCompare()` looks for
```
   select i1 (a == b),
          i32 Equal,
          i32 (select i1 (a < b), i32 Less, i32 Greater)
```
but both of these selects/compares can be in it's commuted form,
so out of 8 variants, only the two most basic ones is handled.
This fixes regression being introduced in D66232.

Reviewers: spatel, nikic, efriedma, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Try to reuse constant from select in leading comparison
Roman Lebedev [Sat, 24 Aug 2019 06:49:25 +0000 (06:49 +0000)]
[InstCombine] Try to reuse constant from select in leading comparison

Summary:
If we have e.g.:
```
  %t = icmp ult i32 %x, 65536
  %r = select i1 %t, i32 %y, i32 65535
```
the constants `65535` and `65536` are suspiciously close.
We could perform a transformation to deduplicate them:
```
Name: ult
%t = icmp ult i32 %x, 65536
%r = select i1 %t, i32 %y, i32 65535
  =>
%t.inv = icmp ugt i32 %x, 65535
%r = select i1 %t.inv, i32 65535, i32 %y
```
https://rise4fun.com/Alive/avb

While this may seem esoteric, this should certainly be good for vectors
(less constant pool usage) and for opt-for-size - need to have only one constant.

But the real fun part here is that it allows further transformation,
in particular it finishes cleaning up the `clamp` folding,
see e.g. `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`.
We start with e.g.
```
  %dont_need_to_clamp_positive = icmp sle i32 %X, 32767
  %dont_need_to_clamp_negative = icmp sge i32 %X, -32768
  %clamp_limit = select i1 %dont_need_to_clamp_positive, i32 -32768, i32 32767
  %dont_need_to_clamp = and i1 %dont_need_to_clamp_positive, %dont_need_to_clamp_negative
  %R = select i1 %dont_need_to_clamp, i32 %X, i32 %clamp_limit
```
without this patch we currently produce
```
  %1 = icmp slt i32 %X, 32768
  %2 = icmp sgt i32 %X, -32768
  %3 = select i1 %2, i32 %X, i32 -32768
  %R = select i1 %1, i32 %3, i32 32767
```
which isn't really a `clamp` - both comparisons are performed on the original value,
this patch changes it into
```
  %1.inv = icmp sgt i32 %X, 32767
  %2 = icmp sgt i32 %X, -32768
  %3 = select i1 %2, i32 %X, i32 -32768
  %R = select i1 %1.inv, i32 32767, i32 %3
```
and then the magic happens! Some further transform finishes polishing it and we finally get:
```
  %t1 = icmp sgt i32 %X, -32768
  %t2 = select i1 %t1, i32 %X, i32 -32768
  %t3 = icmp slt i32 %t2, 32767
  %R = select i1 %t3, i32 %t2, i32 32767
```
which is beautiful and just what we want.

Proofs for `getFlippedStrictnessPredicateAndConstant()` for de-canonicalization:
https://rise4fun.com/Alive/THl
Proofs for the fold itself: https://rise4fun.com/Alive/THl

Reviewers: spatel, dmgreen, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests
Roman Lebedev [Sat, 24 Aug 2019 06:49:11 +0000 (06:49 +0000)]
[InstCombine][NFC] reuse-constant-from-select-in-icmp.ll - revisit tests

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

5 years ago[X86] Add an assert to mark more code that needs to be removed when the vector wideni...
Craig Topper [Sat, 24 Aug 2019 05:59:46 +0000 (05:59 +0000)]
[X86] Add an assert to mark more code that needs to be removed when the vector widening legalization switch is removed again.

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

5 years ago[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build
Fangrui Song [Sat, 24 Aug 2019 02:50:42 +0000 (02:50 +0000)]
[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build

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