Commit Graph

23025 Commits

Author SHA1 Message Date
Simon Pilgrim
5cb1c23dce Strip trailing whitespace. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 19:29:19 +00:00
Haicheng Wu
8c939cb97f [TTI] Refine the cost of EXT in getUserCost()
Now, getUserCost() only checks the src and dst types of EXT to decide it is free
or not. This change first checks the types, then calls isExtFreeImpl(), and
check if EXT can form ExtLoad at last. Currently, only AArch64 has customized
implementation of isExtFreeImpl() to check if EXT can be folded into its use.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-15 02:12:16 +00:00
Dimitry Andric
a774076f84 Fix mixed line terminators. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 21:14:58 +00:00
Jakub Kuderski
cb105529db [Dominators] Make IsPostDominator a template parameter
Summary:
DominatorTreeBase used to have IsPostDominators (bool) member to indicate if the tree is a dominator or a postdominator tree. This made it possible to switch between the two 'modes' at runtime, but it isn't used in practice anywhere.

This patch makes IsPostDominator a template argument. This way, it is easier to switch between different algorithms at compile-time based on this argument and design external utilities around it. It also makes it impossible to incidentally assign a postdominator tree to a dominator tree (and vice versa), and to further simplify template code in GenericDominatorTreeConstruction.

Reviewers: dberlin, sanjoy, davide, grosser

Reviewed By: dberlin

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 18:26:09 +00:00
Nirav Dave
be4d3e6292 Improve Aliasing of operations to static alloca
Recommiting after adding check to avoid miscomputing alias information
on addresses of the same base but different subindices.

Memory accesses offset from frame indices may alias, e.g., we
may merge write from function arguments passed on the stack when they
are contiguous. As a result, when checking aliasing, we consider the
underlying frame index's offset from the stack pointer.

Static allocs are realized as stack objects in SelectionDAG, but its
offset is not set until post-DAG causing DAGCombiner's alias check to
consider access to static allocas to frequently alias. Modify isAlias
to consider access between static allocas and access from other frame
objects to be considered aliasing.

Many test changes are included here. Most are fixes for tests which
indirectly relied on our aliasing ability and needed to be modified to
preserve their original intent.

The remaining tests have minor improvements due to relaxed
ordering. The exception is CodeGen/X86/2011-10-19-widen_vselect.ll
which has a minor degradation dispite though the pre-legalized DAG is
improved.

Reviewers: rnk, mkuper, jonpa, hfinkel, uweigand

Reviewed By: rnk

Subscribers: sdardis, nemanjai, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308025 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 13:56:21 +00:00
Jakub Kuderski
14382189fa [NFC] Move DEBUG_TYPE macro below includes...
in MachineCombiner.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307940 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 19:30:52 +00:00
Simon Dardis
892ccd7f07 Reland "[mips] Fix multiprecision arithmetic."
For multiprecision arithmetic on MIPS, rather than using ISD::ADDE / ISD::ADDC,
get SelectionDAG to break down the operation into ISD::ADDs and ISD::SETCCs.

For MIPS, only the DSP ASE has a carry flag, so in the general case it is not
useful to directly support ISD::{ADDE, ADDC, SUBE, SUBC} nodes.

Also improve the generation code in such cases for targets with
TargetLoweringBase::ZeroOrOneBooleanContent by directly using the result of the
comparison node rather than using it in selects. Similarly for ISD::SUBE /
ISD::SUBC.

Address optimization breakage by moving the generation of MIPS specific integer
multiply-accumulate nodes to before legalization.

This revolves PR32713 and PR33424.

Thanks to Simonas Kazlauskas and Pirama Arumuga Nainar for reporting the issue!

Reviewers: slthakur

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

