OSDN Git Service

android-x86/external-llvm.git
7 years agoUse a WeakVH for UnknownInstructions in AliasSetTracker
Sanjoy Das [Sat, 11 Mar 2017 01:15:48 +0000 (01:15 +0000)]
Use a WeakVH for UnknownInstructions in AliasSetTracker

Summary:
This change solves the same problem as D30726, except that this only
throws out the bathwater.

AST was not correctly tracking and deleting UnknownInstructions via
handles.  The existing code only tracks "pointers" in its
`ASTCallbackVH`, so an UnknownInstruction (that isn't also def'ing a
pointer used by another memory instruction) never gets a
`ASTCallbackVH`.

There are two other ways to solve this problem:

 - Use the `PointerRec` scheme for both known and unknown instructions.
 - Use a `CallbackVH` that erases the offending Instruction from the
   UnknownInstruction list.

Both of the above changes seemed to be significantly (and unnecessarily
IMO) more complex than this.

Reviewers: chandlerc, dberlin, hfinkel, reames

Subscribers: mcrosier, llvm-commits

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

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

7 years agoVNCoercion: Make the function signatures all consistent
Daniel Berlin [Sat, 11 Mar 2017 00:51:01 +0000 (00:51 +0000)]
VNCoercion: Make the function signatures all consistent

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

7 years ago[AMDGPU] Remove getBidirectionalReasonRank
Stanislav Mekhanoshin [Sat, 11 Mar 2017 00:29:27 +0000 (00:29 +0000)]
[AMDGPU] Remove getBidirectionalReasonRank

This method inverts the Reason field of a scheduling candidate.
It does right comparison between RegCritical and RegExcess, but
everything else is broken. In fact it can prefer less strong reason
such as Weak over RegCritical because Weak > -RegCritical.

The CandReason enum is properly sorted, so just remove artificial
ranking.

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

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

7 years ago[IRTranslator] Simplify error handling for translating constants. NFC.
Quentin Colombet [Sat, 11 Mar 2017 00:28:33 +0000 (00:28 +0000)]
[IRTranslator] Simplify error handling for translating constants. NFC.

We don't need to check whether the fallback path is enabled to return
false. Just do that all the time on error cases, the caller knows (or
at least should know!) how to handle the failing case.

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

7 years agoFix subreg value numbers in handleMoveUp
Stanislav Mekhanoshin [Sat, 11 Mar 2017 00:14:52 +0000 (00:14 +0000)]
Fix subreg value numbers in handleMoveUp

The problem can occur in presence of subregs. If we are swapping two
instructions defining different subregs of the same register we will
get a new liveout from a block. We need to preserve value number for
block's liveout for successor block's livein to match.

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

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

7 years agoStrip trailing whitespace.
Simon Pilgrim [Fri, 10 Mar 2017 22:53:19 +0000 (22:53 +0000)]
Strip trailing whitespace.

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

7 years agoFix redundant condition (PR32138)
Simon Pilgrim [Fri, 10 Mar 2017 22:44:47 +0000 (22:44 +0000)]
Fix redundant condition (PR32138)

'!A || (A && B)' is equivalent to '!A || B'

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

7 years ago[RDF] Remove the map of reaching defs from copy propagation
Krzysztof Parzyszek [Fri, 10 Mar 2017 22:44:24 +0000 (22:44 +0000)]
[RDF] Remove the map of reaching defs from copy propagation

Use Liveness::getNearestAliasedRef to find the reaching def instead.

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

7 years ago[RDF] Implement Liveness::getNearestAliasedRef(Reg, Inst)
Krzysztof Parzyszek [Fri, 10 Mar 2017 22:42:17 +0000 (22:42 +0000)]
[RDF] Implement Liveness::getNearestAliasedRef(Reg, Inst)

This function will find the closest ref node aliased to Reg that is
in an instruction preceding Inst. This could be used to identify the
hypothetical reaching def of Reg, if Reg was a member of Inst.

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

7 years ago[X86][SSE] Fix load folding for (V)CVTDQ2PD
Simon Pilgrim [Fri, 10 Mar 2017 22:35:07 +0000 (22:35 +0000)]
[X86][SSE] Fix load folding for (V)CVTDQ2PD

This only requires a 64-bit memory source, not the whole 128-bits. But the 128-bit case is still supported via X86InstrInfo::foldMemoryOperandImpl

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

7 years ago[X86] Fix Wunused-lambda-capture warning
Simon Pilgrim [Fri, 10 Mar 2017 22:10:34 +0000 (22:10 +0000)]
[X86] Fix Wunused-lambda-capture warning

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

7 years ago[X86][RTM] Regenerate RTM intrinsic tests for 32/64-bit targets.
Simon Pilgrim [Fri, 10 Mar 2017 21:55:24 +0000 (21:55 +0000)]
[X86][RTM] Regenerate RTM intrinsic tests for 32/64-bit targets.

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

7 years agoRespect CMAKE_INSTALL_MANDIR for sphinx generated manpages
Jonathan Roelofs [Fri, 10 Mar 2017 21:44:16 +0000 (21:44 +0000)]
Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages

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

7 years agoLTO: Hash type identifier resolutions for WholeProgramDevirt.
Peter Collingbourne [Fri, 10 Mar 2017 21:37:10 +0000 (21:37 +0000)]
LTO: Hash type identifier resolutions for WholeProgramDevirt.

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

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

