oota-llvm.git
8 years ago[X86] Use \t instead of space after mnemonics in a bunch InstAliases for consistency.
Craig Topper [Fri, 8 Jan 2016 06:09:13 +0000 (06:09 +0000)]
[X86] Use \t instead of space after mnemonics in a bunch InstAliases for consistency.

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

8 years ago[PGO] Ensure vp data in indexed profile always sorted
Xinliang David Li [Fri, 8 Jan 2016 05:45:21 +0000 (05:45 +0000)]
[PGO] Ensure vp data in indexed profile always sorted

Done in  InstrProfWriter to eliminate the need for client
code to do the sorting. The operation is done once and reused
many times so it is more efficient. Update unit test to remove
sorting. Also update expected output of affected tests.

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

8 years agoRemove extra whitespace. NFC.
Junmo Park [Fri, 8 Jan 2016 04:20:32 +0000 (04:20 +0000)]
Remove extra whitespace. NFC.

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

8 years ago[PGO] Fix a bug in InstProfWriter addRecord
Xinliang David Li [Fri, 8 Jan 2016 03:49:59 +0000 (03:49 +0000)]
[PGO] Fix a bug in InstProfWriter addRecord

For a new record with weight != 1, only edge profiling
counters are scaled, VP data is not properly scaled.

This patch refactors the code and fixes the problem.
Also added sort by count interface (for follow up patch).

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

8 years agoRemove static global GCNames from Function.cpp and move it to the Context
Mehdi Amini [Fri, 8 Jan 2016 02:28:20 +0000 (02:28 +0000)]
Remove static global GCNames from Function.cpp and move it to the Context

This remove the need for locking when deleting a function.

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoAdd call sequence start and end for __tls_get_addr
Kyle Butt [Fri, 8 Jan 2016 02:06:19 +0000 (02:06 +0000)]
Add call sequence start and end for __tls_get_addr

This is a fix for bug http://llvm.org/bugs/show_bug.cgi?id=25839.

For a PIC TLS variable access in a function, prologue (mflr followed by std and
stdu) gets scheduled after a tls_get_addr call. tls_get_addr messed up LR but
no one saves/restores it.

Also added a test for save/restore clobbered registers during calling __tls_get_addr.

Patch by Tim Shen

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

8 years ago[Vectorization] Actually return from error case in isStridedPtr
Kyle Butt [Fri, 8 Jan 2016 01:55:13 +0000 (01:55 +0000)]
[Vectorization] Actually return from error case in isStridedPtr

The early return seems to be missed. This causes a radical and wrong loop
optimization on powerpc. It isn't reproducible on x86_64, because
"UseInterleaved" is false.

Patch by Tim Shen.

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

8 years ago[InstCombine] insert a new shuffle in a safe place (PR25999)
Sanjay Patel [Fri, 8 Jan 2016 01:39:16 +0000 (01:39 +0000)]
[InstCombine] insert a new shuffle in a safe place (PR25999)

Limit this transform to a basic block and guard against PHIs.
Hopefully, this fixes the remaining failures in PR25999:
https://llvm.org/bugs/show_bug.cgi?id=25999

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

8 years ago[WebAssembly] Minor code cleanups. NFC.
Dan Gohman [Fri, 8 Jan 2016 01:18:00 +0000 (01:18 +0000)]
[WebAssembly] Minor code cleanups. NFC.

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

8 years agoIntEqClasses: Let join() return the new leader
Matthias Braun [Fri, 8 Jan 2016 01:16:39 +0000 (01:16 +0000)]
IntEqClasses: Let join() return the new leader

The new leader is known anyway so we can return it for some micro
optimization in code where it is easy to pass along the result to the
next join().

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

8 years agoLiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()
Matthias Braun [Fri, 8 Jan 2016 01:16:35 +0000 (01:16 +0000)]
LiveInterval: A LiveRange is enough for ConnectedVNInfoEqClasses::Classify()

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

8 years ago[WebAssembly] Minor code cleanups. NFC.
Dan Gohman [Fri, 8 Jan 2016 01:06:00 +0000 (01:06 +0000)]
[WebAssembly] Minor code cleanups. NFC.

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

8 years ago[WebAssembly] Remove an unused def : Pat.
Dan Gohman [Fri, 8 Jan 2016 00:50:33 +0000 (00:50 +0000)]
[WebAssembly] Remove an unused def : Pat.

WebAssemblyISelLowering.cpp does not wrap jump table nodes inside of
WebAssemblywrapper nodes, so this pattern is not currently used.

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

8 years ago[WebAssembly] Remove unused arguments, unused functions. NFC.
Dan Gohman [Fri, 8 Jan 2016 00:43:54 +0000 (00:43 +0000)]
[WebAssembly] Remove unused arguments, unused functions. NFC.

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

8 years ago[PGO] : Removing trailing space/define new macro/NFC
Xinliang David Li [Fri, 8 Jan 2016 00:38:53 +0000 (00:38 +0000)]
[PGO] : Removing trailing space/define new macro/NFC

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

8 years agoAdd some testing for thumb1 and thumb2 inline asm immediate constraints
Eric Christopher [Fri, 8 Jan 2016 00:34:44 +0000 (00:34 +0000)]
Add some testing for thumb1 and thumb2 inline asm immediate constraints
and fix a couple of bugs on inspection.