The previous version of this patch was too aggressive in producing fused
integer multiple-addition instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307906 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 11:28:05 +00:00
Simon Pilgrim
af4437ed7c [DAGCombiner] Fix issue with rotate combines asserting if the constant value types differ from the result type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 10:41:49 +00:00
Simon Pilgrim
5e20776d07 Use isNullConstantOrNullSplatConstant helper. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307895 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 09:39:00 +00:00
Hiroshi Inoue
ff281e5fb6 fix typos in comments and error messges; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 06:48:39 +00:00
Geoff Berry
cc6cfc778f [TargetLowering] Add hook for adding target MMO flags when doing ISel.
Summary: Add TargetLowering hook getMMOFlags() to add target specific
MMO flags to load/store instructions created by ISel.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307879 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 03:49:42 +00:00
Geoff Berry
9bf66c730c [MIR] Add support for printing and parsing target MMO flags
Summary: Add target hooks for printing and parsing target MMO flags.
Targets may override getSerializableMachineMemOperandTargetFlags() to
return a mapping from string to flag value for target MMO values that
should be serialized/parsed in MIR output.

Add implementation of this hook for AArch64 SuppressPair MMO flag.

Reviewers: bogner, hfinkel, qcolombet, MatzeB

Subscribers: mcrosier, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13 02:28:54 +00:00
Eli Friedman
dd70def46c [CodeGenPrepare] Don't create dead instructions in addrmode sinking
When we fail to sink an instruction, we must make sure not to modify
the function; otherwise, we end up in an infinite loop because
CodeGenPrepare iterates until it doesn't make any changes.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 23:30:02 +00:00
Gerolf Hoflehner
5dcc05955f [SjLj] Replace recursive block marking algorithm with iterative algorithm
Summary:
Some programs run into a stack overflow issue. This change avoids this
problem by replacing the recursive algorithm with the iterative version.

Reviewers: MatzeB, t.p.northover, dblaikie

Reviewed By: MatzeB

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 23:05:15 +00:00
Daniel Neilson
a06b091075 Add element atomic memset intrinsic
Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memset intrinsic. This intrinsic is essentially memset with the implementation requirement that all stores used for the assignment are done with unordered-atomic stores of a given element size.

Reviewers: eli.friedman, reames, mkazantsev, skatkov

Reviewed By: reames

Subscribers: jfb, dschuff, sbc100, jgravelle-google, aheejin, efriedma, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 21:57:23 +00:00
Sam Clegg
fc19aecdbe Remove unneeded use of #undef DEBUG_TYPE. NFC
Where is is needed (at the end of headers that define it), be
consistent about its use.

Also fix a few header guards that I found in the process.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 20:49:21 +00:00
Evandro Menezes
0dedcfc77f [CodeGen] Add dependency printer
Add SDep printer to make debugging sessions more productive.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 15:30:59 +00:00
Daniel Neilson
c96acc5425 Add element atomic memmove intrinsic
Summary: Continuing the work from https://reviews.llvm.org/D33240, this change introduces an element unordered-atomic memmove intrinsic. This intrinsic is essentially memmove with the implementation requirement that all loads/stores used for the copy are done with unordered-atomic loads/stores of a given element size.

Reviewers: eli.friedman, reames, mkazantsev, skatkov

Reviewed By: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307796 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 15:25:26 +00:00
Konstantin Zhuravlyov
8f85685860 Enhance synchscope representation
OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
  global and local memory. These scopes restrict how synchronization is
  achieved, which can result in improved performance.

  This change extends existing notion of synchronization scopes in LLVM to
  support arbitrary scopes expressed as target-specific strings, in addition to
  the already defined scopes (single thread, system).

  The LLVM IR and MIR syntax for expressing synchronization scopes has changed
  to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
  replaces *singlethread* keyword), or a target-specific name. As before, if
  the scope is not specified, it defaults to CrossThread/System scope.

  Implementation details:
    - Mapping from synchronization scope name/string to synchronization scope id
      is stored in LLVM context;
    - CrossThread/System and SingleThread scopes are pre-defined to efficiently
      check for known scopes without comparing strings;
    - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
      the bitcode.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307722 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 22:23:00 +00:00
