]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/log
opencl/llvm.git
9 years agoRevert "Reapply: Teach SROA how to update debug info for fragmented variables."
Adrian Prantl [Thu, 8 Jan 2015 02:02:00 +0000 (02:02 +0000)]
Revert "Reapply: Teach SROA how to update debug info for fragmented variables."

This reverts commit r225379 while investigating an assertion failure reported
by Alexey.

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

9 years ago[RegAllocGreedy] Introduce a late pass to repair broken hints.
Quentin Colombet [Thu, 8 Jan 2015 01:16:39 +0000 (01:16 +0000)]
[RegAllocGreedy] Introduce a late pass to repair broken hints.

A broken hint is a copy where both ends are assigned different colors. When a
variable gets evicted in the neighborhood of such copies, it is likely we can
reconcile some of them.

** Context **

Copies are inserted during the register allocation via splitting. These split
points are required to relax the constraints on the allocation problem. When
such a point is inserted, both ends of the copy would not share the same color
with respect to the current allocation problem. When variables get evicted,
the allocation problem becomes different and some split point may not be
required anymore. However, the related variables may already have been colored.

This usually shows up in the assembly with pattern like this:
def A
...
save A to B
def A
use A
restore A from B
...
use B

Whereas we could simply have done:
def B
...
def A
use A
...
use B

** Proposed Solution **

A variable having a broken hint is marked for late recoloring if and only if
selecting a register for it evict another variable. Indeed, if no eviction
happens this is pointless to look for recoloring opportunities as it means the
situation was the same as the initial allocation problem where we had to break
the hint.

Finally, when everything has been allocated, we look for recoloring
opportunities for all the identified candidates.
The recoloring is performed very late to rely on accurate copy cost (all
involved variables are allocated).
The recoloring is simple unlike the last change recoloring. It propagates the
color of the broken hint to all its copy-related variables. If the color is
available for them, the recoloring uses it, otherwise it gives up on that hint
even if a more complex coloring would have worked.

The recoloring happens only if it is profitable. The profitability is evaluated
using the expected frequency of the copies of the currently recolored variable
with a) its current color and b) with the target color. If a) is greater or
equal than b), then it is profitable and the recoloring happen.

** Example **

Consider the following example:
BB1:
  a =
  b =
BB2:
  ...
   = b
   = a
Let us assume b gets split:
BB1:
  a =
  b =
BB2:
  c = b
  ...
  d = c
  = d
  = a
Because of how the allocation work, b, c, and d may be assigned different
colors. Now, if a gets evicted to make room for c, assuming b and d were
assigned to something different than a.
We end up with:
BB1:
  a =
  st a, SpillSlot
  b =
BB2:
  c = b
  ...
  d = c
  = d
  e = ld SpillSlot
  = e
This is likely that we can assign the same register for b, c, and d,
getting rid of 2 copies.

** Performances **

Both ARM64 and x86_64 show performance improvements of up to 3% for the
llvm-testsuite + externals with Os and O3. There are a few regressions too that
comes from the (in)accuracy of the block frequency estimate.

<rdar://problem/18312047>

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

9 years ago[SelectionDAG] Allow targets to specify legality of extloads' result
Ahmed Bougacha [Thu, 8 Jan 2015 00:51:32 +0000 (00:51 +0000)]
[SelectionDAG] Allow targets to specify legality of extloads' result
type (in addition to the memory type).

The *LoadExt* legalization handling used to only have one type, the
memory type.  This forced users to assume that as long as the extload
for the memory type was declared legal, and the result type was legal,
the whole extload was legal.

However, this isn't always the case.  For instance, on X86, with AVX,
this is legal:
    v4i32 load, zext from v4i8
but this isn't:
    v4i64 load, zext from v4i8
Whereas v4i64 is (arguably) legal, even without AVX2.

Note that the same thing was done a while ago for truncstores (r46140),
but I assume no one needed it yet for extloads, so here we go.

Calls to getLoadExtAction were changed to add the value type, found
manually in the surrounding code.

Calls to setLoadExtAction were mechanically changed, by wrapping the
call in a loop, to match previous behavior.  The loop iterates over
the MVT subrange corresponding to the memory type (FP vectors, etc...).
I also pulled neighboring setTruncStoreActions into some of the loops;
those shouldn't make a difference, as the additional types are illegal.
(e.g., i128->i1 truncstores on PPC.)

No functional change intended.

Differential Revision: http://reviews.llvm.org/D6532

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

9 years agoRemove empty statement. No functionality change.
Nick Lewycky [Thu, 8 Jan 2015 00:47:03 +0000 (00:47 +0000)]
Remove empty statement. No functionality change.

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

9 years agoX86: VZeroUpperInserter: shortcut should not trigger if we have any function live...
Matthias Braun [Thu, 8 Jan 2015 00:33:48 +0000 (00:33 +0000)]
X86: VZeroUpperInserter: shortcut should not trigger if we have any function live-ins.

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

9 years agoRun clang-format on tools/llvm-objdump/MachODump.cpp again as some of my
Kevin Enderby [Thu, 8 Jan 2015 00:25:24 +0000 (00:25 +0000)]
Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my
previous changes got in with incorrect formatting. No functional change.

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

9 years agoRegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges.
Matthias Braun [Thu, 8 Jan 2015 00:21:23 +0000 (00:21 +0000)]
RegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges.