Also fixes PR26061.

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

8 years ago[llvm-symbolizer] Print out non-address lines verbatim.
Mike Aizatsky [Thu, 7 Jan 2016 23:57:41 +0000 (23:57 +0000)]
[llvm-symbolizer] Print out non-address lines verbatim.

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

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

8 years ago[LiveDebugValues] Replace several lines of code with operator[].
Alexey Samsonov [Thu, 7 Jan 2016 23:38:45 +0000 (23:38 +0000)]
[LiveDebugValues] Replace several lines of code with operator[].

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

8 years agoInstructions to be redone only if from the same BB
Aditya Nandakumar [Thu, 7 Jan 2016 23:22:55 +0000 (23:22 +0000)]
Instructions to be redone only if from the same BB

While adding instructions(possible roots) to be redone, make sure they
are from the same basic block.

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

8 years agoWebAssembly: use .skip instead of .zero directive
JF Bastien [Thu, 7 Jan 2016 23:18:29 +0000 (23:18 +0000)]
WebAssembly: use .skip instead of .zero directive

.zero is confusing when used with two arguments. Documentation:

  This directive emits SIZE 0-valued bytes.  SIZE must be an absolute
  expression.  This directive is actually an alias for the '.skip'
  directive so in can take an optional second argument of the value to
  store in the bytes instead of zero.  Using '.zero' in this way would be
  confusing however.

Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=18353

Hexagon and Sparc do the same, and it's all the same to WebAssembly so
let's pick the less confusing of the two.

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

8 years ago[PGO] Minor refactoring /NFC
Xinliang David Li [Thu, 7 Jan 2016 22:46:29 +0000 (22:46 +0000)]
[PGO] Minor refactoring /NFC

Move common defs into common header files.

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

8 years agoTemporarily revert r257105 "[Verifier] Check that debug values have proper size"
Keno Fischer [Thu, 7 Jan 2016 22:39:11 +0000 (22:39 +0000)]
Temporarily revert r257105 "[Verifier] Check that debug values have proper size"

Looks like there's a case where clang generates debug info that triggers
the new verifier check. Reverting while investigating.

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

8 years ago[Verifier] Check that debug values have proper size
Keno Fischer [Thu, 7 Jan 2016 22:18:37 +0000 (22:18 +0000)]
[Verifier] Check that debug values have proper size

Summary:
Teach the Verifier to make sure that the storage size given to llvm.dbg.declare
or the value size given to llvm.dbg.value agree with what is declared in
DebugInfo. This is implicitly assumed in a number of passes (e.g. in SROA).
Additionally this catches a number of common mistakes, such as passing a
pointer when a value was intended or vice versa.

One complication comes from stack coloring which modifies the original IR when
it merges allocas in order to make sure that if AA falls back to the IR it gets
the correct result. However, given this new invariant, indiscriminately
replacing one alloca by a different (differently sized one) is no longer valid.
Fix this by just undefing out any use of the alloca in a dbg.declare in this
case.

Additionally, I had to fix a number of test cases. Of particular note:
- I regenerated dbg-changes-codegen-branch-folding.ll from the given source as
  it was affected by the bug fixed in r256077
- two-cus-from-same-file.ll was changed to avoid having a variable-typed debug
  variable as that would depend on the target, even though this test is
  supposed to be generic
- I had to manually declared size/align for reference type. See also the
  discussion for D14275/r253186.
- fpstack-debuginstr-kill.ll required changing `double` to `long double`
- most others were just a question of adding OP_deref

Reviewers: aprantl
Differential Revision: http://reviews.llvm.org/D14276

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

8 years agoTurn off lldb debug tuning by default for FreeBSD
Dimitry Andric [Thu, 7 Jan 2016 22:09:12 +0000 (22:09 +0000)]
Turn off lldb debug tuning by default for FreeBSD

Summary:
In rL242338, debugger tuning was introduced, and the tuning for FreeBSD
was set to lldb by default.  However, for the foreseeable future we
still need to default to gdb tuning, since lldb is not ready for all of
FreeBSD's architectures, and some system tools (like objcopy, etc) have
not yet been adapted to cope with the lldb tuned format, which has
.apple sections.

Therefore, let FreeBSD use gdb by default for now.

Reviewers: emaste, probinson

Subscribers: llvm-commits, emaste

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

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

8 years ago[SCCP] Don't violate the lattice invariants
David Majnemer [Thu, 7 Jan 2016 21:36:16 +0000 (21:36 +0000)]
[SCCP] Don't violate the lattice invariants

We marked values which are 'undef' as constant instead of undefined
which violates SCCP's invariants.  If we can figure out that a
computation results in 'undef', leave it in the undefined state.

This fixes PR16052.

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

8 years agoWebAssembly: update expected failures, more assert got resolved.
JF Bastien [Thu, 7 Jan 2016 21:00:37 +0000 (21:00 +0000)]
WebAssembly: update expected failures, more assert got resolved.

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

8 years agoFix crash when printing instructions that have a metadata attached but no parent.
Mehdi Amini [Thu, 7 Jan 2016 20:14:30 +0000 (20:14 +0000)]
Fix crash when printing instructions that have a metadata attached but no parent.

Fix PR24852 (crash with -debug -instcombine)

Patch by Than McIntosh <thanm@google.com>

