141766 Commits

Author SHA1 Message Date
Matt Arsenault
a55fccbc47 AMDGPU: Disallow exec as SMEM instruction operand
This is not in the list of valid inputs for the encoding.
When spilling, copies from exec can be folded directly
into the spill instruction which results in broken
stores.

This only fixes the operand constraints, more codegen
work is required to avoid emitting the invalid
spills.

This sort of breaks the dbg.value test. Because the
register class of the s_load_dwordx2 changes, there
is a copy to SReg_64, and the copy is the operand
of dbg_value. The copy is later dead, and removed
from the dbg_value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288191 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:39:53 +00:00
Matt Arsenault
c562d96ea6 AMDGPU: Use SGPR_64 for argument lowerings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:39:48 +00:00
Geoff Berry
81e1a9d383 [LiveRangeEdit] Handle instructions with no defs correctly.
Summary:
The code in LiveRangeEdit::eliminateDeadDef() that computes isOrigDef
doesn't handle instructions in which operand 0 is not a def (e.g. KILL)
correctly.  Add a check that operand 0 is a def before doing the rest of
the isOrigDef computation.

Reviewers: qcolombet, MatzeB, wmi

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:31:35 +00:00
Matt Arsenault
a89dd1d1c4 AMDGPU: Rename flat operands to match mubuf
Use vaddr/vdst for the same purposes.

This also fixes a beg in SIInsertWaits for the
operand check. The stored value operand is currently called
data0 in the single offset case, not data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:30:44 +00:00
Matt Arsenault
3f3671600c AMDGPU: Use else if
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288187 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:30:41 +00:00
Matt Arsenault
8d2aadbfac AMDGPU: Materialize frame index before add
It isn't generally safe to fold the frame index
directly into the operand since it will possibly
not be an inline immediate after it is expanded.

This surprisingly seems to produce better code, since
the FI doesn't prevent folding other immediate operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:20:48 +00:00
Matt Arsenault
a333ef5119 AMDGPU: Refactor immediate folding logic
Change the logic for when to fold immediates to
consider the destination operand rather than the
source of the materializing mov instruction.

No change yet, but this will allow for correctly handling
i16/f16 operands. Since 32-bit moves are used to materialize
constants for these, the same bitvalue will not be in the
register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:20:42 +00:00
Sanjay Patel
57d4f76dcd [AArch64] add tests for bics; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288183 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 19:15:27 +00:00
Sanjay Patel
9ade85fb43 [AArch64] add tests to show select transforms; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:35:04 +00:00
Adam Nemet
f618d6ef67 Revert "[GVN] Basic optimization remark support"
This reverts commit r288046.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:32:04 +00:00
Adam Nemet
5d693faf41 Revert "[GVN, OptDiag] Include the value that is forwarded in load elimination"
This reverts commit r288047.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:32:00 +00:00
Adam Nemet
996fdfddd0 Revert "[GVN, OptDiag] Print the interesting instructions involved in missed load-elimination"
This reverts commit r288090.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:31:53 +00:00
Geoff Berry
ba3cf58b60 [AArch64] Fold spills of COPY of WZR/XZR
Summary:
In AArch64InstrInfo::foldMemoryOperandImpl, catch more cases where the
COPY being spilled is copying from WZR/XZR, but the source register is
not in the COPY destination register's regclass.

For example, when spilling:

  %vreg0 = COPY %XZR ; %vreg0:GPR64common

without this change, the code in TargetInstrInfo::foldMemoryOperand()
and canFoldCopy() that normally handles cases like this would fail to
optimize since %XZR is not in GPR64common.  So the spill code generated
would be:

  %vreg0 = COPY %XZR
  STR %vreg

instead of the new code generated:

  STR %XZR

Reviewers: qcolombet, MatzeB

Subscribers: mcrosier, aemerson, t.p.northover, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288176 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:28:32 +00:00
Mehdi Amini
c72d18a2cb [docs] Typos and whitespace fixed in LTO docs.
While reading the LTO docs I fixed few small typos and whitespace issues.