The register coalescer used to remove implicit_defs when they are
covered by the main range anyway. With subreg liveness tracking we can't
do that anymore in places where the IMPLICIT_DEF is required as begin of
a subregister liverange.

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

9 years agoRegisterCoalescer: Fix valuesIdentical() in some subrange merge cases.
Matthias Braun [Wed, 7 Jan 2015 23:58:38 +0000 (23:58 +0000)]
RegisterCoalescer: Fix valuesIdentical() in some subrange merge cases.

I got confused and assumed SrcIdx/DstIdx of the CoalescerPair is a
subregister index in SrcReg/DstReg, but they are actually subregister
indices of the coalesced register that get you back to SrcReg/DstReg
when applied.

Fixed the bug, improved comments and simplified code accordingly.

Testcase by Tom Stellard!

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

9 years agoLiveInterval: Implement feedback by Quentin Colombet.
Matthias Braun [Wed, 7 Jan 2015 23:35:11 +0000 (23:35 +0000)]
LiveInterval: Implement feedback by Quentin Colombet.

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

9 years ago[GC] improve testing around gc.relocate and fix a test
Philip Reames [Wed, 7 Jan 2015 22:48:01 +0000 (22:48 +0000)]
[GC] improve testing around gc.relocate and fix a test

Patch by: Ramkumar Ramachandra <artagnon@gmail.com>

"This patch started out as an exploration of gc.relocate, and an attempt
to write a simple test in call-lowering. I then noticed that the
arguments of gc.relocate were not checked fully, so I went in and fixed
a few things. Finally, the most important outcome of this patch is that
my new error handling code caught a bug in a callsite in
stackmap-format."

Differential Revision: http://reviews.llvm.org/D6824

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

9 years ago[CodeGen] Add MVT::isValid to replace manual validity checks. NFC.
Ahmed Bougacha [Wed, 7 Jan 2015 22:47:46 +0000 (22:47 +0000)]
[CodeGen] Add MVT::isValid to replace manual validity checks. NFC.

Now that we have MVT::FIRST_VALUETYPE (r225362), we can provide a method
checking that the MVT is valid, that is, it's in
  [FIRST_VALUETYPE, LAST_VALUETYPE[.
This commit also uses it in a few asserts, that would previously accept
invalid MVTs, such as the default constructed -1.  In that case,
the code following those asserts would do an out-of-bounds array access.
Using MVT::isValid, those assertions fail as expected when passed
invalid MVTs.
It feels clunky to have such a validity checking function, but it's
at least better than the alternative of broken manual checks.

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

9 years agoR600/SI: Commute instructions to enable more folding opportunities
Tom Stellard [Wed, 7 Jan 2015 22:44:19 +0000 (22:44 +0000)]
R600/SI: Commute instructions to enable more folding opportunities

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

9 years agoIR: Add MDNode::getDistinct()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 22:24:46 +0000 (22:24 +0000)]
IR: Add MDNode::getDistinct()

Allow distinct `MDNode`s to be explicitly created.  There's no way (yet)
of representing their distinctness in assembly/bitcode, however, so this
still isn't first-class.

Part of PR22111.

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

9 years agoR600/SI: Only fold immediates that have one use
Tom Stellard [Wed, 7 Jan 2015 22:18:27 +0000 (22:18 +0000)]
R600/SI: Only fold immediates that have one use

Folding the same immediate into multiple instruction will increase
program size, which can hurt performance.

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

9 years agoTest commit.
Sean Silva [Wed, 7 Jan 2015 22:07:33 +0000 (22:07 +0000)]
Test commit.

Hopefully this one won't kill the git mirror...

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

9 years agoIR: Add MDNode::isDistinct()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 21:35:38 +0000 (21:35 +0000)]
IR: Add MDNode::isDistinct()

Add API to indicate whether an `MDNode` is distinct.  A distinct node is
not stored in the MDNode uniquing tables, and will never be returned by
`MDNode::get()`.

Although distinct nodes are only currently created by uniquing
collisions (when operands change), PR22111 will allow these nodes to be
explicitly created.

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

9 years ago[LangRef] PR22118: Hyphen is allowed in IR identifiers.
Sean Silva [Wed, 7 Jan 2015 21:35:14 +0000 (21:35 +0000)]
[LangRef] PR22118: Hyphen is allowed in IR identifiers.

E.g. %-foo and %fo-o.

Thanks to eagle-eyed reporter Tomas Brukner.

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

9 years agoUpdate a comment.
Adrian Prantl [Wed, 7 Jan 2015 21:35:13 +0000 (21:35 +0000)]
Update a comment.

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

9 years agoLinker: Don't use MDNode::replaceOperandWith()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 21:32:27 +0000 (21:32 +0000)]
Linker: Don't use MDNode::replaceOperandWith()

`MDNode::replaceOperandWith()` changes all instances of metadata.  Stop
using it when linking module flags, since (due to uniquing) the flag
values could be used by other metadata.

Instead, use new API `NamedMDNode::setOperand()` to update the reference
directly.

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

9 years agoXFAIL several MCJIT EH tests under ASan and MSan bootstrap.
Alexey Samsonov [Wed, 7 Jan 2015 21:27:26 +0000 (21:27 +0000)]
XFAIL several MCJIT EH tests under ASan and MSan bootstrap.

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

9 years ago[CodeGen] Use MVT iterator_ranges in legality loops. NFC intended.
Ahmed Bougacha [Wed, 7 Jan 2015 21:27:10 +0000 (21:27 +0000)]
[CodeGen] Use MVT iterator_ranges in legality loops. NFC intended.