7 years agoLTO: Hash type identifier resolutions for LowerTypeTests.
Peter Collingbourne [Fri, 10 Mar 2017 21:35:17 +0000 (21:35 +0000)]
LTO: Hash type identifier resolutions for LowerTypeTests.

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

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

7 years ago[GlobalISel] LegalizerHelper: Lower (G_FSUB X, Y) to (G_FADD X, (G_FNEG Y))
Volkan Keles [Fri, 10 Mar 2017 21:25:09 +0000 (21:25 +0000)]
[GlobalISel] LegalizerHelper: Lower (G_FSUB X, Y) to (G_FADD X, (G_FNEG Y))

Summary: No test case as none of the in-tree targets with GlobalISel support has this condition.

Reviewers: qcolombet, aditya_nandakumar, dsanders, t.p.northover, ab

Reviewed By: qcolombet

Subscribers: dberris, rovka, kristof.beyls, llvm-commits, igorb

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

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

7 years agoGlobalISel: Translate ConstantAggregateZero vectors
Volkan Keles [Fri, 10 Mar 2017 21:23:13 +0000 (21:23 +0000)]
GlobalISel: Translate ConstantAggregateZero vectors

Reviewers: qcolombet, aditya_nandakumar, dsanders, ab, t.p.northover, javed.absar

Reviewed By: qcolombet

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

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

7 years agoSink accessing TII to fix release Werror builds.
Eric Christopher [Fri, 10 Mar 2017 21:20:17 +0000 (21:20 +0000)]
Sink accessing TII to fix release Werror builds.

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

7 years ago[ProfileSummaryInfo] Remove unneeded braces. NFCI.
Davide Italiano [Fri, 10 Mar 2017 20:50:51 +0000 (20:50 +0000)]
[ProfileSummaryInfo] Remove unneeded braces. NFCI.

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

7 years agoFix all these headers to properly mark the doxygen comments.
Daniel Berlin [Fri, 10 Mar 2017 20:44:39 +0000 (20:44 +0000)]
Fix all these headers to properly mark the doxygen comments.

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

7 years ago[AArch64, X86] Additional debug information for MacroFusion
Evandro Menezes [Fri, 10 Mar 2017 20:20:04 +0000 (20:20 +0000)]
[AArch64, X86] Additional debug information for MacroFusion

In order to make it easier to parse information about the performance of
MacroFusion, this patch adds the function and the instruction names to the
debug output of this pass.

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

7 years agoWholeProgramDevirt: Implement export/import support for VCP.
Peter Collingbourne [Fri, 10 Mar 2017 20:13:58 +0000 (20:13 +0000)]
WholeProgramDevirt: Implement export/import support for VCP.

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

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

7 years agoWholeProgramDevirt: Implement export/import support for unique ret val opt.
Peter Collingbourne [Fri, 10 Mar 2017 20:09:11 +0000 (20:09 +0000)]
WholeProgramDevirt: Implement export/import support for unique ret val opt.

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

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

7 years agoRefactor the PSI to extract getCallSiteCount and remove checks for profile type.
Dehao Chen [Fri, 10 Mar 2017 19:45:16 +0000 (19:45 +0000)]
Refactor the PSI to extract getCallSiteCount and remove checks for profile type.

Summary: There is no need to check profile count as only CallInst will have metadata attached.

Reviewers: eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU] Split R600/SI getFrameIndexReference and emit stack object offsets for SI
Konstantin Zhuravlyov [Fri, 10 Mar 2017 19:39:07 +0000 (19:39 +0000)]
[AMDGPU] Split R600/SI getFrameIndexReference and emit stack object offsets for SI

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

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

7 years agoRename PT_NOTE namespace name used in AMDGPUPTNote.h
Yaxun Liu [Fri, 10 Mar 2017 19:35:43 +0000 (19:35 +0000)]
Rename PT_NOTE namespace name used in AMDGPUPTNote.h

Patch by Guansong Zhang.

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

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

7 years ago[GlobalISel] Translate insertelement and extractelement
Volkan Keles [Fri, 10 Mar 2017 19:08:28 +0000 (19:08 +0000)]
[GlobalISel] Translate insertelement and extractelement

Reviewers: qcolombet, aditya_nandakumar, dsanders, ab, t.p.northover, javed.absar

Reviewed By: qcolombet

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

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

7 years agoNewGVN: Rename InitialClass to TOP, which is what most people would expect it to...
Daniel Berlin [Fri, 10 Mar 2017 19:05:04 +0000 (19:05 +0000)]
NewGVN: Rename InitialClass to TOP, which is what most people would expect it to be called

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

7 years ago[SLP] Revert everything that has to do with memory access sorting.
Michael Kuperstein [Fri, 10 Mar 2017 18:59:07 +0000 (18:59 +0000)]
[SLP] Revert everything that has to do with memory access sorting.

This reverts r293386, r294027, r294029 and r296411.

Turns out the SLP tree isn't actually a "tree" and we don't handle
accessing the same packet of loads in several different orders well,
causing miscompiles.

Revert until we can fix this properly.

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