Patch by: Jonas Devlieghere <jonas@devlieghere.com>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288171 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 18:00:31 +00:00
Simon Pilgrim
e148f0a7b8 Avoid repeated calls to MVT getSizeInBits and getScalarSizeInBits(). NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288170 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 17:57:48 +00:00
NAKAMURA Takumi
e6dbf90240 Suppress abi-breaking.h on cygming, for now.
FIXME: Implement checks without weak for them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288168 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 17:32:58 +00:00
NAKAMURA Takumi
f33188e05e Fix a linefeed at eof.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288167 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 17:32:43 +00:00
Artur Pilipenko
9d387d6693 [CVP] Remove use of removed flag (-cvp-dont-process-adds) from the test
The flag was removed by 288154

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 16:43:30 +00:00
Artur Pilipenko
a310ebcb97 [CVP] Remove cvp-dont-process-adds flag
The flag was introduced because the optimization controlled by the flag initially caused regressions. All the regressions were fixed some time ago and the flag has been false for quite a while. 

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288154 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 16:24:57 +00:00
Nemanja Ivanovic
1ec5b2fb75 [PowerPC] Improvements for BUILD_VECTOR Vol. 1
This patch corresponds to review:
https://reviews.llvm.org/D25912

This is the first patch in a series of 4 that improve the lowering and combining
for BUILD_VECTOR nodes on PowerPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288152 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 16:11:34 +00:00
Alexey Bataev
e58c265916 [SLP] Add a new test for tree vectorization starting from insertelement
instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288148 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 15:37:52 +00:00
Simon Pilgrim
341c07ba83 [X86] Moved getTargetConstantFromNode function so a future patch is more understandable. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288147 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 15:32:58 +00:00
Aditya Kumar
b67e91ee50 [GVNHoist] Rename variables.
Differential Revision: https://reviews.llvm.org/D27110

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288142 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 14:36:27 +00:00
Aditya Kumar
06f75183e3 [GVNHoist] Enable aggressive hoisting when optimizing for code-size
Enable scalar hoisting at -Oz as it is safe to hoist scalars to a place
where they are partially needed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288141 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 14:34:01 +00:00
Simon Pilgrim
bdcd71da4d [X86][SSE] Add initial support for combining target shuffles to (V)PMOVZX.
We can only handle 128-bit vectors until we support target shuffle inputs of different size to the output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288140 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 14:18:51 +00:00
Simon Pilgrim
c02671cd35 Avoid repeated calls to MVT::getScalarSizeInBits(). NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288138 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 13:43:08 +00:00
Simon Pilgrim
f4ee49f32f [X86][SSE] Added tests showing missed combines to (V)PMOVZX
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 13:16:11 +00:00
Chandler Carruth
e1b9ddfe20 [PM] Fix a bad invalid densemap iterator bug in the new invalidation
logic.

Yup, the invalidation logic has an invalid iterator bug. Can't make this
stuff up.

We can recursively insert things into the map so we can't cache the
iterator into that map across those recursive calls. We did this
differently in two places. I have an end-to-end test that triggers at
least one of them. I'm going to work on a nice minimal test case that
triggers these, but I didn't want to leave the bug in the tree while
I tried to trigger it.

Also, the dense map iterator checking stuff we have now is awesome. =D

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 12:54:34 +00:00
Malcolm Parsons
15bd6737cf [StringRef] Use default member initializers and = default.
Summary: This makes the default constructor implicitly constexpr and noexcept.

Reviewers: zturner, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 10:53:18 +00:00
Alexey Bataev
62c10d6781 [SLPVectorizer] Improved support of partial tree vectorization.
Currently SLP vectorizer tries to vectorize a binary operation and dies
immediately after unsuccessful the first unsuccessfull attempt. Patch
tries to improve the situation, trying to vectorize all binary
operations of all children nodes in the binop tree.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 08:21:14 +00:00
Warren Ristow
14cd31679b Test commit. Comment changes. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288100 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 02:37:13 +00:00
Peter Collingbourne
a0894a8257 Bitcode: Change expected layout of module blocks.
We now expect each module's identification block to appear immediately before
the module block. Any module block that appears without an identification block
immediately before it is interpreted as if it does not have a module block.

Also change the interpretation of VST and function offsets in bitcode.
The offset is always taken as relative to the start of the identification
(or module if not present) block, minus one word. This corresponds to the
historical interpretation of offsets, i.e. relative to the start of the file.

These changes allow for bitcode modules to be concatenated by copying bytes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288098 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 02:27:04 +00:00
Reid Kleckner
c2ee6e2169 [asan/win] Align global registration metadata to its size
This way, when the linker adds padding between globals, we can skip over
the zero padding bytes and reliably find the start of the next metadata
global.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 01:32:21 +00:00
Tom Stellard
d39b310dd5 AMDGPU/SI: Avoid moving PHIs to VALU when phi values are defined in scalar branches
Reviewers: arsenm