Summary:
Add guards to the asm writer to prevent crashing
when dumping an instruction that has no basic
block.

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

From: Than McIntosh <thanm@google.com>

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

8 years agoWebAssembly: update expected failures, assert got resolved by r257084.
JF Bastien [Thu, 7 Jan 2016 20:07:21 +0000 (20:07 +0000)]
WebAssembly: update expected failures, assert got resolved by r257084.

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

8 years ago[PGO] Simplify coverage mapping lowering
Xinliang David Li [Thu, 7 Jan 2016 20:05:49 +0000 (20:05 +0000)]
[PGO] Simplify coverage mapping lowering

Coverage mapping data may reference names of functions
that are skipped by FE (e.g, unused inline functions). Since
those functions are skipped, normal instr-prof function lowering
pass won't put those names in the right section, so special
handling is needed to walk through coverage mapping structure
and recollect the references.

With this patch, only names that are skipped are processed. This
simplifies the lowering code and it no longer needs to make
assumptions coverage mapping data layout. It should also be
more efficient.

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

8 years agoRemove junk accidentally commited with r257087
David Majnemer [Thu, 7 Jan 2016 19:30:13 +0000 (19:30 +0000)]
Remove junk accidentally commited with r257087

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

8 years agoAdd test for r256912
David Majnemer [Thu, 7 Jan 2016 19:27:16 +0000 (19:27 +0000)]
Add test for r256912

I forgot to add this with the rest of r256912.

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

8 years ago[SCCP] Can't go from overdefined to constant
David Majnemer [Thu, 7 Jan 2016 19:25:39 +0000 (19:25 +0000)]
[SCCP] Can't go from overdefined to constant

The fix for PR23999 made us mark loads of null as producing the constant
undef which upsets the lattice.  Instead, keep the load as "undefined".
This fixes PR26044.

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

8 years ago[DominatorTree] Remove unnecessary map population. NFC.
Michael Liao [Thu, 7 Jan 2016 19:21:29 +0000 (19:21 +0000)]
[DominatorTree] Remove unnecessary map population. NFC.

- The reason of population these maps seems not valid any more.

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

8 years ago[WebAssembly] Support combining GEP and FrameIndex offsets in memory operand offset...
Derek Schuff [Thu, 7 Jan 2016 18:55:52 +0000 (18:55 +0000)]
[WebAssembly] Support combining GEP and FrameIndex offsets in memory operand offset field

Previously we only supported putting the FI into memory operand offset
fields if there was nothing there already. Now combine them.

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

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

8 years ago[WebAssembly] Use the default private label prefixes.
Dan Gohman [Thu, 7 Jan 2016 18:49:53 +0000 (18:49 +0000)]
[WebAssembly] Use the default private label prefixes.

The MC assembler doesn't like using the empty string as a private label
prefix because then it treats all labels as private. This commit reverts
back to the default prefix, which is .L, which is common in ELF targets
and consistent with the LLVM name mangler.

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

8 years agoAMDGPU/SI: Fold operands with sub-registers
Nicolai Haehnle [Thu, 7 Jan 2016 17:10:29 +0000 (17:10 +0000)]
AMDGPU/SI: Fold operands with sub-registers

Summary:
Multi-dword constant loads generated unnecessary moves from SGPRs into VGPRs,
increasing the code size and VGPR pressure. These moves are now folded away.

Note that this lack of operand folding was not a problem for VMEM loads,
because COPY nodes from VReg_Nnn to VGPR32 are eliminated by the register
coalescer.

Some tests are updated, note that the fsub.ll test explicitly checks that
the move is elided.

With the IR generated by current Mesa, the changes are obviously relatively
minor:

7063 shaders in 3531 tests
Totals:
SGPRS: 351872 -> 352560 (0.20 %)
VGPRS: 199984 -> 200732 (0.37 %)
Code Size: 9876968 -> 9881112 (0.04 %) bytes
LDS: 91 -> 91 (0.00 %) blocks
Scratch: 1779712 -> 1767424 (-0.69 %) bytes per wave
Wait states: 295164 -> 295337 (0.06 %)

Totals from affected shaders:
SGPRS: 65784 -> 66472 (1.05 %)
VGPRS: 38064 -> 38812 (1.97 %)
Code Size: 1993828 -> 1997972 (0.21 %) bytes
LDS: 42 -> 42 (0.00 %) blocks
Scratch: 795648 -> 783360 (-1.54 %) bytes per wave
Wait states: 54026 -> 54199 (0.32 %)

Reviewers: tstellarAMD, arsenm, mareko

Subscribers: arsenm, llvm-commits

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

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

8 years agoAMDGPU/SI: xnack_mask is always reserved on VI
Nicolai Haehnle [Thu, 7 Jan 2016 17:10:20 +0000 (17:10 +0000)]
AMDGPU/SI: xnack_mask is always reserved on VI

Summary:
Somehow, I first interpreted the docs as saying space for xnack_mask is only
reserved when XNACK is enabled via SH_MEM_CONFIG. I felt uneasy about this and
went back to actually test what is happening, and it turns out that xnack_mask
is always reserved at least on Tonga and Carrizo, in the sense that flat_scr
is always fixed below the SGPRs that are used to implement xnack_mask, whether
or not they are actually used.