Evandro Menezes
fdda7ea9d5 [CodeGen] Rename DEBUG_TYPE to match passnames
Rename missing DEBUG_TYPE "machine-scheduler" from backend files, which were
absent from https://reviews.llvm.org/rL303921.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 22:08:28 +00:00
Serguei Katkov
a1602eb3fd Revert Revert [MBP] do not rotate loop if it creates extra branch
This is a second attempt to land this patch.

The first one resulted in a crash of clang sanitizer buildbot.
The fix is here and regression test is added.

This is a last fix for the corner case of PR32214. Actually this is not really corner case in general.

We should not do a loop rotation if we create an additional branch due to it.
Consider the case where we have a loop chain H, M, B, C , where
H is header with viable fallthrough from pre-header and exit from the loop
M - some middle block
B - backedge to Header but with exit from the loop also.
C - some cold block of the loop.

Let's H is determined as a best exit. If we do a loop rotation M, B, C, H we can introduce the extra branch.
Let's compute the change in number of branches:
+1 branch from pre-header to header
-1 branch from header to exit
+1 branch from header to middle block if there is such
-1 branch from cold bock to header if there is one

So if C is not a predecessor of H then we introduce extra branch.

This change actually prohibits rotation of the loop if both true
  Best Exit has next element in chain as successor.
  Last element in chain is not a predecessor of first element of chain.

Reviewers: iteratee, xur, sammccall, chandlerc	
Reviewed By: iteratee
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34745


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307631 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 08:34:58 +00:00
Serguei Katkov
0c2ce7e21d [CGP] Relax a bit restriction for optimizeMemoryInst to extend scope
CodeGenPrepare::optimizeMemoryInst contains a check that we do nothing
if all instructions combining the address for memory instruction is in the same
block as memory instruction itself.

However if any of these instruction are placed after memory instruction then
address calculation will not be folded to memory instruction.

The added test case shows an example.

Reviewers: loladiro, spatel, efriedma
Reviewed By: efriedma
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34862


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307628 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 06:24:44 +00:00
Matthias Braun
c364d94de8 Revert "[DAG] Improve Aliasing of operations to static alloca"
Reverting as it breaks tramp3d-v4 in the llvm test-suite. I added some
comments to https://reviews.llvm.org/D33345 about it.

This reverts commit r307546.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307589 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 20:51:30 +00:00
Nirav Dave
c7acbe2ea6 Add DAG argument to canMergeStoresTo NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307583 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 20:25:54 +00:00
Nirav Dave
e791f411d3 [DAG] Improve Aliasing of operations to static alloca
Memory accesses offset from frame indices may alias, e.g., we
may merge write from function arguments passed on the stack when they
are contiguous. As a result, when checking aliasing, we consider the
underlying frame index's offset from the stack pointer.

Static allocs are realized as stack objects in SelectionDAG, but its
offset is not set until post-DAG causing DAGCombiner's alias check to
consider access to static allocas to frequently alias. Modify isAlias
to consider access between static allocas and access from other frame
objects to be considered aliasing.

Many test changes are included here. Most are fixes for tests which
indirectly relied on our aliasing ability and needed to be modified to
preserve their original intent.

The remaining tests have minor improvements due to relaxed
ordering. The exception is CodeGen/X86/2011-10-19-widen_vselect.ll
which has a minor degradation dispite though the pre-legalized DAG is
improved.

Reviewers: rnk, mkuper, jonpa, hfinkel, uweigand

Reviewed By: rnk

Subscribers: sdardis, nemanjai, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 15:39:41 +00:00
Hiroshi Inoue
58d2b3aa33 fix typos in comments and error messages; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 12:44:25 +00:00
Davide Italiano
e7b6244965 [X86] Relax an assertion when legalizing vector types.
WidenVSELECTAndMask can fold (and it folds in this case) so we
get a BUILD_VECTOR of constants as mask. convertMask() seems to
work fine when the input is a vector of constants, and we still
need to call it to extend/add elements at the end. but the current
code just asserts on anything but a SETCC or AND/OR/XOR of 2xSETCC.
This change was discussed briefly with Simon Pilgrim, who also
suggests we might consider dropping this assertion in the future.