Subscribers: arsenm, llvm-commits, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 00:46:46 +00:00
Reid Kleckner
bde207a0f2 Recognize ${:uid} escapes in intel syntax inline asm
It looks like this logic was duplicated long ago and the GCC side of
things has grown additional functionality. We need ${:uid} at least to
generate unique MS inline asm labels (PR23715), so expose these.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 00:29:27 +00:00
Adam Nemet
825a8f8ef4 [GVN, OptDiag] Print the interesting instructions involved in missed load-elimination
This includes the intervening store and the load/store that we're trying
to forward from in the optimization remark for the missed load
elimination.

This is hooked up under a new mode in ORE that allows for compile-time
budget for a bit more analysis to print more insightful messages.  This
mode is currently enabled for -fsave-optimization-record (-Rpass is
trickier since it is controlled in the front-end).

With this we can now print the red remark in http://lab.llvm.org:8080/artifacts/opt-view_test-suite/build/SingleSource/Benchmarks/Dhrystone/CMakeFiles/dry.dir/html/_org_test-suite_SingleSource_Benchmarks_Dhrystone_dry.c.html#L446

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 00:09:22 +00:00
Sanjay Patel
92c01d8697 [DAG] clean up foldSelectCCToShiftAnd(); NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 23:05:55 +00:00
Mehdi Amini
c3402f3fd5 Put ABI breaking test in Error checking behind LLVM_ENABLE_ABI_BREAKING_CHECKS
This macro is supposed to be the one controlling the compatibility
of ABI breaks induced when enabling or disabling assertions in LLVM.

The macro is enabled by default in assertions build, so this commit
won't disable the tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 22:57:11 +00:00
Kevin Enderby
2431dc2720 Add error checking for Mach-O universal files.
Add the checking for both the MachO::fat_header and the
MachO::fat_arch struct values in the constructor for
MachOUniversalBinary. Such that when the constructor
for ObjectForArch is called it can assume the values in
the MachO::fat_arch for the offset and size are contained
in the file after the MachOUniversalBinary constructor
is called for the Parent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 22:40:50 +00:00
Mehdi Amini
7b6b980178 Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch
The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header
abi-breaking.h, from llvm-config.h. Only headers that are using the
macro are including this new header.

LLVM will define a symbol, either EnableABIBreakingChecks or
DisableABIBreakingChecks depending on the configuration setting for
LLVM_ABI_BREAKING_CHECKS.

The abi-breaking.h header will add weak references to these symbols in
every clients that includes this header. This should ensure that
a mismatch triggers a link failure (or a load time failure for DSO).

On MSVC, the pragma "detect_mismatch" is used instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288082 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 22:23:53 +00:00
Chandler Carruth
78a68061a3 [PM] Extend the explicit 'invalidate' method API on analysis results to
accept an Invalidator that allows them to invalidate themselves if their
dependencies are in turn invalidated.

Rather than recording the dependency graph ahead of time when analysis
get results from other analyses, this simply lets each result trigger
the immediate invalidation of any analyses they actually depend on. They
do this in a way that has three nice properties:

1) They don't have to handle transitive dependencies because the
   infrastructure will recurse for them.
2) The invalidate methods are still called only once. We just
   dynamically discover the necessary topological ordering, everything
   is memoized nicely.
3) The infrastructure still provides a default implementation and can
   access it so that only analyses which have dependencies need to do
   anything custom.

To make this work at all, the invalidation logic also has to defer the
deletion of the result objects themselves so that they can remain alive
until we have collected the complete set of results to invalidate.

A unittest is added here that has exactly the dependency pattern we are
concerned with. It hit the use-after-free described by Sean in much
detail in the long thread about analysis invalidation before this
change, and even in an intermediate form of this change where we failed
to defer the deletion of the result objects.

There is an important problem with doing dependency invalidation that
*isn't* solved here: we don't *enforce* that results correctly
invalidate all the analyses whose results they depend on.

I actually looked at what it would take to do that, and it isn't as hard
as I had thought but the complexity it introduces seems very likely to
outweigh the benefit. The technique would be to provide a base class for
an analysis result that would be populated with other results, and
automatically provide the invalidate method which immediately does the
correct thing. This approach has some nice pros IMO:
- Handles the case we care about and nothing else: only *results*
  that depend on other analyses trigger extra invalidation.