I confirmed this by writing a shader using inline assembly to tease out the
aliasing between flat_scratch and regular SGPRs. For example, on Tonga, where
we fix the number of SGPRs to 80, s[74:75] aliases flat_scratch (so
xnack_mask is s[76:77] and vcc is s[78:79]).

This patch changes both the calculation of the total number of SGPRs and the
various register reservations to account for this.

It ought to be possible to use the gap left by xnack_mask when the feature
isn't used, but this patch doesn't try to do that. (Note that the same applies
to vcc.)

Note that previously, even before my earlier change in r256794, the SGPRs that
alias to xnack_mask could end up being used as well when flat_scr was unused
and the total number of SGPRs happened to fall on the right alignment
(e.g. highest regular SGPR being used s29 and VCC used would lead to number
of SGPRs being 32, where s28 and s29 alias with xnack_mask). So if there
were some conflict due to such aliasing, we should have noticed that already.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

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

8 years ago[avx512] Fix test avx512bw-intrinsics.ll
Michael Zuckerman [Thu, 7 Jan 2016 16:25:42 +0000 (16:25 +0000)]
[avx512] Fix test avx512bw-intrinsics.ll
Change the CHECK lablel into AVX512BW
And fix declare lable of llvm.x86.avx512.mask.psrav32_hi

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

8 years ago[AVX512] add PSLLW and PSLLV Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 16:02:51 +0000 (16:02 +0000)]
[AVX512] add PSLLW and PSLLV Intrinsic

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

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

8 years agoRevert r257064. It caused failures in some sanitizer tests.
Silviu Baranga [Thu, 7 Jan 2016 15:46:43 +0000 (15:46 +0000)]
Revert r257064. It caused failures in some sanitizer tests.

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

8 years agoFix build after r257064: we should be returning false, not nullptr
Silviu Baranga [Thu, 7 Jan 2016 15:09:22 +0000 (15:09 +0000)]
Fix build after r257064: we should be returning false, not nullptr

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

8 years agoRevert r257055, it caused PR26064.
Nico Weber [Thu, 7 Jan 2016 15:01:46 +0000 (15:01 +0000)]
Revert r257055, it caused PR26064.

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

8 years ago[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constan...
Silviu Baranga [Thu, 7 Jan 2016 14:56:08 +0000 (14:56 +0000)]
[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constants when comparing GEPs

Summary:
When comparing two GEP instructions which have the same base pointer
and one of them has a constant index, it is possible to only compare
indices, transforming it to a compare with a constant. This removes
one use for the GEP instruction with the constant index, can reduce
register pressure and can sometimes lead to removing the comparisson
entirely.

InstCombine was already doing this when comparing two GEPs if the
base pointers were the same. However, in the case where we have
complex pointer arithmetic (GEPs applied to GEPs, PHIs of GEPs,
conversions to or from integers, etc) the value of the original
base pointer will be hidden to the optimizer and this transformation
will be disabled.

This change detects when the two sides of the comparison can be
expressed as GEPs with the same base pointer, even if they don't
appear as such in the IR. The transformation will convert all the
pointer arithmetic to arithmetic done on indices and all the
relevant uses of GEPs to GEPs with a common base pointer. The
GEP comparison will be converted to a comparison done on indices.

Reviewers: majnemer, jmolloy

Subscribers: hfinkel, jevinskie, jmolloy, aadg, llvm-commits

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

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

8 years ago[AVX512] add PSRAV Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 14:42:20 +0000 (14:42 +0000)]
[AVX512] add PSRAV Intrinsic

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

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

8 years agoAdded support for macro emission in dwarf (supporting DWARF version 4).
Amjad Aboud [Thu, 7 Jan 2016 14:28:20 +0000 (14:28 +0000)]
Added support for macro emission in dwarf (supporting DWARF version 4).

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

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

8 years ago[GlobalsAA] Partially back out r248576
James Molloy [Thu, 7 Jan 2016 13:33:28 +0000 (13:33 +0000)]
[GlobalsAA] Partially back out r248576

See PR25822 for a more full summary, but we were conflating the concepts of "capture" and "escape". We were proving nocapture and using that proof to infer noescape, which is not true. Escaped-ness is a function-local property - as soon as a value is used in a call argument it escapes. Capturedness is a related but distinct property. It implies a *temporally limited* escape. Consider:

  static int a;
  int b;
  int g(int * nocapture arg);
  int f() {
    a = 2;  // Even though a escapes to g, it is not captured so can be treated as non-escaping here.
    g(&a);  // But here it must be treated as escaping.
    g(&b);  // Now that g(&a) has returned we know it was not captured so we can treat it as non-escaping again.
  }

The original commit did not sufficiently understand this nuance and so caused PR25822 and PR26046.

r248576 included both a performance improvement (which has been backed out) and a related conformance fix (which has been kept along with its testcase).

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

8 years ago[AVX512] add PSHUFHW and PSHUFLW Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 12:35:43 +0000 (12:35 +0000)]
[AVX512] add PSHUFHW and PSHUFLW Intrinsic

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

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

8 years ago[X86][AVX] Match broadcast loads through a bitcast
Simon Pilgrim [Thu, 7 Jan 2016 11:34:27 +0000 (11:34 +0000)]
[X86][AVX] Match broadcast loads through a bitcast