7 years ago[SelectionDAG] Add support for BUILD_VECTOR to ComputeNumSignBits
Simon Pilgrim [Fri, 10 Mar 2017 18:36:46 +0000 (18:36 +0000)]
[SelectionDAG] Add support for BUILD_VECTOR to ComputeNumSignBits

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

7 years ago[GlobalISel] Make LegalizerInfo accessible in LegalizerHelper
Volkan Keles [Fri, 10 Mar 2017 18:34:57 +0000 (18:34 +0000)]
[GlobalISel] Make LegalizerInfo accessible in LegalizerHelper

Summary:
We don’t actually use LegalizerInfo in Legalizer pass, it’s just passed
as an argument.

In order to check if an instruction is legal or not, we need to get LegalizerInfo
by calling `MI.getParent()->getParent()->getSubtarget().getLegalizerInfo()`.
Instead, make LegalizerInfo accessible in LegalizerHelper.

Reviewers: qcolombet, aditya_nandakumar, dsanders, ab, t.p.northover, kristof.beyls

Reviewed By: qcolombet

Subscribers: dberris, llvm-commits, rovka

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

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

7 years agoCODE_OWNERS: Take code ownership of instruction scheduling.
Matthias Braun [Fri, 10 Mar 2017 18:34:37 +0000 (18:34 +0000)]
CODE_OWNERS: Take code ownership of instruction scheduling.

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

7 years agoCODE_OWNERS: Sort names
Matthias Braun [Fri, 10 Mar 2017 18:34:33 +0000 (18:34 +0000)]
CODE_OWNERS: Sort names

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

7 years ago[Support] Don't return an error if realPath fails.
Zachary Turner [Fri, 10 Mar 2017 18:33:41 +0000 (18:33 +0000)]
[Support] Don't return an error if realPath fails.

In openFileForRead, we would not previously return an error
if real_path resolution failed.  After a recent patch, we
started propagating this error up.  This caused a failure
in clang when trying to call openFileForRead("nul").  This
patch restores the previous behavior of not propagating this
error up.

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

7 years ago[X86][SSE] Added tests showing missed truncations for sitofp conversion
Simon Pilgrim [Fri, 10 Mar 2017 18:01:53 +0000 (18:01 +0000)]
[X86][SSE] Added tests showing missed truncations for sitofp conversion

SelectionDAG::ComputeNumSignBits is poor at build_vector handling, meaning that we can't see that all the vXi64 sources are in fact sign extended i32 or smaller.

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

7 years agoFix test failure when Home directory cannot be found.
Zachary Turner [Fri, 10 Mar 2017 17:47:13 +0000 (17:47 +0000)]
Fix test failure when Home directory cannot be found.

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

7 years agoAdd llvm::sys::fs::real_path.
Zachary Turner [Fri, 10 Mar 2017 17:39:21 +0000 (17:39 +0000)]
Add llvm::sys::fs::real_path.

LLVM already has real_path like functionality, but it is
cumbersome to use and involves clean up after (e.g. you have
to call openFileForRead, then close the resulting FD).

Furthermore, on Windows it doesn't work for directories since
opening a directory and opening a file require slightly
different flags.

So I add a simple function `real_path` which works for all
paths on all platforms and has a simple to use interface.

In doing so, I add the ability to opt in to resolving tilde
expressions (e.g. ~/foo), which are normally handled by
the shell.

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

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

7 years ago[SelectionDAG] Make SelectionDAG aware of the known bits in USUBO and SSUBO and SUBC.
Amaury Sechet [Fri, 10 Mar 2017 17:26:44 +0000 (17:26 +0000)]
[SelectionDAG] Make SelectionDAG aware of the known bits in USUBO and SSUBO and SUBC.

Summary:
Depends on D30379

This improves the state of things for the sub class of operation.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

7 years ago[X86][MMX] Add tests showing missed opportunities to use MMX sitofp conversions
Simon Pilgrim [Fri, 10 Mar 2017 17:23:55 +0000 (17:23 +0000)]
[X86][MMX] Add tests showing missed opportunities to use MMX sitofp conversions

If we are transferring MMX registers to XMM for conversion we could use the MMX equivalents (CVTPI2PD + CVTPI2PS) without affecting rounding/exceptions etc.

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

7 years ago[SelectionDAG] Make SelectionDAG aware of the known bits in UADDO and SADDO.
Amaury Sechet [Fri, 10 Mar 2017 17:06:52 +0000 (17:06 +0000)]
[SelectionDAG] Make SelectionDAG aware of the known bits in UADDO and SADDO.

Summary: As per title. This is extracted from D29872 and I threw SADDO in.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

7 years ago[X86][MMX] Add tests showing missed opportunities to use MMX fptosi conversions
Simon Pilgrim [Fri, 10 Mar 2017 16:59:43 +0000 (16:59 +0000)]
[X86][MMX] Add tests showing missed opportunities to use MMX fptosi conversions

If we are transferring XMM conversion results to MMX registers we could use the MMX equivalents (CVTPD2PI/CVTTPD2PI + CVTPS2PI/CVTTPS2PI) with affecting rounding/expections etc.

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

7 years ago[X86][MMX] Updated bad stack spill shift value test to actually show the problem
Simon Pilgrim [Fri, 10 Mar 2017 16:18:50 +0000 (16:18 +0000)]
[X86][MMX] Updated bad stack spill shift value test to actually show the problem