- Localized to the result rather than centralized in the analysis
  manager.
- Ties the storage of the reference to another result to the triggering
  of the invalidation of that analysis.
- Still supports extending invalidation in customized ways.

But the down sides here are:
- Very heavy-weight meta-programming is needed to provide this base
  class.
- Requires a pretty awful API for accessing the dependencies.

Ultimately, I fear it will not pull its weight. But we can re-evaluate
this at any point if we start discovering consistent problems where the
invalidation and dependencies get out of sync. It will fit as a clean
layer on top of the facilities in this patch that we can add if and when
we need it.

Note that I'm not really thrilled with the names for these APIs... The
name "Invalidator" seems ok but not great. The method name "invalidate"
also. In review some improvements were suggested, but they really need
*other* uses of these terms to be updated as well so I'm going to do
that in a follow-up commit.

I'm working on the actual fixes to various analyses that need to use
these, but I want to try to get tests for each of them so we don't
regress. And those changes are seperable and obvious so once this goes
in I should be able to roll them out throughout LLVM.

Many thanks to Sean, Justin, and others for help reviewing here.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 22:04:31 +00:00
Peter Collingbourne
f75edf088f cmake: Set rpath for loadable modules as well as shared libraries.
This fixes a regression introduced by r285714: we weren't setting the
rpath on LLVMgold.so correctly.

Spotted by mark@chromium.org!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 21:59:14 +00:00
Eli Friedman
56089e7485 [SROA] Drop lifetime.start/end intrinsics when they block promotion.
Preserving lifetime markers isn't as important as allowing promotion,
so just drop the lifetime markers if necessary.

This also fixes an assertion failure where other parts of SROA assumed
that lifetime markers never block promotion.

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

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288074 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 21:50:34 +00:00
Sanjay Patel
2365a7c201 [DAG] add helper function for selectcc --> and+shift transforms; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 21:47:41 +00:00
Mehdi Amini
b54cba4a12 Improve error handling in YAML parsing
Some scanner errors were not checked and reported by the parser.

Fix PR30934. Recommit r288014 after fixing unittest.

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288071 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 21:38:52 +00:00
David Blaikie
d86b9f23fa [DebugInfo] Add support for DW_AT_main_subprogram on subprograms
Patch by Tom Tromey! (for use with Rust)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 21:32:19 +00:00
Matthias Braun
05bdd2ebfe MachineScheduler: Export function to construct "default" scheduler.
This makes the createGenericSchedLive() function that constructs the
default scheduler available for the public API. This should help when
you want to get a scheduler and the default list of DAG mutations.

This also shrinks the list of default DAG mutations:
{Load|Store}ClusterDAGMutation and MacroFusionDAGMutation are no longer
added by default. Targets can easily add them if they need them. It also
makes it easier for targets to add alternative/custom macrofusion or
clustering mutations while staying with the default
createGenericSchedLive(). It also saves the callback back and forth in
TargetInstrInfo::enableClusterLoads()/enableClusterStores().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 20:11:54 +00:00
Artem Belevich
6f1fc60b9e Revert r287637 "[wasm] hack around test failure after r287553."
-cgp-freq-ratio-to-skip-merge option was removed by rollback in r288052.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288055 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 19:55:46 +00:00
Stanislav Mekhanoshin
ab827bdc35 [AMDGPU] Allow hoisting of comparisons out of a loop and eliminate condition copies
Codegen prepare sinks comparisons close to a user is we have only one register
for conditions. For AMDGPU we have many SGPRs capable to hold vector conditions.
Changed BE to report we have many condition registers. That way IR LICM pass
would hoist an invariant comparison out of a loop and codegen prepare will not
sink it.

With that done a condition is calculated in one block and used in another.
Current behavior is to store workitem's condition in a VGPR using v_cndmask_b32
and then restore it with yet another v_cmp instruction from that v_cndmask's
result. To mitigate the issue a propagation of source SGPR pair in place of v_cmp
is implemented. Additional side effect of this is that we may consume less VGPRs
at a cost of more SGPRs in case if holding of multiple conditions is needed, and
that is a clear win in most cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 18:58:49 +00:00
Joerg Sonnenberger
46cc79217b Revert r287553: [CodeGenPrep] Skip merging empty case blocks
It results in assertions in lib/Analysis/BlockFrequencyInfoImpl.cpp line
670 ("Expected irreducible CFG").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-28 18:56:54 +00:00