AVX1 v8i32/v4i64 shuffles are bitcasted to v8f32/v4f64, this patch peeks through bitcasts to check for a load node to allow broadcasts to occur.

Follow up to D15310

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

8 years agoAdded AVRTargetObjectFile class and AVR.h
Dylan McKay [Thu, 7 Jan 2016 10:53:15 +0000 (10:53 +0000)]
Added AVRTargetObjectFile class and AVR.h

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

8 years agoMark arm as the 32bit variant of aarch64 in Triple
Tamas Berghammer [Thu, 7 Jan 2016 10:41:12 +0000 (10:41 +0000)]
Mark arm as the 32bit variant of aarch64 in Triple

Change Triple::get32BitArchVariant to return arm/armeb as the 32bit
variant of aarch64/aarch64_be and do the same change for the oppoiste
direction in Triple::get64BitArchVariant.

Differential revision: http://reviews.llvm.org/D15529

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

8 years agoRemove extra whitespace. NFC.
Junmo Park [Thu, 7 Jan 2016 10:26:32 +0000 (10:26 +0000)]
Remove extra whitespace. NFC.

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

8 years ago[X86][SSE} Add INSERTPS as a target shuffle
Simon Pilgrim [Thu, 7 Jan 2016 10:24:19 +0000 (10:24 +0000)]
[X86][SSE} Add INSERTPS as a target shuffle

Follow up to D15378, added INSERTPS to the list of decodable target shuffles and enabled XFormVExtractWithShuffleIntoLoad to handle target shuffles with SentinelZero and tested this with INSERTPS.

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

8 years ago[AVX512] add PSHUFD Intrinsic
Michael Zuckerman [Thu, 7 Jan 2016 09:24:12 +0000 (09:24 +0000)]
[AVX512] add PSHUFD Intrinsic

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

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

8 years agoARM: support TLS accesses on Darwin platforms
Tim Northover [Thu, 7 Jan 2016 09:03:03 +0000 (09:03 +0000)]
ARM: support TLS accesses on Darwin platforms

Darwin TLS accesses most closely resemble ELF's general-dynamic situation,
since they have to be able to handle all possible situations. The descriptors
and so on are obviously slightly different though.

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

8 years agoModernize to range-based loop
Michael Liao [Thu, 7 Jan 2016 07:58:25 +0000 (07:58 +0000)]
Modernize to range-based loop

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

8 years ago[SystemZ] Add hasSideEffects flag on Serialize instruction.
Jonas Paulsson [Thu, 7 Jan 2016 07:20:55 +0000 (07:20 +0000)]
[SystemZ] Add hasSideEffects flag on Serialize instruction.

Serialize will perform a hardware serialization operation, and is
acting as a memory barrier. Therefore it must have the hasSideEffects
flag set so it will be treated as a global memory object.

Reviewed by Ulrich Weigand

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

8 years ago[X86] Remove superfluous mayLoad flag. The pattern already implies it.
Craig Topper [Thu, 7 Jan 2016 06:42:10 +0000 (06:42 +0000)]
[X86] Remove superfluous mayLoad flag. The pattern already implies it.

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

8 years ago[X86] Had hasSideEffects=0 to VBROADCASTI128.
Craig Topper [Thu, 7 Jan 2016 06:37:55 +0000 (06:37 +0000)]
[X86] Had hasSideEffects=0 to VBROADCASTI128.

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

8 years ago[X86] Add OpSize32 to MOVSX32_NOREX instructions to match their other versions.
Craig Topper [Thu, 7 Jan 2016 06:37:52 +0000 (06:37 +0000)]
[X86] Add OpSize32 to MOVSX32_NOREX instructions to match their other versions.

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

8 years ago[X86] Add hasSideEffects=0 and mayLoad=1 to MOVZX64* instructions. While there remove...
Craig Topper [Thu, 7 Jan 2016 05:57:39 +0000 (05:57 +0000)]
[X86] Add hasSideEffects=0 and mayLoad=1 to MOVZX64* instructions. While there remove a superfluous _Q from the instruction names.

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

8 years agollvm/test/CodeGen/X86/statepoint-vector.ll REQUIRES asserts due to a debug option.
NAKAMURA Takumi [Thu, 7 Jan 2016 05:40:37 +0000 (05:40 +0000)]
llvm/test/CodeGen/X86/statepoint-vector.ll REQUIRES asserts due to a debug option.

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

8 years ago[X86] STOSQ without a rep prefix doesn't read or write RCX.
Craig Topper [Thu, 7 Jan 2016 05:18:49 +0000 (05:18 +0000)]
[X86] STOSQ without a rep prefix doesn't read or write RCX.

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

8 years agoUndo spurious change made in r256965
David Majnemer [Thu, 7 Jan 2016 04:31:35 +0000 (04:31 +0000)]
Undo spurious change made in r256965

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

8 years agoOne more attempt at stablizing a test on all platforms.
Philip Reames [Thu, 7 Jan 2016 04:20:52 +0000 (04:20 +0000)]
One more attempt at stablizing a test on all platforms.

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

8 years ago[Statepoints] Add test cases around vectors and stablize test
Philip Reames [Thu, 7 Jan 2016 04:15:31 +0000 (04:15 +0000)]
[Statepoints] Add test cases around vectors and stablize test