A few loops do trickier things than just iterating on an MVT subset,
so I'll leave them be for now.
Follow-up of r225387.

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

9 years ago[CodeGen] Add iterator_range for the MVT::SimpleValueType enum.
Ahmed Bougacha [Wed, 7 Jan 2015 21:15:38 +0000 (21:15 +0000)]
[CodeGen] Add iterator_range for the MVT::SimpleValueType enum.

This commit adds a simple iterator over that enum, and a few
functions to create iterator ranges over the most common types.

Differential Revision: http://reviews.llvm.org/D6537

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

9 years agoFix uninitialized memory read in llvm-dsymutil for the second time.
Alexey Samsonov [Wed, 7 Jan 2015 21:13:30 +0000 (21:13 +0000)]
Fix uninitialized memory read in llvm-dsymutil for the second time.

This was already fixed by r224481, but apparently was accidentally
reverted in r225207.

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

9 years agoAdd a test that would have found the issue in r224935.
Rafael Espindola [Wed, 7 Jan 2015 21:10:25 +0000 (21:10 +0000)]
Add a test that would have found the issue in r224935.

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

9 years ago[git] Mark the llgo directory in the LLVM gitignore.
Chandler Carruth [Wed, 7 Jan 2015 21:08:54 +0000 (21:08 +0000)]
[git] Mark the llgo directory in the LLVM gitignore.

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

9 years agoSlightly refactor things for llvm-objdump and the -macho option so it can be used...
Kevin Enderby [Wed, 7 Jan 2015 21:02:18 +0000 (21:02 +0000)]
Slightly refactor things for llvm-objdump and the -macho option so it can be used with
options other than just -disassemble so that universal files can be used with other
options combined with -arch options.

No functional change to existing options and use.  One test case added for the
additional functionality with a universal file an a -arch option.

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

9 years agoR600/SI: Remove VReg_32 register class
Tom Stellard [Wed, 7 Jan 2015 20:59:25 +0000 (20:59 +0000)]
R600/SI: Remove VReg_32 register class

Use VGPR_32 register class instead.  These two register classes were
identical and having separate classes was causing
SIInstrInfo::isLegalOperands() to be overly conservative in some cases.

This change is necessary to prevent future paches from missing a folding
opportunity in fneg-fabs.ll.

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

9 years agoMore FMA folding opportunities.
Olivier Sallenave [Wed, 7 Jan 2015 20:54:17 +0000 (20:54 +0000)]
More FMA folding opportunities.

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

9 years agoReapply: Teach SROA how to update debug info for fragmented variables.
Adrian Prantl [Wed, 7 Jan 2015 20:52:22 +0000 (20:52 +0000)]
Reapply: Teach SROA how to update debug info for fragmented variables.

The two buildbot failures were addressed in LLVM r225378 and CFE r225359.

This rapplies commit 225272 without modifications.

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

9 years agoDebug info: Allow aggregate types to be described by constants.
Adrian Prantl [Wed, 7 Jan 2015 20:48:58 +0000 (20:48 +0000)]
Debug info: Allow aggregate types to be described by constants.

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

9 years ago[Hexagon] Fix 225372 USR register is not fully complete. Removing Uses = [USR] maint...
Colin LeMahieu [Wed, 7 Jan 2015 20:43:38 +0000 (20:43 +0000)]
[Hexagon] Fix 225372 USR register is not fully complete.  Removing Uses = [USR] maintains existing functionality to old instructions without encodings.

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

9 years ago[Hexagon] Adding floating point classification and creation.
Colin LeMahieu [Wed, 7 Jan 2015 20:28:57 +0000 (20:28 +0000)]
[Hexagon] Adding floating point classification and creation.

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

9 years agoR600/SI: Add a V_MOV_B64 pseudo instruction
Tom Stellard [Wed, 7 Jan 2015 20:27:25 +0000 (20:27 +0000)]
R600/SI: Add a V_MOV_B64 pseudo instruction

This is used to simplify the SIFoldOperands pass and make it easier to
fold immediates.

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

9 years ago[Hexagon] Adding encodings for v5 floating point instructions.
Colin LeMahieu [Wed, 7 Jan 2015 20:24:09 +0000 (20:24 +0000)]
[Hexagon] Adding encodings for v5 floating point instructions.

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