Cleaning up the ir had stopped showing the issue.

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

7 years ago[X86][MMX] Regenerate mmx bitcast tests
Simon Pilgrim [Fri, 10 Mar 2017 16:07:39 +0000 (16:07 +0000)]
[X86][MMX] Regenerate mmx bitcast tests

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

7 years ago[X86][MMX] Add test showing bad stack spill of shift value
Simon Pilgrim [Fri, 10 Mar 2017 15:53:41 +0000 (15:53 +0000)]
[X86][MMX] Add test showing bad stack spill of shift value

i32 is spilled to stack but 64-bit mmx is reloaded - leaving garbage in the other half of the register

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

7 years ago[X86][MMX] Regenerate mmx load folding tests
Simon Pilgrim [Fri, 10 Mar 2017 15:41:05 +0000 (15:41 +0000)]
[X86][MMX] Regenerate mmx load folding tests

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

7 years agoFix signed/unsigned comparison warnings
Simon Pilgrim [Fri, 10 Mar 2017 14:16:55 +0000 (14:16 +0000)]
Fix signed/unsigned comparison warnings

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

7 years agoFix Wdocumentation warning
Simon Pilgrim [Fri, 10 Mar 2017 14:01:50 +0000 (14:01 +0000)]
Fix Wdocumentation warning

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