Unlike my comment in 257022 said, it turns out we do handle constant vectors in the statepoint lowering, but only because SelectionDAG doesn't actually produce constants for them.  Add a couple of tests which show this working.

Also, add a triple to the same test file to hopefully fix a failing bot.

It turns out we do han

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

8 years ago[AArch64 MachineCombine] Enhance/Add support for general reassociation to reduce...
Haicheng Wu [Thu, 7 Jan 2016 04:01:02 +0000 (04:01 +0000)]
[AArch64 MachineCombine] Enhance/Add support for general reassociation to reduce the critical path

Allow fadd/fmul to be reassociated in aarch64.

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

8 years ago[Statepoints] Initial support for relocating vectors of pointers
Philip Reames [Thu, 7 Jan 2016 03:32:11 +0000 (03:32 +0000)]
[Statepoints] Initial support for relocating vectors of pointers

Currently, we try to split vectors of pointers back into their component pointer elements during rewrite-statepoints-for-gc. This is less than ideal since presumably the vectorizer chose to vectorize for a reason. :) It's also been a source of bugs - in particular, the relocation logic as currently implemented was recently discovered to be wrong.

The alternate approach is to allow gc.relocates of vector-of-pointer type and update the backend to handle them. That's what this patch tries to do. This won't actually enable vector-of-pointers in practice - there are some RS4GC changes needed - but the lowering is standalone and testable so it makes sense to separate.

Note that there are some known cases around vector constants which this patch does not handle. Once this is in, I'll send another patch with individual fixes and test cases.

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

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

8 years ago[WebAssembly] Add -m:e to the target triple.
Dan Gohman [Thu, 7 Jan 2016 03:19:23 +0000 (03:19 +0000)]
[WebAssembly] Add -m:e to the target triple.

This enables ELF-style name mangling, which primarily means using ".L" for
private symbols.

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

8 years ago[Linker] Also treat a DIImportedEntity scope DISubprogram as needed.
Ahmed Bougacha [Thu, 7 Jan 2016 03:14:59 +0000 (03:14 +0000)]
[Linker] Also treat a DIImportedEntity scope DISubprogram as needed.

Follow-up to r257000: DIImportedEntity can reach a DISubprogram via
its entity, but also via its scope. Handle the latter case as well.

PR26037.

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

8 years ago[RS4GC] Add an option to suppress vector splitting
Philip Reames [Thu, 7 Jan 2016 02:20:11 +0000 (02:20 +0000)]
[RS4GC] Add an option to suppress vector splitting

At the moment, this is essentially a diangostic option so that I can start collecting failing test cases, but we will eventually migrate to removing the vector splitting code entirely.

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

8 years ago[libFuzzer] add a position hint to the dictionary-based mutator
Kostya Serebryany [Thu, 7 Jan 2016 01:49:35 +0000 (01:49 +0000)]
[libFuzzer] add a position hint to the dictionary-based mutator

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

8 years ago[ShrinkWrapping] Give up on irreducible CFGs.
Quentin Colombet [Thu, 7 Jan 2016 01:23:49 +0000 (01:23 +0000)]
[ShrinkWrapping] Give up on irreducible CFGs.
We need to know whether or not a given basic block is in a loop for the analysis
to be correct.
Loop information may be incomplete on irreducible CFGs, therefore we may
generate incorrect code if we use it in those situations.

This fixes PR25988.

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

8 years agotools/llvm-config: improve shared library support
Andrew Wilkins [Thu, 7 Jan 2016 00:18:56 +0000 (00:18 +0000)]
tools/llvm-config: improve shared library support

Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

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

8 years agoAlways treat DISubprogram reached by DIImportedEntity as needed.
Teresa Johnson [Thu, 7 Jan 2016 00:06:27 +0000 (00:06 +0000)]
Always treat DISubprogram reached by DIImportedEntity as needed.

It is illegal to have a null entity in a DIImportedEntity, so
we must link in a DISubprogram metadata node referenced by one,
even if the associated function is not linked in or inlined anywhere.

Fixes PR26037.

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

8 years agoFix PR26051: Memcpy optimization should introduce a call to memcpy before the store...
Mehdi Amini [Wed, 6 Jan 2016 23:50:22 +0000 (23:50 +0000)]
Fix PR26051: Memcpy optimization should introduce a call to memcpy before the store destination position

This is a conservative fix, I expect Amaury to relax this.
Follow-up for r256923

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agorangify; NFCI
Sanjay Patel [Wed, 6 Jan 2016 23:45:05 +0000 (23:45 +0000)]
rangify; NFCI

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

8 years ago[X86] Determine if target shuffle can contain zero elements
Simon Pilgrim [Wed, 6 Jan 2016 23:24:40 +0000 (23:24 +0000)]
[X86] Determine if target shuffle can contain zero elements

getTargetShuffleMask may return shuffle masks with SM_SentinelZero (-2) values (currently just for PSHUFB but VPERM2X128 as well with this patch). Although some calling functions can make use of this (mainly for shuffle combining), others can not and their inclusion makes shuffle mask comparisons more difficult.

This patch adds a flag to getTargetShuffleMask to indicate if the calling function can't handle SM_SentinelZero; getTargetShuffleMask will then return false if it occurs to make handling much easier.

I've tidied up some uses of getTargetShuffleMask to better indicate what is going on - more could be done but at present I don't have test cases to demonstrate it.