9 years ago[Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.
Colin LeMahieu [Wed, 7 Jan 2015 20:07:28 +0000 (20:07 +0000)]
[Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.

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

9 years agoR600/SI: Teach SIFoldOperands to split 64-bit constants when folding
Tom Stellard [Wed, 7 Jan 2015 19:56:17 +0000 (19:56 +0000)]
R600/SI: Teach SIFoldOperands to split 64-bit constants when folding

This allows folding of sequences like:

s[0:1] = s_mov_b64 4
v_add_i32 v0, s0, v0
v_addc_u32 v1, s1, v1

into

v_add_i32 v0, 4, v0
v_add_i32 v1, 0, v1

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

9 years agoTest commit
Olivier Sallenave [Wed, 7 Jan 2015 19:45:17 +0000 (19:45 +0000)]
Test commit

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

9 years ago[X86] Fix 512->256 typo in comments. NFC.
Ahmed Bougacha [Wed, 7 Jan 2015 19:38:50 +0000 (19:38 +0000)]
[X86] Fix 512->256 typo in comments. NFC.

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

9 years agoAdd a missing file from 225365
Philip Reames [Wed, 7 Jan 2015 19:13:28 +0000 (19:13 +0000)]
Add a missing file from 225365

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

9 years agoIntroduce an example statepoint GC strategy
Philip Reames [Wed, 7 Jan 2015 19:07:50 +0000 (19:07 +0000)]
Introduce an example statepoint GC strategy

This change includes the most basic possible GCStrategy for a GC which is using the statepoint lowering code. At the moment, this GCStrategy doesn't really do much - aside from actually generate correct stackmaps that is - but I went ahead and added a few extra correctness checks as proof of concept. It's mostly here to provide documentation on how to do one, and to provide a point for various optimization legality hooks I'd like to add going forward. (For context, see the TODOs in InstCombine around gc.relocate.)

Most of the validation logic added here as proof of concept will soon move in to the Verifier.  That move is dependent on http://reviews.llvm.org/D6811

There was discussion in the review thread about addrspace(1) being reserved for something.  I'm going to follow up on a seperate llvmdev thread.  If needed, I'll update all the code at once.

Note that I am deliberately not making a GCStrategy required to use gc.statepoints with this change. I want to give folks out of tree - including myself - a chance to migrate. In a week or two, I'll make having a GCStrategy be required for gc.statepoints. To this end, I added the gc tag to one of the test cases but not others.

Differential Revision: http://reviews.llvm.org/D6808

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

9 years ago[CodeGen] Add MVT::FIRST_VALUETYPE to avoid explicit 0. NFC.
Ahmed Bougacha [Wed, 7 Jan 2015 18:39:00 +0000 (18:39 +0000)]
[CodeGen] Add MVT::FIRST_VALUETYPE to avoid explicit 0. NFC.

Many places reference MVT::LAST_VALUETYPE when iterating over all
valid MVTs, but they usually start with 0.
With FIRST_VALUETYPE, we can avoid explicit constants when we really
should be using MVT::SimpleValueType.

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

9 years agoX86: Allow the stack probe size to be configurable per function
David Majnemer [Wed, 7 Jan 2015 18:14:07 +0000 (18:14 +0000)]
X86: Allow the stack probe size to be configurable per function

LLVM emits stack probes on Windows targets to ensure that the stack is
correctly accessed.  However, the amount of stack allocated before
emitting such a probe is hardcoded to 4096.

It is desirable to have this be configurable so that a function might
opt-out of stack probes.  Our level of granularity is at the function
level instead of, say, the module level to permit proper generation of
code after LTO.

Patch by Andrew H!

N.B.  The inliner needs to be updated to properly consider what happens
after inlining a function with a specific stack-probe-size into another
function with a different stack-probe-size.

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

9 years agoR600/SI: Refactor SIFoldOperands to simplify immediate folding
Tom Stellard [Wed, 7 Jan 2015 17:42:16 +0000 (17:42 +0000)]
R600/SI: Refactor SIFoldOperands to simplify immediate folding

This will make a future patch much less intrusive.

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

9 years ago[X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.
Ahmed Bougacha [Wed, 7 Jan 2015 17:33:03 +0000 (17:33 +0000)]
[X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.

For code like:
    float foo(float x) { return copysign(1.0, x); }
We used to generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    movss  <1.000000e+00>, %xmm1
    andps  <nan>, %xmm1
    orps   %xmm0, %xmm1
Basically doing an abs(1.0f) in the two middle instructions.

We now generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    orps   <1.000000e+00,0,0,0>, %xmm0

Builds on cleanups r223415, r223542.
rdar://19049548
Differential Revision: http://reviews.llvm.org/D6555

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

9 years agoImprovements to emacs packages for llvm and tablegen mode.
Rafael Espindola [Wed, 7 Jan 2015 15:52:51 +0000 (15:52 +0000)]
Improvements to emacs packages for llvm and tablegen mode.

* Both files have valid package headers and footers (you can verify
with M-x checkdoc).
* Fixed style warnings generated by checkdoc.
* Fixed a byte-compiler warning in llvm-mode.el.
* Ensure that the modes are autoloaded, so users do not need to
(require 'llvm-mode) to use them.

Patch by Wilfred Hughes.

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

9 years agoReverting r225319; since there is a folder named Examples, attempting to add a target...
Aaron Ballman [Wed, 7 Jan 2015 14:47:12 +0000 (14:47 +0000)]
Reverting r225319; since there is a folder named Examples, attempting to add a target of the same name causes problems for IDEs like Visual Studio.

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

9 years agoManually specify the folder that Kaleidescope should reside in for CMake-produced...
Aaron Ballman [Wed, 7 Jan 2015 14:26:07 +0000 (14:26 +0000)]
Manually specify the folder that Kaleidescope should reside in for CMake-produced solutions that care about such things (like MSVC). This takes the Kaleidescope target out of the root solution folder and places it into the Examples folder where it belongs.

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

9 years agoManually specify the folder that llvm-ranlib should reside in for CMake-produced...
Aaron Ballman [Wed, 7 Jan 2015 14:19:15 +0000 (14:19 +0000)]
Manually specify the folder that llvm-ranlib should reside in for CMake-produced solutions that care about such things (like MSVC). This takes llvm-ranlib out of the root solution folder and places it into the Tools folder where it belongs.

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

9 years agoNew method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp.
Jonas Paulsson [Wed, 7 Jan 2015 13:38:29 +0000 (13:38 +0000)]
New method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp.

Used to iterate over previously added memory dependencies in
adjustChainDeps() and iterateChainSucc().

SDep::isCtrl() was previously used in these places, that also gave
anti and output edges. The code may be worse if these are followed,
because MisNeedChainEdge() will conservatively return true since a
non-memory instruction has no memory operands, and a false chain dep
will be added. It is also unnecessary since all memory accesses of
interest will be reached by memory dependencies, and there is a budget
limit for the number of edges traversed.

This problem was found on an out-of-tree target with enabled alias
analysis. No test case for an in-tree target has been found.

Reviewed by Hal Finkel.

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

9 years agoFix typos in comment and option help texts.
Jonas Paulsson [Wed, 7 Jan 2015 13:20:57 +0000 (13:20 +0000)]
Fix typos in comment and option help texts.

For -enable-aa-sched-mi and -use-tbaa-in-sched-mi.

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

9 years ago[ARM] Add missing Tag_DIV_use tests.
Charlie Turner [Wed, 7 Jan 2015 11:37:40 +0000 (11:37 +0000)]
[ARM] Add missing Tag_DIV_use tests.

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

9 years agoFix regression in r225266.
Asiri Rathnayake [Wed, 7 Jan 2015 11:22:58 +0000 (11:22 +0000)]
Fix regression in r225266.

The change in r225266 was reviewed under D6722. But the commit r225266 has a
typo, causing some MCHammer failures. This patch fixes it.

Change-Id: I573efcff25003af7478ac02548ebbe929fc7f5fd

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

9 years ago[PM] Give slightly less horrible names to the utility pass templates for
Chandler Carruth [Wed, 7 Jan 2015 11:14:51 +0000 (11:14 +0000)]
[PM] Give slightly less horrible names to the utility pass templates for
requiring and invalidating specific analyses. Also make their printed
names match their class names. Writing these out as prose really doesn't
make sense to me any more.

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

9 years ago[X86] Merge a switch statement inside a default case of another switch statement...
Craig Topper [Wed, 7 Jan 2015 08:10:38 +0000 (08:10 +0000)]
[X86] Merge a switch statement inside a default case of another switch statement on the same variable. There was no additional code in the default so this should be no functional change.

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

9 years ago[X86] Don't mark the shift by 1 instructions as isConvertibleToThreeAddress. There...
Craig Topper [Wed, 7 Jan 2015 08:10:36 +0000 (08:10 +0000)]
[X86] Don't mark the shift by 1 instructions as isConvertibleToThreeAddress. There is no handling for them.

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

9 years ago[X86] Remove some unused TYPE enums from the disassembler.
Craig Topper [Wed, 7 Jan 2015 07:47:52 +0000 (07:47 +0000)]
[X86] Remove some unused TYPE enums from the disassembler.

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

9 years agoRevert r225165 and r225169
Karthik Bhat [Wed, 7 Jan 2015 06:34:34 +0000 (06:34 +0000)]
Revert r225165 and r225169
Even thouh gcc produces simialr instructions as Owen pointed out the two patterns aren’t equivalent in the case
where the original subtraction could have caused an overflow.
Reverting the same.

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

9 years ago[ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negati...
Ahmed Bougacha [Wed, 7 Jan 2015 02:42:01 +0000 (02:42 +0000)]
[ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negatives. NFC.

r221973 changed SmallVector::operator[] to use size_t instead of unsigned.

Before that, on 64bit platforms, when a large index (say -1) was passed,
truncating it to unsigned avoided an overflow when computing 'begin() + idx',
and failed the range checking assertion, as expected.
With r221973, idx isn't truncated, so the addition wraps to
'(char*)begin() - 1', and doesn't fire anymore when it should have done so.

This commit changes the comparison to instead compute 'end() - begin()'
(i.e., 'size()'), which avoids potentially overflowing additions, and
correctly triggers the assertion when values such as -1 are passed.
Note that the problem already existed before that revision, on platforms
where sizeof(size_t) == sizeof(unsigned).

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

9 years agoIR: Remove MDNode::getWhenValsUnresolved()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 02:10:42 +0000 (02:10 +0000)]
IR: Remove MDNode::getWhenValsUnresolved()

Remove dead code.  Use `MDNode::get()` instead.

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

9 years agoRemove invalid TODO
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 02:09:51 +0000 (02:09 +0000)]
Remove invalid TODO

We can't drop support for RAUW entirely in `MDNode`s, since it's
required for graph construction.  This comment was from before I'd done
the math on that (out-of-tree), and never should have been committed.

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

9 years ago[PM] Fix a pretty nasty bug where the new pass manager would invalidate
Chandler Carruth [Wed, 7 Jan 2015 01:58:35 +0000 (01:58 +0000)]
[PM] Fix a pretty nasty bug where the new pass manager would invalidate
passes too many time.

I think this is actually the issue that someone raised with me at the
developer's meeting and in an email, but that we never really got to the
bottom of. Having all the testing utilities made it much easier to dig
down and uncover the core issue.

When a pass manager is running many passes over a single function, we
need it to invalidate the analyses between each run so that they can be
re-computed as needed. We also need to track the intersection of
preserved higher-level analyses across all the passes that we run (for
example, if there is one module analysis which all the function analyses
preserve, we want to track that and propagate it). Unfortunately, this
interacted poorly with any enclosing pass adaptor between two IR units.
It would see the intersection of preserved analyses, and need to
invalidate any other analyses, but some of the un-preserved analyses
might have already been invalidated *and recomputed*! We would fail to
propagate the fact that the analysis had already been invalidated.

The solution to this struck me as really strange at first, but the more
I thought about it, the more natural it seemed. After a nice discussion
with Duncan about it on IRC, it seemed even nicer. The idea is that
invalidating an analysis *causes* it to be preserved! Preserving the
lack of result is trivial. If it is recomputed, great. Until something
*else* invalidates it again, we're good.

The consequence of this is that the invalidate methods on the analysis
manager which operate over many passes now consume their
PreservedAnalyses object, update it to "preserve" every analysis pass to
which it delivers an invalidation (regardless of whether the pass
chooses to be removed, or handles the invalidation itself by updating
itself). Then we return this augmented set from the invalidate routine,
letting the pass manager take the result and use the intersection of
*that* across each pass run to compute the final preserved set. This
accounts for all the places where the early invalidation of an analysis
has already "preserved" it for a future run.

I've beefed up the testing and adjusted the assertions to show that we
no longer repeatedly invalidate or compute the analyses across nested
pass managers.

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

9 years agoR600/SI: Add check for amdgcn triple forgotten in r225276.
Tom Stellard [Wed, 7 Jan 2015 01:17:37 +0000 (01:17 +0000)]
R600/SI: Add check for amdgcn triple forgotten in r225276.

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

9 years agoAnalysis: Reformulate WillNotOverflowUnsignedAdd for reusability
David Majnemer [Wed, 7 Jan 2015 00:39:50 +0000 (00:39 +0000)]
Analysis: Reformulate WillNotOverflowUnsignedAdd for reusability

WillNotOverflowUnsignedAdd's smarts will live in ValueTracking as
computeOverflowForUnsignedAdd.  It now returns a tri-state result:
never overflows, always overflows and sometimes overflows.

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

9 years agoInstCombine: Just a small tidy-up
David Majnemer [Wed, 7 Jan 2015 00:39:42 +0000 (00:39 +0000)]
InstCombine: Just a small tidy-up

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

9 years ago[PowerPC] Transform a README.txt entry into a FIXME
Hal Finkel [Wed, 7 Jan 2015 00:15:29 +0000 (00:15 +0000)]
[PowerPC] Transform a README.txt entry into a FIXME

Remove the README.txt entry regarding register allocation of CR logical ops,
and replace it with a FIXME in PPCInstrInfo.td. The text in the README.txt was
not really accurate, and thanks goes to Pat Haugen (and Bill Schmidt) from IBM
for clarifying what was intended and highlighting the relevant text in the ISA
specification.

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

9 years agocmake: Fix 'examples' target after r225319
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:52:35 +0000 (23:52 +0000)]
cmake: Fix 'examples' target after r225319

Add the missing `DEPENDS` keyword.  r225319 did almost the right thing
(I didn't notice the problem with it because `Kaleidoscope-Ch8` wasn't
building at all).

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

9 years agoKaleidoscope: Value => Metadata
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:48:22 +0000 (23:48 +0000)]
Kaleidoscope: Value => Metadata

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

9 years agocmake: Add 'examples' target
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:42:49 +0000 (23:42 +0000)]
cmake: Add 'examples' target

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

9 years agocmake: Add Kaleidoscope target
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:39:37 +0000 (23:39 +0000)]
cmake: Add Kaleidoscope target

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

9 years agoAdd a subdirectory in CMake for Chapter 8.
Eric Christopher [Tue, 6 Jan 2015 23:23:24 +0000 (23:23 +0000)]
Add a subdirectory in CMake for Chapter 8.

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

9 years agoRevert r224935 "Refactor duplicated code. No intended functionality change."
Lang Hames [Tue, 6 Jan 2015 23:04:36 +0000 (23:04 +0000)]
Revert r224935 "Refactor duplicated code. No intended functionality change."

This is affecting the behavior of some ObjC++ / AArch64 test cases on Darwin.
Reverting to get the bots green while I track down the source of the changed
behavior.

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

9 years agoR600/SI: Add combine for isinfinite pattern
Matt Arsenault [Tue, 6 Jan 2015 23:00:46 +0000 (23:00 +0000)]
R600/SI: Add combine for isinfinite pattern

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

9 years agoAdd isNegative helper to ConstantFPSDNode
Matt Arsenault [Tue, 6 Jan 2015 23:00:44 +0000 (23:00 +0000)]
Add isNegative helper to ConstantFPSDNode

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

9 years agoAdd isInfinity helper to ConstantFPSDNode
Matt Arsenault [Tue, 6 Jan 2015 23:00:43 +0000 (23:00 +0000)]
Add isInfinity helper to ConstantFPSDNode

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

9 years agoR600/SI: Pattern match isinf to v_cmp_class instructions
Matt Arsenault [Tue, 6 Jan 2015 23:00:41 +0000 (23:00 +0000)]
R600/SI: Pattern match isinf to v_cmp_class instructions

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

9 years agoR600/SI: Add basic DAG combines for fp_class
Matt Arsenault [Tue, 6 Jan 2015 23:00:39 +0000 (23:00 +0000)]
R600/SI: Add basic DAG combines for fp_class

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

9 years agoR600/SI: Add class intrinsic
Matt Arsenault [Tue, 6 Jan 2015 23:00:37 +0000 (23:00 +0000)]
R600/SI: Add class intrinsic

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

9 years agoFix using wrong intrinsic in test
Matt Arsenault [Tue, 6 Jan 2015 23:00:33 +0000 (23:00 +0000)]
Fix using wrong intrinsic in test

This is a leftover from renaming the intrinsic.
It's surprising the unknown llvm. intrinsic wasn't rejected.

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

9 years agoChange the .ll syntax for comdats and add a syntactic sugar.
Rafael Espindola [Tue, 6 Jan 2015 22:55:16 +0000 (22:55 +0000)]
Change the .ll syntax for comdats and add a syntactic sugar.

In order to make comdats always explicit in the IR, we decided to make
the syntax a bit more compact for the case of a GlobalObject in a
comdat with the same name.

Just dropping the $name causes problems for

@foo = globabl i32 0, comdat
$bar = comdat ...

and

declare void @foo() comdat
$bar = comdat ...

So the syntax is changed to

@g1 = globabl i32 0, comdat($c1)
@g2 = globabl i32 0, comdat

and

declare void @foo() comdat($c1)
declare void @foo() comdat

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

9 years ago[PowerPC] Reuse a load operand in int->fp conversions
Hal Finkel [Tue, 6 Jan 2015 22:31:02 +0000 (22:31 +0000)]
[PowerPC] Reuse a load operand in int->fp conversions

int->fp conversions on PPC must be done through memory loads and stores. On a
modern core, this process begins by storing the int value to memory, then
loading it using a (sometimes special) FP load instruction. Unfortunately, we
would do this even when the value to be converted was itself a load, and we can
just use that same memory location instead of copying it to another first.
There is a slight complication when handling int_to_fp(fp_to_int(x)) pairs,
because the fp_to_int operand has not been lowered when the int_to_fp is being
lowered. We handle this specially by invoking fp_to_int's lowering logic
(partially) and getting the necessary memory location (some trivial refactoring
was done to make this possible).

This is all somewhat ugly, and it would be nice if some later CodeGen stage
could just clean this stuff up, but because doing so would involve modifying
target-specific nodes (or instructions), it is not immediately clear how that
would work.

Also, remove a related entry from the README.txt for which we now generate
reasonable code.

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

9 years agoUse a Factory Method for MachineFunctionInfo Creation
Mehdi Amini [Tue, 6 Jan 2015 20:05:02 +0000 (20:05 +0000)]
Use a Factory Method for MachineFunctionInfo Creation

The goal is to allows MachineFunctionInfo to override this create
function to customize the creation.
No change intended in existing backend in this patch.

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

9 years ago[Hexagon] Adding compound jump encodings.
Colin LeMahieu [Tue, 6 Jan 2015 20:03:31 +0000 (20:03 +0000)]
[Hexagon] Adding compound jump encodings.

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

9 years agoR600/SI: Insert s_waitcnt before s_barrier instructions.
Tom Stellard [Tue, 6 Jan 2015 19:52:07 +0000 (19:52 +0000)]
R600/SI: Insert s_waitcnt before s_barrier instructions.

This ensures that all memory operations are complete when all threads
reach the barrier.

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

9 years agoR600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits
Tom Stellard [Tue, 6 Jan 2015 19:52:04 +0000 (19:52 +0000)]
R600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits

In DS write instructions, the address operand comes before the value
operand(s) which is reversed from every other instruction type.

The SIInsertWait assumed that the first use for each instruction
was the value, so for DS write it was protecting the address
operand with s_waitcnt instructions when it should have been
protecting the value operand.

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

9 years agoRevert "Reapply: Teach SROA how to update debug info for fragmented variables."
Adrian Prantl [Tue, 6 Jan 2015 19:47:27 +0000 (19:47 +0000)]
Revert "Reapply: Teach SROA how to update debug info for fragmented variables."
because of a tsan buildbot failure.
This reverts commit 225272.

Fix should be coming soon.

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

9 years ago[Hexagon] Adding encoding for misc v4 instructions: boundscheck, tlbmatch, dcfetch.
Colin LeMahieu [Tue, 6 Jan 2015 19:03:20 +0000 (19:03 +0000)]
[Hexagon] Adding encoding for misc v4 instructions: boundscheck, tlbmatch, dcfetch.

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

9 years agoThis patch teaches IndVarSimplify to add nuw and nsw to certain kinds
Sanjoy Das [Tue, 6 Jan 2015 19:02:56 +0000 (19:02 +0000)]
This patch teaches IndVarSimplify to add nuw and nsw to certain kinds
of operations that provably don't overflow. For example, we can prove
%civ.inc below does not sign-overflow. With this change,
IndVarSimplify changes %civ.inc to an add nsw.

  define i32 @foo(i32* %array, i32* %length_ptr, i32 %init) {
   entry:
    %length = load i32* %length_ptr, !range !0
    %len.sub.1 = sub i32 %length, 1
    %upper = icmp slt i32 %init, %len.sub.1
    br i1 %upper, label %loop, label %exit

   loop:
    %civ = phi i32 [ %init, %entry ], [ %civ.inc, %latch ]
    %civ.inc = add i32 %civ, 1
    %cmp = icmp slt i32 %civ.inc, %length
    br i1 %cmp, label %latch, label %break

   latch:
    store i32 0, i32* %array
    %check = icmp slt i32 %civ.inc, %len.sub.1
    br i1 %check, label %loop, label %break

   break:
    ret i32 %civ.inc

   exit:
    ret i32 42
  }

Differential Revision: http://reviews.llvm.org/D6748

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

9 years ago[Hexagon] Adding encoding information for absolute address loads.
Colin LeMahieu [Tue, 6 Jan 2015 18:38:26 +0000 (18:38 +0000)]
[Hexagon] Adding encoding information for absolute address loads.

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

9 years agoSelectionDAGBuilder: move constant initialization out of loop
Mehdi Amini [Tue, 6 Jan 2015 18:20:04 +0000 (18:20 +0000)]
SelectionDAGBuilder: move constant initialization out of loop

No semantic change intended.

Reviewers: resistor

Differential Revision: http://reviews.llvm.org/D6834

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

9 years agoR600/SI: Add a stub GCNTargetMachine
Tom Stellard [Tue, 6 Jan 2015 18:00:21 +0000 (18:00 +0000)]
R600/SI: Add a stub GCNTargetMachine

This is equivalent to the AMDGPUTargetMachine now, but it is the
starting point for separating R600 and GCN functionality into separate
targets.

It is recommened that users start using the gcn triple for GCN-based
GPUs, because using the r600 triple for these GPUs will be deprecated in
the future.

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

9 years agoTriple: Add amdgcn triple
Tom Stellard [Tue, 6 Jan 2015 18:00:00 +0000 (18:00 +0000)]
Triple: Add amdgcn triple

This will be used for AMD GPUs with the Graphics Core Next architecture,
which are currently using by the r600 triple.

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

9 years agoR600/SI: Remove MachineFunction dump from AsmPrinter
Tom Stellard [Tue, 6 Jan 2015 17:59:56 +0000 (17:59 +0000)]
R600/SI: Remove MachineFunction dump from AsmPrinter

The dump was dependent on a feature string, which meant that it couldn't
be disabled or enable on a per compile basis.

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

9 years ago[CodeGenPrepare] Improved logic to speculate calls to cttz/ctlz.
Andrea Di Biagio [Tue, 6 Jan 2015 17:41:18 +0000 (17:41 +0000)]
[CodeGenPrepare] Improved logic to speculate calls to cttz/ctlz.

This patch improves the logic added at revision 224899 (see review D6728) that
teaches the backend when it is profitable to speculate calls to cttz/ctlz.

The original algorithm conservatively avoided speculating more than one
instruction from a basic block in a control flow grap modelling an if-statement.
In particular, the only allowed instruction (excluding the terminator) was a
call to cttz/ctlz. However, there are cases where we could be less conservative
and still be able to speculate a call to cttz/ctlz.

With this patch, CodeGenPrepare now tries to speculate a cttz/ctlz if the
result is zero extended/truncated in the same basic block, and the zext/trunc
instruction is "free" for the target.

Added new test cases to CodeGen/X86/cttz-ctlz.ll

Differential Revision: http://reviews.llvm.org/D6853

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

9 years agoReapply: Teach SROA how to update debug info for fragmented variables.
Adrian Prantl [Tue, 6 Jan 2015 17:14:10 +0000 (17:14 +0000)]
Reapply: Teach SROA how to update debug info for fragmented variables.
This also rolls in the changes discussed in http://reviews.llvm.org/D6766.
Defers migrating the debug info for new allocas until after all partitions
are created.

Thanks to Chandler for reviewing!

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

9 years agoDon't loop endlessly for MachO files with 0 ncmds
Filipe Cabecinhas [Tue, 6 Jan 2015 17:08:26 +0000 (17:08 +0000)]
Don't loop endlessly for MachO files with 0 ncmds

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

9 years ago[Hexagon] Fix 225267. GP register is not yet fully implemented. Removing Uses ...
Colin LeMahieu [Tue, 6 Jan 2015 16:52:38 +0000 (16:52 +0000)]
[Hexagon] Fix 225267.  GP register is not yet fully implemented.  Removing Uses [GP] maintains existing behavior.

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

9 years agoImplement a very basic colored syntax highlighting for llvm-dwarfdump.
Adrian Prantl [Tue, 6 Jan 2015 16:50:25 +0000 (16:50 +0000)]
Implement a very basic colored syntax highlighting for llvm-dwarfdump.
The color scheme is the same as the one used by the colorize dwarfdump
script on Darwin.
A new --color option can be used to forcibly turn color on or off.

http://reviews.llvm.org/D6852

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

9 years ago[PowerPC] Add a regression test for r225251
Hal Finkel [Tue, 6 Jan 2015 16:46:37 +0000 (16:46 +0000)]
[PowerPC] Add a regression test for r225251

In r225251, I removed an old entry from the README.txt file. While there are
several contributing factors (including pieces in Clang's ABI code), upon
further reflection, the backend part deserves a regression test.

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

9 years ago[Hexagon] Adding dealloc_return encoding and absolute address stores.
Colin LeMahieu [Tue, 6 Jan 2015 16:15:15 +0000 (16:15 +0000)]
[Hexagon] Adding dealloc_return encoding and absolute address stores.

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

9 years ago[ARM] Cleanup so_imm* tblgen defintions
Asiri Rathnayake [Tue, 6 Jan 2015 15:55:09 +0000 (15:55 +0000)]
[ARM] Cleanup so_imm* tblgen defintions

No functional changes. Support for ARM's modified immediate syntax was added
in r223113 and r223115 (review: D6408). That patch introduced the mod_imm*
tblegen definitions which renders the existing so_imm* definitions redundant.
This patch gets rid of them completely.

Reviewed as: D6722

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