Fixes PR33715.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307508 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 19:22:48 +00:00
Simon Pilgrim
3b637f6281 Handle ConstantExpr correctly in SelectionDAGBuilder
This change fixes a bug in SelectionDAGBuilder::visitInsertValue and SelectionDAGBuilder::visitExtractValue where constant expressions (InsertValueConstantExpr and ExtractValueConstantExpr) would be treated as non-constant instructions (InsertValueInst and ExtractValueInst). This bug resulted in an incorrect memory access, which manifested as an assertion failure in SDValue::SDValue.

Fixes PR#33094.

Submitted on behalf of @Praetonus (Benoit Vey)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 16:01:04 +00:00
Igor Breger
7e96a89b3c [FastISel] fix a fallback diagnostic.
Summary: FastISel was marked as failed in case instruction selection succeeded.

Reviewers: qcolombet, zvi, rovka, ab

Reviewed By: zvi

Subscribers: javed.absar, ab, qcolombet, bogner, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 05:55:20 +00:00
Hiroshi Inoue
5c99c6a26a fix trivial typos; NFC
sucessor -> successor 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 05:54:44 +00:00
Sanjay Patel
16c930ae14 [DAGCombiner] use local variable to shorten code; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:34:42 +00:00
Quentin Colombet
4e13bac06c [RegAllocFast] Don't insert kill flags of super-register for partial kill
When reusing a register for a new definition, the fast register allocator
used to insert a kill flag at the previous last use of that register to
inform later passes that this register is free between the redef and the
last use. However, this may be wrong when subregisters are involved.
Indeed, a partially redef would have trigger a kill of the full super
register, potentially wrongly marking all the other subregisters as
free. Given we don't track which lanes are still live, we cannot set the
kill flag in such case.

Note: This bug has been latent for about 7 years (r104056).

llvmg.org/PR33677

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307428 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:25:45 +00:00
Quentin Colombet
b8caa0933a [RegAllocFast] Add the proper initialize method to use the .mir infrastructure
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307427 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 19:25:42 +00:00
Matthias Braun
192187283c RegisterScavenging: Fix PR33687
When scavenging for a use in instruction MI, we will reload after
that instruction and hence cannot spill uses/defs of this instruction.

This fixes http://llvm.org/PR33687

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 03:02:18 +00:00
Matthias Braun
a819fad865 LiveRegUnits: Rename accumulateBackward()->accumulate()
Contrary to the stepForward()/stepBackward() method accumulate() doesn't
have a direction as defs, uses and clobbers all have the same effect.

Also improve the documentation comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307351 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 03:02:17 +00:00
Mikael Holmen
0bce6b7bb4 [MachineVerifier] Add check that tied physregs aren't different.
Summary: Added MachineVerifier code to check register ties more thoroughly, especially so that physical registers that are tied are the same. This may help e.g. when creating MIR files.

Original patch by Jesper Antonsson

Reviewers: stoklund, sanjoy, qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307259 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 13:18:21 +00:00
David Stuttard
3b312dd635 [RegisterCoalescer] Fix for SubRange join unreachable
Summary:
During remat, some subranges might end up having invalid segments which caused problems for later
coalescing.

Added in a check to remove segments that are invalidated as part of the remat.

See http://llvm.org/PR33524

Subscribers: MatzeB, qcolombet

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 10:07:57 +00:00
Diana Picus
e9e0d4fb83 [ARM] GlobalISel: Legalize G_FCMP for s32
This covers both hard and soft float.

Hard float is easy, since it's just Legal.

Soft float is more involved, because there are several different ways to
handle it based on the predicate: one and ueq need not only one, but two
libcalls to get a result. Furthermore, we have large differences between
the values returned by the AEABI and GNU functions.