Some upcoming patches will make use of this to both support more uses where SM_SentinelZero is not permitted (e.g. combineShuffleToAddSub), and also will allow us to add INSERTPS support to getTargetShuffleMask as part of better zero handling discussed in D14261.

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

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

8 years ago[Bitcode] Remove superflous compatibility tests
Vedant Kumar [Wed, 6 Jan 2016 23:22:38 +0000 (23:22 +0000)]
[Bitcode] Remove superflous compatibility tests

With r256990, bogner introduced comprehensive tests for constant arrays
and vectors. We no longer need the existing ones because they are
redundant.

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

8 years agoBitcode: Move these tests into compatibility.ll
Justin Bogner [Wed, 6 Jan 2016 23:16:37 +0000 (23:16 +0000)]
Bitcode: Move these tests into compatibility.ll

I added a couple of tests in r256982, but vedantk suggested that they
fit better into compatibility.ll, since they could catch format breaks
later on there.

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

8 years agoRecommit r256952 "Filtering IR printing for print-after-all/print-before-all"
Weiming Zhao [Wed, 6 Jan 2016 22:55:03 +0000 (22:55 +0000)]
Recommit r256952 "Filtering IR printing for print-after-all/print-before-all"

Fix lit test fail due to outputting an extra line.

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

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

8 years agoBitcode: Fix reading and writing of ConstantDataVectors of halfs
Justin Bogner [Wed, 6 Jan 2016 22:31:32 +0000 (22:31 +0000)]
Bitcode: Fix reading and writing of ConstantDataVectors of halfs

In r254991 I allowed ConstantDataVectors to contain elements of
HalfTy, but I missed updating the bitcode reader and writer to handle
this, so now we crash if we try to emit bitcode on programs that have
constant vectors of half.

This fixes the issue and adds test coverage for reading and writing
constant sequences in bitcode.

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

8 years agoAMDGPU/SI: Fix crash when inline assembly is used in a graphics shader
Nicolai Haehnle [Wed, 6 Jan 2016 22:01:04 +0000 (22:01 +0000)]
AMDGPU/SI: Fix crash when inline assembly is used in a graphics shader

Summary:
This is admittedly something that you could only run into by manually
playing around with shader assembly because the SITypeWriter pass is
skipped for compute.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

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

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

8 years ago[LibCallSimplifier] less indenting; NFCI
Sanjay Patel [Wed, 6 Jan 2016 20:52:21 +0000 (20:52 +0000)]
[LibCallSimplifier] less indenting; NFCI

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

8 years ago[SplitLandingPadPredecessors] Create a PHINode for the original landingpad only if...
Chen Li [Wed, 6 Jan 2016 20:32:05 +0000 (20:32 +0000)]
[SplitLandingPadPredecessors] Create a PHINode for the original landingpad only if it has some uses

Summary: This patch adds a check in SplitLandingPadPredecessors to see if the original landingpad instruction has any uses. If not, we don't need to create a PHINode for it in the joint block since it's gonna be a dead code anyway. The motivation for this patch is that we found a bug that SplitLandingPadPredecessors created a PHINode of token type landingpad, which failed the verifier since PHINode can not be token type. However, the created PHINode will never be used in our code pattern. This patch will workaround this bug, and we might add supports in SplitLandingPadPredecessors to handle token type landingpad with uses in the future.

Reviewers: reames

Subscribers: llvm-commits

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

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

8 years agoPromote aggregate store to memset when possible
Amaury Sechet [Wed, 6 Jan 2016 19:47:24 +0000 (19:47 +0000)]
Promote aggregate store to memset when possible

Summary: As per title. This will allow the optimizer to pick up on it.

Reviewers: craig.topper, spatel, dexonsmith, Prazek, chandlerc, joker.eph, majnemer

Subscribers: llvm-commits

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

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

8 years agoRemove useless DEBUG
Amaury Sechet [Wed, 6 Jan 2016 19:45:09 +0000 (19:45 +0000)]
Remove useless DEBUG

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

8 years agoConsolidate MemRefs handling from BranchFolding and correct latent bug
Philip Reames [Wed, 6 Jan 2016 19:33:12 +0000 (19:33 +0000)]
Consolidate MemRefs handling from BranchFolding and correct latent bug

Move the logic from BranchFolding to use the shared infrastructure for merging MMOs introduced in 256909. This has the effect of making BranchFolding more capable.

In the process, fix a latent bug. The existing handling for merging didn't handle the case where one of the instructions being merged had overflowed and dropped MemRefs. This was a latent bug in the places the code was commoned from, but potentially reachable in BranchFolding.

Once this is in, we're left with a single place to consider implementing MMO unique-ing as proposed in http://reviews.llvm.org/D15230.

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

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

8 years ago[WinEH] Remove calculateCatchReturnSuccessorColors
David Majnemer [Wed, 6 Jan 2016 19:26:30 +0000 (19:26 +0000)]
[WinEH] Remove calculateCatchReturnSuccessorColors

The functionality that calculateCatchReturnSuccessorColors provides was
once non-trivial: it was a computation layered on top of funclet
coloring.

These days, LLVM IR directly encodes what
calculateCatchReturnSuccessorColors computed, obsoleting the need for
it.