7 years ago[APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt
Simon Pilgrim [Fri, 10 Mar 2017 13:44:32 +0000 (13:44 +0000)]
[APInt] Add APInt::insertBits() method to insert an APInt into a larger APInt

We currently have to insert bits via a temporary variable of the same size as the target with various shift/mask stages, resulting in further temporary variables, all of which require the allocation of memory for large APInts (MaskSizeInBits > 64).

This is another of the compile time issues identified in PR32037 (see also D30265).

This patch adds the APInt::insertBits() helper method which avoids the temporary memory allocation and masks/inserts the raw bits directly into the target.

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

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

7 years ago[mips][msa] Accept more values for constant splats
Simon Dardis [Fri, 10 Mar 2017 13:27:14 +0000 (13:27 +0000)]
[mips][msa] Accept more values for constant splats

This patches teaches the MIPS backend to accept more values for constant
splats. Previously, only 10 bit signed immediates or values that could be
loaded using an ldi.[bhwd] instruction would be acceptted. This patch relaxes
that constraint so that any constant value that be splatted is accepted.

As a result, the constant pool is used less for vector operations, and the
suite of bit manipulation instructions b(clr|set|neg)i can now be used with
the full range of their immediate operand.

Reviewers: slthakur

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

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

7 years agoimm_comp_XFORM (defined in ARMInstrThumb.td) duplicates imm_not_XFORM (defined in...
Artyom Skrobov [Fri, 10 Mar 2017 13:21:12 +0000 (13:21 +0000)]
imm_comp_XFORM (defined in ARMInstrThumb.td) duplicates imm_not_XFORM (defined in ARMInstrInfo.td)

Reviewers: grosbach, rengolin, jmolloy

Reviewed By: jmolloy

Subscribers: aemerson, llvm-commits

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

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

7 years ago[Assembler] Add location info to unary expressions.
Sanne Wouda [Fri, 10 Mar 2017 13:08:20 +0000 (13:08 +0000)]
[Assembler] Add location info to unary expressions.

Summary:
This is a continuation of D28861.  Add an SMLoc to MCUnaryExpr such that
a better diagnostic can be given in case of an error in later stages of
assembling.

Reviewers: rengolin, grosbach, javed.absar, olista01

Reviewed By: olista01

Subscribers: llvm-commits

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

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

7 years agoRefactor the multiply-accumulate combines to act on
Artyom Skrobov [Fri, 10 Mar 2017 12:41:33 +0000 (12:41 +0000)]
Refactor the multiply-accumulate combines to act on
ARMISD::ADD[CE] nodes, instead of the generic ISD::ADD[CE].

Summary:
This allows for some simplification because the combines
are no longer limited to just one go at the node before
it gets legalized into an ARM target-specific one.

Reviewers: jmolloy, rogfer01

Subscribers: aemerson, llvm-commits, rengolin

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

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

7 years agoWholeProgramDevirt: Fixed compilation error under MSVS2015.
George Rimar [Fri, 10 Mar 2017 10:31:56 +0000 (10:31 +0000)]
WholeProgramDevirt: Fixed compilation error under MSVS2015.

It was introduced in:

r296945
WholeProgramDevirt: Implement exporting for single-impl devirtualization.
---------------------
r296939
WholeProgramDevirt: Add any unsuccessful llvm.type.checked.load devirtualizations to the list of llvm.type.test users.
---------------------

Microsoft Visual Studio Community 2015
Version 14.0.23107.0 D14REL
Does not compile that code without additional brackets, showing multiple error like below:

WholeProgramDevirt.cpp(1216): error C2958: the left bracket '[' found at 'c:\access_softek\llvm\lib\transforms\ipo\wholeprogramdevirt.cpp(1216)' was not matched correctly
WholeProgramDevirt.cpp(1216): error C2143: syntax error: missing ']' before '}'
WholeProgramDevirt.cpp(1216): error C2143: syntax error: missing ';' before '}'
WholeProgramDevirt.cpp(1216): error C2059: syntax error: ']'

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

7 years ago[llvm-readobj] Support SHT_MIPS_DWARF section type flag
Simon Atanasyan [Fri, 10 Mar 2017 08:22:25 +0000 (08:22 +0000)]
[llvm-readobj] Support SHT_MIPS_DWARF section type flag

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

7 years ago[MC] Set SHT_MIPS_DWARF section type for all .debug_* sections on MIPS
Simon Atanasyan [Fri, 10 Mar 2017 08:22:20 +0000 (08:22 +0000)]
[MC] Set SHT_MIPS_DWARF section type for all .debug_* sections on MIPS

All MIPS .debug_* sections should be marked with ELF type SHT_MIPS_DWARF
accordingly the specification [1]. Also the same section type is assigned
to these sections by GNU tools.

[1] ftp.software.ibm.com/software/os390/czos/dwarf/mips_extensions.pdf

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

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

7 years ago[MC] Accept a numeric value as an ELF section header's type
Simon Atanasyan [Fri, 10 Mar 2017 08:22:13 +0000 (08:22 +0000)]
[MC] Accept a numeric value as an ELF section header's type

GAS supports specification of section header's type using a numeric
value [1]. This patch brings the same functionality to LLVM. That allows
to setup some target-specific section types belong to the SHT_LOPROC -
SHT_HIPROC range. If we attempt to print unknown section type, MCSectionELF
class shows an error message. It's better than print sole '@' sign
without any section type name.

In case of MIPS, example of such section's type is SHT_MIPS_DWARF.
Without the patch we will have to implement some workarounds
in probably not-MIPS-specific part of code base to convert SHT_MIPS_DWARF
to the @progbits while printing assembly and to assign SHT_MIPS_DWARF for
@progbits sections named .debug_* if we encounter such section in
an input assembly.

[1] https://sourceware.org/binutils/docs/as/Section.html

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

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

7 years agoFor Thumb1, lower ADDC/ADDE/SUBC/SUBE via the glueless ARMISD nodes,
Artyom Skrobov [Fri, 10 Mar 2017 07:40:27 +0000 (07:40 +0000)]
For Thumb1, lower ADDC/ADDE/SUBC/SUBE via the glueless ARMISD nodes,
same as already done for ARM and Thumb2.

Reviewers: jmolloy, rogfer01, efriedma

Subscribers: aemerson, llvm-commits, rengolin

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

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

7 years agoImplement getPassName() for IR printing passes.
Yaron Keren [Fri, 10 Mar 2017 07:09:20 +0000 (07:09 +0000)]
Implement getPassName() for IR printing passes.

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

7 years agoAMDGPU: Fix insertion point when reducing load intrinsics
Matt Arsenault [Fri, 10 Mar 2017 05:25:49 +0000 (05:25 +0000)]
AMDGPU: Fix insertion point when reducing load intrinsics

The insertion point may be later than the next instruction,
so it is necessary to set it when replacing the call.

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

7 years agoMove memory coercion functions from GVN.cpp to VNCoercion.cpp so they can be shared...
Daniel Berlin [Fri, 10 Mar 2017 04:54:10 +0000 (04:54 +0000)]
Move memory coercion functions from GVN.cpp to VNCoercion.cpp so they can be shared between GVN and NewGVN.

Summary:
These are the functions used to determine when values of loads can be
extracted from stores, etc, and to perform the necessary insertions to
do this.  There are no changes to the functions themselves except
reformatting, and one case where memdep was informed of a removed load
(which was pushed into the caller).

Reviewers: davide

Subscribers: mgorny, llvm-commits, Prazek

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

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

7 years agoDo not use branch metadata to check if a basic block is hot.
Dehao Chen [Fri, 10 Mar 2017 01:44:37 +0000 (01:44 +0000)]
Do not use branch metadata to check if a basic block is hot.

Summary: We should not use that to check basic block hotness as optimization may mess it up.

Reviewers: eraman

Reviewed By: eraman

Subscribers: llvm-commits

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

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

7 years ago[x86] add tests for vec div/rem with 0 element in divisor; NFC
Sanjay Patel [Fri, 10 Mar 2017 00:55:29 +0000 (00:55 +0000)]
[x86] add tests for vec div/rem with 0 element in divisor; NFC

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

7 years agoPatternMatch; Add m_ZExtOrSExt matcher
Matt Arsenault [Fri, 10 Mar 2017 00:47:35 +0000 (00:47 +0000)]
PatternMatch; Add m_ZExtOrSExt matcher

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

7 years agoNewGVN: Rewrite DCE during elimination so we do it as well as old GVN did.
Daniel Berlin [Fri, 10 Mar 2017 00:32:33 +0000 (00:32 +0000)]
NewGVN: Rewrite DCE during elimination so we do it as well as old GVN did.

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

7 years agoNewGVN: Rename a few things for clarity
Daniel Berlin [Fri, 10 Mar 2017 00:32:26 +0000 (00:32 +0000)]
NewGVN: Rename a few things for clarity

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

7 years ago[GlobalISel] Use ImmutableCallSite instead of templates. NFC.
Ahmed Bougacha [Fri, 10 Mar 2017 00:25:44 +0000 (00:25 +0000)]
[GlobalISel] Use ImmutableCallSite instead of templates. NFC.

ImmutableCallSite abstracts away CallInst and InvokeInst. Use it!

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

7 years ago[GlobalISel] Fallback when failing to translate invoke.
Ahmed Bougacha [Fri, 10 Mar 2017 00:25:35 +0000 (00:25 +0000)]
[GlobalISel] Fallback when failing to translate invoke.

We unintentionally stopped falling back in r293670.

While there, change an unusual construct.

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

7 years agoAdd support for DenseMap/DenseSet count and find using const pointers
Daniel Berlin [Fri, 10 Mar 2017 00:25:26 +0000 (00:25 +0000)]
Add support for DenseMap/DenseSet count and find using const pointers

Summary:
Similar to SmallPtrSet, this makes find and count work with both const
referneces and const pointers.

Reviewers: dblaikie

Subscribers: llvm-commits, mzolotukhin

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

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

7 years ago[Unittests] Fix a build failure with clang 3.8. NFCI.
Davide Italiano [Thu, 9 Mar 2017 23:48:58 +0000 (23:48 +0000)]
[Unittests] Fix a build failure with clang 3.8. NFCI.

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

7 years agoGlobalISel: support trivial inlineasm calls.
Tim Northover [Thu, 9 Mar 2017 23:36:26 +0000 (23:36 +0000)]
GlobalISel: support trivial inlineasm calls.

They're used for nefarious purposes by ObjC.

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

7 years agoRefactor alias check from MISched into common helper. NFC.
Eli Friedman [Thu, 9 Mar 2017 23:33:36 +0000 (23:33 +0000)]
Refactor alias check from MISched into common helper. NFC.

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

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

7 years ago[WebAssembly] Fix the opcode numbers for floating-point le and gt.
Dan Gohman [Thu, 9 Mar 2017 23:08:21 +0000 (23:08 +0000)]
[WebAssembly] Fix the opcode numbers for floating-point le and gt.

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

7 years ago[DAGCombiner] Do various combine on uaddo.
Amaury Sechet [Thu, 9 Mar 2017 22:47:00 +0000 (22:47 +0000)]
[DAGCombiner] Do various combine on uaddo.

Summary: This essentially does the same transform as for ADC.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

7 years ago[Hexagon] Fixes to the bitsplit generation
Krzysztof Parzyszek [Thu, 9 Mar 2017 22:02:14 +0000 (22:02 +0000)]
[Hexagon] Fixes to the bitsplit generation

- Fix the insertion point, which occasionally could have been incorrect.
- Avoid creating multiple bitsplits with the same operands, if an old one
  could be reused.

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

7 years agoGlobalISel: inform FrameLowering when we emit a function call.
Tim Northover [Thu, 9 Mar 2017 22:00:39 +0000 (22:00 +0000)]
GlobalISel: inform FrameLowering when we emit a function call.

Amongst other things (I expect) this is necessary to ensure decent backtraces
when an "unreachable" is involved.

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

7 years ago[InstSimplify] allow folds for bool vector div/rem
Sanjay Patel [Thu, 9 Mar 2017 21:56:03 +0000 (21:56 +0000)]
[InstSimplify] allow folds for bool vector div/rem

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

7 years agoGlobalISel: put debug info for static allocas in the MachineFunction.
Tim Northover [Thu, 9 Mar 2017 21:12:06 +0000 (21:12 +0000)]
GlobalISel: put debug info for static allocas in the MachineFunction.

The good reason to do this is that static allocas are pretty simple to handle
(especially at -O0) and avoiding tracking DBG_VALUEs throughout the pipeline
should give some kind of performance benefit.

The bad reason is that the debug pipeline is an unholy mess of implicit
contracts, where determining whether "DBG_VALUE %reg, imm" actually implies a
load or not involves the services of at least 3 soothsayers and the sacrifice
of at least one chicken.  And it still gets it wrong if the variable is at SP
directly.

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

7 years ago[ConstantFold] vector div/rem with any zero element in divisor is undef
Sanjay Patel [Thu, 9 Mar 2017 20:42:30 +0000 (20:42 +0000)]
[ConstantFold] vector div/rem with any zero element in divisor is undef

Follow-up for:
https://reviews.llvm.org/D30665
https://reviews.llvm.org/rL297390

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

7 years agoAMDGPU: Support for SimplifyDemandedVectorElts for load intrinsics
Matt Arsenault [Thu, 9 Mar 2017 20:34:27 +0000 (20:34 +0000)]
AMDGPU: Support for SimplifyDemandedVectorElts for load intrinsics

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

7 years ago[InstSimplify] add tests for vector constant folding div/rem-by-0; NFC
Sanjay Patel [Thu, 9 Mar 2017 20:31:20 +0000 (20:31 +0000)]
[InstSimplify] add tests for vector constant folding div/rem-by-0; NFC

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

7 years agoAMDGPU: Add GCCBuiltin for ds_permute ds_bpermute
Yaxun Liu [Thu, 9 Mar 2017 20:04:50 +0000 (20:04 +0000)]
AMDGPU: Add GCCBuiltin for ds_permute ds_bpermute

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

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

7 years ago[DAGCombiner] Do various combine on usubo.
Amaury Sechet [Thu, 9 Mar 2017 19:28:00 +0000 (19:28 +0000)]
[DAGCombiner] Do various combine on usubo.

Summary: This essentially does the same transform as for SUBC.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

7 years agoCMake: Don't install llvm-tblgen twice
Tom Stellard [Thu, 9 Mar 2017 19:24:07 +0000 (19:24 +0000)]
CMake: Don't install llvm-tblgen twice

Summary:
The add_tablegen macros defines its own install target, and it was also calling
add_llvm_utility which adds another install target.

Configuring with -DLLVM_TOOLS_INSTALL_DIR set to something other than
'bin' along with -DLLVM_INSTALL_UTILS=ON was causing llvm-tablgen
to be installed to two separate directories.

Reviewers: beanz, hans

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

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

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

7 years ago[Hexagon] Refactor the DAG preprocessing code, NFC
Krzysztof Parzyszek [Thu, 9 Mar 2017 19:14:23 +0000 (19:14 +0000)]
[Hexagon] Refactor the DAG preprocessing code, NFC

Extract individual transformations into their own functions.

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

7 years agoMinor format change. nfc.
Rong Xu [Thu, 9 Mar 2017 19:08:55 +0000 (19:08 +0000)]
Minor format change. nfc.

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

7 years ago[PGO] Refactor profile dumping function for ease of adding other profile kind
Rong Xu [Thu, 9 Mar 2017 19:03:57 +0000 (19:03 +0000)]
[PGO] Refactor profile dumping function for ease of adding other profile kind

Refactor the dumping function so that we can add other value profile kind easily.

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

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

7 years agoAdd front() method to SetVector.
Jan Sjodin [Thu, 9 Mar 2017 18:25:07 +0000 (18:25 +0000)]
Add front() method to SetVector.

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

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

7 years ago[FileCheck] Added --enable-var-scope option to enable scope for regex variables.
Artem Belevich [Thu, 9 Mar 2017 17:59:04 +0000 (17:59 +0000)]
[FileCheck] Added --enable-var-scope option to enable scope for regex variables.

If `--enable-var-scope` is in effect, variables with names that
start with `$` are considered to be global. All other variables are
local. All local variables get undefined at the beginning of each
CHECK-LABEL block. Global variables are not affected by CHECK-LABEL.
This makes it easier to ensure that individual tests are not affected
by variables set in preceding tests.

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

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

7 years ago[Hexagon] Add -mhvx option to the Hexagon backend
Krzysztof Parzyszek [Thu, 9 Mar 2017 17:05:11 +0000 (17:05 +0000)]
[Hexagon] Add -mhvx option to the Hexagon backend

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

7 years ago[Hexagon] Propagate zext of i1 into arithmetic code in selection DAG
Krzysztof Parzyszek [Thu, 9 Mar 2017 16:29:30 +0000 (16:29 +0000)]
[Hexagon] Propagate zext of i1 into arithmetic code in selection DAG

(op ... (zext i1 c) ...) -> (select c (op ... 1 ...),
                                      (op ... 0 ...))

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

7 years ago[InstSimplify] vector div/rem with any zero element in divisor is undef
Sanjay Patel [Thu, 9 Mar 2017 16:20:52 +0000 (16:20 +0000)]
[InstSimplify] vector div/rem with any zero element in divisor is undef

This was suggested as a DAG simplification in the review for rL297026 :
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170306/435253.html
...but let's start with IR since we have actual docs for IR (LangRef).

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

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

7 years ago[ARM] Remove t2xtpk feature from tests
Sam Parker [Thu, 9 Mar 2017 15:14:32 +0000 (15:14 +0000)]
[ARM] Remove t2xtpk feature from tests

I previously removed the T2XtPk feature from the ARM backend, but it
looks like I missed some of the tests that were using the feature.

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

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

7 years ago[DAG] recognize div/rem by 0 as undef before trying constant folding
Sanjay Patel [Thu, 9 Mar 2017 15:02:25 +0000 (15:02 +0000)]
[DAG] recognize div/rem by 0 as undef before trying constant folding

As discussed in the review thread for rL297026, this is actually 2 changes that
would independently fix all of the test cases in the patch:

1. Return undef in FoldConstantArithmetic for div/rem by 0.
2. Move basic undef simplifications for div/rem (simplifyDivRem()) before
   foldBinopIntoSelect() as a matter of efficiency.

I will handle the case of vectors with any zero element as a follow-up. That change
is the DAG sibling for D30665 + adding a check of vector elements to FoldConstantVectorArithmetic().

I'm deleting the test for PR30693 because it does not test for the actual bug any more
(dangers of using bugpoint).

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

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

7 years ago[X86][SSE] Speed up constant pool shuffle mask decoding with direct copy (PR32037).
Simon Pilgrim [Thu, 9 Mar 2017 14:06:39 +0000 (14:06 +0000)]
[X86][SSE] Speed up constant pool shuffle mask decoding with direct copy (PR32037).

If the constants are already the correct size, we can copy them directly into the shuffle mask.

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

7 years ago[mips] Revert fixes for PR32020.
Simon Dardis [Thu, 9 Mar 2017 14:03:26 +0000 (14:03 +0000)]
[mips] Revert fixes for PR32020.

The fix introduces segfaults and clobbers the value to be stored when
the atomic sequence loops.

Revert "[Target/MIPS] Kill dead code, no functional change intended."

This reverts commit r296153.

Revert "Recommit "[mips] Fix atomic compare and swap at O0.""

This reverts commit r296134.

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

7 years agoFixed typos in comments. NFCI.
Simon Pilgrim [Thu, 9 Mar 2017 13:57:04 +0000 (13:57 +0000)]
Fixed typos in comments. NFCI.

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

7 years agofix build on Cygwin
Nuno Lopes [Thu, 9 Mar 2017 13:43:31 +0000 (13:43 +0000)]
fix build on Cygwin

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

7 years ago[SelectionDAG] Make SelectCode return void
Joey Gouly [Thu, 9 Mar 2017 13:38:06 +0000 (13:38 +0000)]
[SelectionDAG] Make SelectCode return void

SelectCode has been returning nullptr since 182dac0 ("SDAG: Make
SelectCodeCommon return void", 2016-05-10). Make SelectCode also
return void instead, as all callers have been updated.

Patch by Sven van Haastregt.

Review: https://reviews.llvm.org/D30497

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

7 years ago[ARM] remove FIXMEs and add vcmp MC test
Sjoerd Meijer [Thu, 9 Mar 2017 13:28:37 +0000 (13:28 +0000)]
[ARM] remove FIXMEs and add vcmp MC test

Minor cleanup in ARMInstrVFP.td: removed some FIXMEs and added a MC test for
vcmp that was actually missing.

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

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

7 years ago[PM/Inliner] Make the new PM's inliner process call edges across an
Chandler Carruth [Thu, 9 Mar 2017 11:35:40 +0000 (11:35 +0000)]
[PM/Inliner] Make the new PM's inliner process call edges across an
entire SCC before iterating on newly-introduced call edges resulting
from any inlined function bodies.

This more closely matches the behavior of the old PM's inliner. While it
wasn't really clear to me initially, this behavior is actually essential
to the inliner behaving reasonably in its current design.

Because the inliner is fundamentally a bottom-up inliner and all of its
cost modeling is designed around that it often runs into trouble within
an SCC where we don't have any meaningful bottom-up ordering to use. In
addition to potentially cyclic, infinite inlining that we block with the
inline history mechanism, it can also take seemingly simple call graph
patterns within an SCC and turn them into *insanely* large functions by
accidentally working top-down across the SCC without any of the
threshold limitations that traditional top-down inliners use.

Consider this diabolical monster.cpp file that Richard Smith came up
with to help demonstrate this issue:
```
template <int N> extern const char *str;

void g(const char *);

template <bool K, int N> void f(bool *B, bool *E) {
  if (K)
    g(str<N>);
  if (B == E)
    return;
  if (*B)
    f<true, N + 1>(B + 1, E);
  else
    f<false, N + 1>(B + 1, E);
}
template <> void f<false, MAX>(bool *B, bool *E) { return f<false, 0>(B, E); }
template <> void f<true, MAX>(bool *B, bool *E) { return f<true, 0>(B, E); }

extern bool *arr, *end;
void test() { f<false, 0>(arr, end); }
```

When compiled with '-DMAX=N' for various values of N, this will create an SCC
with a reasonably large number of functions. Previously, the inliner would try
to exhaust the inlining candidates in a single function before moving on. This,
unfortunately, turns it into a top-down inliner within the SCC. Because our
thresholds were never built for that, we will incrementally decide that it is
always worth inlining and proceed to flatten the entire SCC into that one
function.

What's worse, we'll then proceed to the next function, and do the exact same
thing except we'll skip the first function, and so on. And at each step, we'll
also make some of the constant factors larger, which is awesome.

The fix in this patch is the obvious one which makes the new PM's inliner use
the same technique used by the old PM: consider all the call edges across the
entire SCC before beginning to process call edges introduced by inlining. The
result of this is essentially to distribute the inlining across the SCC so that
every function incrementally grows toward the inline thresholds rather than
allowing the inliner to grow one of the functions vastly beyond the threshold.
The code for this is a bit awkward, but it works out OK.

We could consider in the future doing something more powerful here such as
prioritized order (via lowest cost and/or profile info) and/or a code-growth
budget per SCC. However, both of those would require really substantial work
both to design the system in a way that wouldn't break really useful
abstraction decomposition properties of the current inliner and to be tuned
across a reasonably diverse set of code and workloads. It also seems really
risky in many ways. I have only found a single real-world file that triggers
the bad behavior here and it is generated code that has a pretty pathological
pattern. I'm not worried about the inliner not doing an *awesome* job here as
long as it does *ok*. On the other hand, the cases that will be tricky to get
right in a prioritized scheme with a budget will be more common and idiomatic
for at least some frontends (C++ and Rust at least). So while these approaches
are still really interesting, I'm not in a huge rush to go after them. Staying
even closer to the existing PM's behavior, especially when this easy to do,
seems like the right short to medium term approach.

I don't really have a test case that makes sense yet... I'll try to find a
variant of the IR produced by the monster template metaprogram that is both
small enough to be sane and large enough to clearly show when we get this wrong
in the future. But I'm not confident this exists. And the behavior change here
*should* be unobservable without snooping on debug logging. So there isn't
really much to test.

The test case updates come from two incidental changes:
1) We now visit functions in an SCC in the opposite order. I don't think there
   really is a "right" order here, so I just update the test cases.
2) We no longer compute some analyses when an SCC has no call instructions that
   we consider for inlining.

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