AEABI functions return a nice 1 or 0 representing true and respectively
false. GNU functions generally return a value that needs to be compared
against 0 (e.g. for ogt, the value returned by the libcall is > 0 for
true).  We could introduce redundant comparisons for AEABI as well, but
they don't seem easy to remove afterwards, so we do different processing
based on whether or not the result really needs to be compared against
something (and just truncate if it doesn't).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 09:09:33 +00:00
Vadim Chugunov
a671f7f9d2 Fix libcall expansion creating DAG nodes with invalid type post type legalization.
If we are lowering a libcall after legalization, we'll split the return type into a pair of legal values.

Patch by Jatin Bhateja and Eli Friedman.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 22:01:49 +00:00
Simon Pilgrim
5a32446d7b {DAGCombiner] Fold (rot x, 0) -> x
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307184 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 18:27:11 +00:00
Andrew Zhogin
e54a2b399d [DAGCombiner] visitRotate patch to optimize pair of ROTR/ROTL instructions into one with combined shift operand.
For two ROTR operations with shifts C1, C2; combined shift operand will be (C1 + C2) % bitsize.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 17:55:42 +00:00
Daniel Sanders
b26b47eeb0 [globalisel][tablegen] Finish fixing compile-time regressions by merging the matcher and emitter state machines.
Summary:
Also, made a few minor tweaks to shave off a little more cumulative memory consumption:
* All rules share a single NewMIs instead of constructing their own. Only one
  will end up using it.
* Use MIs.resize(1) instead of MIs.clear();MIs.push_back(I) and prevent
  GIM_RecordInsn from changing MIs[0].

Depends on D33764

Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar

Reviewed By: ab

Subscribers: kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307159 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 14:50:18 +00:00
Diana Picus
f1715a330a [GlobalISel] Refactor Legalizer helpers for libcalls
We used to have a helper that replaced an instruction with a libcall.
That turns out to be too aggressive, since sometimes we need to replace
the instruction with at least two libcalls. Therefore, change our
existing helper to only create the libcall and leave the instruction
removal as a separate step. Also rename the helper accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 12:57:24 +00:00
Diana Picus
5d663de6b1 [MachineIRBuilder] Fix formatting. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 11:47:23 +00:00
Diana Picus
004d5b661f [MachineIRBuilder] Add buildOr helper. NFC.
This isn't used anywhere yet, but I need it for a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 11:32:12 +00:00
Igor Breger
179b206a6c [GlobalIsel] allow x86_fp80 values to be dumped.
Summary:
Otherwise the fallback path fails with an assertion on x86_64 targets,
when "x86_fp80" is encountered.

Reviewers: t.p.northover, zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 11:11:10 +00:00
Diana Picus
dd5cf95d9b [MachineIRBuilder] Add buildBinaryOp helper. NFC
Add a helper for building simple binary ops like add, mul, sub, and.
This can be used in the future for quickly adding support for or, xor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 11:02:31 +00:00
Daniel Sanders
90b8bac67b [globalisel][tablegen] Fix an unused variable warning in release builds after r307133
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307138 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 10:16:48 +00:00
Daniel Sanders
71e8bec63a [globalisel][tablegen] Added instruction emission to the state-machine-based matcher.
Summary:
This further improves the compile-time regressions that will be caused by a
re-commit of r303259.

Also added included preliminary work in preparation for the multi-insn emitter
since I needed to change the relevant part of the API for this patch anyway.

Depends on D33758

Reviewers: rovka, vitalybuka, ab, t.p.northover, qcolombet, aditya_nandakumar

Reviewed By: ab

Subscribers: kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 09:39:33 +00:00
Nirav Dave
3f4f926b6a Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset
Relanding after rewriting undef.ll test to avoid host-dependant
endianness.

As discussed in D34087, rewrite areNonVolatileConsecutiveLoads using
generic checks. Also, propagate missing local handling from there to
BaseIndexOffset checks.

Tests of note:

  * test/CodeGen/X86/build-vector* - Improved.
  * test/CodeGen/BPF/undef.ll - Improved store alignment allows an
    additional store merge

  * test/CodeGen/X86/clear_upper_vector_element_bits.ll - This is a
    case we already do not handle well. Here, the DAG is improved, but
    scheduling causes a code size degradation.

Reviewers: RKSimon, craig.topper, spatel, andreadb, filcab

Subscribers: nemanjai, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307114 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 01:21:23 +00:00