No functionality change is intended.

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

8 years ago[LibCallSimplifier] use instruction-level fast-math-flags for tan/atan transform
Sanjay Patel [Wed, 6 Jan 2016 19:23:35 +0000 (19:23 +0000)]
[LibCallSimplifier] use instruction-level fast-math-flags for tan/atan transform

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

8 years ago[X86] Correctly model TLS calls w.r.t. frame requirements.
Quentin Colombet [Wed, 6 Jan 2016 19:09:26 +0000 (19:09 +0000)]
[X86] Correctly model TLS calls w.r.t. frame requirements.
TLS calls need the stack frame to be properly set up and this
implies that such calls need ADJUSTSTACK_xxx markers.

Fixes PR25820.

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

8 years agoMake WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS
Nico Weber [Wed, 6 Jan 2016 19:05:19 +0000 (19:05 +0000)]
Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS

LLVM_ENABLE_TIMESTAMPS controls if timestamps are embedded into llvm's
binaries. Turning it off is useful for deterministic builds.

r246905 made it so that the define suddenly also controls if the binaries that
the llvm binaries _create_ embed timestamps or not – but this shouldn't be a
configure-time option. r256203/r256204 added a driver option to toggle this on
and off, so this patch now passes this driver option in LLVM_ENABLE_TIMESTAMPS
builds so that if LLVM_ENABLE_TIMESTAMPS is set, the build of LLVM is
deterministic – but the built clang can still write timestamps into other
executables when requested.

This also allows removing some of the test machinery added in r292012 to work
around this problem.

See PR24740 for background.
http://reviews.llvm.org/D15783

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

8 years agorefactor divrem8 lowering; NFCI
Sanjay Patel [Wed, 6 Jan 2016 18:47:09 +0000 (18:47 +0000)]
refactor divrem8 lowering; NFCI

The code duplication contributed to PR25754:
https://llvm.org/bugs/show_bug.cgi?id=25754

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

8 years ago[ShrinkWrap] Fix FindIDom to only have one kind of failure.
Michael Kuperstein [Wed, 6 Jan 2016 18:40:11 +0000 (18:40 +0000)]
[ShrinkWrap] Fix FindIDom to only have one kind of failure.

FindIDom() can fail in two different ways - it can either return nullptr or the
block itself, depending on the circumstances. Some users of FindIDom() check
one error condition, while others check the other.

Change it to always return nullptr on failure.
This fixes PR26004.

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

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

8 years agoRevert r256952 due to lit test fails.
Weiming Zhao [Wed, 6 Jan 2016 18:31:44 +0000 (18:31 +0000)]
Revert r256952 due to lit test fails.

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

8 years ago[WebAssembly] Don't use range-based loop for a list that's being modified
Dan Gohman [Wed, 6 Jan 2016 18:29:35 +0000 (18:29 +0000)]
[WebAssembly] Don't use range-based loop for a list that's being modified

The first instruction in a block is what the rend() iterator points to, so
if it moves, we need to re-evaluate rend() so that we continue to iterate
through the rest of the instructions.

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

8 years agoFiltering IR printing for print-after-all/print-before-all
Weiming Zhao [Wed, 6 Jan 2016 18:20:25 +0000 (18:20 +0000)]
Filtering IR printing for print-after-all/print-before-all

Summary:
This patch implements "-print-funcs" option to support function filtering for IR printing like -print-after-all, -print-before etc.
Examples:
  -print-after-all -print-funcs=foo,bar

Reviewers: mcrosier, joker.eph

Subscribers: tejohnson, joker.eph, llvm-commits

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

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

8 years agoFix option desc in FunctionAttrs; NFC
Weiming Zhao [Wed, 6 Jan 2016 18:18:16 +0000 (18:18 +0000)]
Fix option desc in FunctionAttrs; NFC

Summary: The example in desc should match with actual option name

Reviewers: jmolloy

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

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

8 years agoScheduleDAGInstrs: Bug fix for missed memory dependency.
Geoff Berry [Wed, 6 Jan 2016 18:14:26 +0000 (18:14 +0000)]
ScheduleDAGInstrs: Bug fix for missed memory dependency.

Summary:
In buildSchedGraph(), when adding memory dependencies for loads, move
the call to adjustChainDeps() after the call to
addChainDependency(AliasChain) to handle the case where
addChainDependency(AliasChain) ends up not adding a dependency and
instead putting the SU on the RejectMemNodes list.  The call to
adjustChainDeps() must be done after the call to addChainDependency() in
order to process the SU added to the RejectMemNodes list to create
memory dependencies for it.

Reviewers: hfinkel, atrick, jonpa, resistor

Subscribers: mcrosier, llvm-commits

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

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

8 years ago[BasicAA] Extract WriteOnly predicate on parameters [NFC]
Philip Reames [Wed, 6 Jan 2016 18:10:35 +0000 (18:10 +0000)]
[BasicAA] Extract WriteOnly predicate on parameters [NFC]

Since writeonly is the only missing attribute and special case left for the memset/memcpy family of intrinsics, rearrange the code to make that much more clear.

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

8 years agoWebAssembly: add missing expected failures exposed by r256890
JF Bastien [Wed, 6 Jan 2016 17:08:56 +0000 (17:08 +0000)]
WebAssembly: add missing expected failures exposed by r256890

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