Commit Graph

80121 Commits

Author SHA1 Message Date
Craig Topper
2077fc4acf Give more meaningful names than I and J to some for loop variables after converting to range-based loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:45:10 +00:00
Craig Topper
2b6e06c46a Fix an unused variable warning in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:20:33 +00:00
Craig Topper
01fc7e7a0f Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 08:01:41 +00:00
Kostya Serebryany
762dbd0574 [lib/Fuzzer] doxygen-ify the comments for the user interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 02:12:05 +00:00
Duncan P. N. Exon Smith
b5f8c9b2ec AsmPrinter: Remove the vtable-entry from DIEValue
Remove all virtual functions from `DIEValue`, dropping the vtable
pointer from its layout.  Instead, create "impl" functions on the
subclasses, and use the `DIEValue::Type` to implement the dynamic
dispatch.

This is necessary -- obviously not sufficient -- for passing `DIEValue`s
around by value.  However, this change stands on its own: we make tons
of these.  I measured a drop in memory usage from 888 MB down to 860 MB,
or around 3.2%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238084 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:45:07 +00:00
Duncan P. N. Exon Smith
804c199b75 CodeGen: Remove redundant DIETypeSignature::dump(), NFC
We already have this in `DIEValue`; no reason to shadow it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238082 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:26:26 +00:00
Kostya Serebryany
d434a0a1b2 [lib/Fuzzer] fully get rid of std::cerr in libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:22:35 +00:00
Akira Hatanaka
01461204b3 Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.
This is part of the work to remove TargetMachine::resetTargetOptions.

In this patch, instead of updating global variable NoFramePointerElim in
resetTargetOptions, its use in DisableFramePointerElim is replaced with a call
to TargetFrameLowering::noFramePointerElim. This function determines on a
per-function basis if frame pointer elimination should be disabled.

There is no change in functionality except that cl:opt option "disable-fp-elim"
can now override function attribute "no-frame-pointer-elim". 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238080 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:14:08 +00:00
Akira Hatanaka
c17da7166d Simplify and rename function overrideFunctionAttributes. NFC.
This is in preparation to making changes needed to stop resetting
NoFramePointerElim in resetTargetOptions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238079 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:12:26 +00:00
Kostya Serebryany
4ea4cb3197 [lib/Fuzzer] start getting rid of std::cerr. Sadly, these parts of C++ library used in libFuzzer badly interract with the same code used in the target function and also with dfsan. It's easier to just not use std::cerr than to defeat these issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 01:07:46 +00:00
Rafael Espindola
58bf2827d3 Revert "make reciprocal estimate code generation more flexible by adding command-line options"
This reverts commit r238051.

It broke some bots:

http://lab.llvm.org:8011/builders/llvm-ppc64-linux1/builds/18190

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-23 00:22:44 +00:00
Rafael Espindola
7c4f3dcc5e Produce a single string table in a ELF .o
Normally an ELF .o has two string tables, one for symbols, one for section
names.

With the scheme of naming sections like ".text.foo" where foo is a symbol,
there is a big potential saving in using a single one.

Building llvm+clang+lld with master and with this patch the results were:

master:                          193,267,008 bytes
patch:                           186,107,952 bytes
master non unique section names: 183,260,192 bytes
patch non unique section names:  183,118,632 bytes

So using non usique saves 10,006,816 bytes, and the patch saves 7,159,056 while
still using distinct names for the sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:58:30 +00:00
Philip Reames
e00c0df2c4 Extend EarlyCSE to handle basic cases from JumpThreading and CVP
This patch extends EarlyCSE to take advantage of the information that a controlling branch gives us about the value of a Value within this and dominated basic blocks. If the current block has a single predecessor with a controlling branch, we can infer what the branch condition must have been to execute this block. The actual change to support this is downright simple because EarlyCSE's existing scoped hash table logic deals with most of the complexity around merging.

The patch actually implements two optimizations.
1) The first is analogous to JumpThreading in that it enables EarlyCSE's CSE handling to fold branches which are exactly redundant due to a previous branch to branches on constants. (It doesn't actually replace the branch or change the CFG.) This is pretty clearly a win since it enables substantial CFG simplification before we start trying to inline.
2) The second is analogous to CVP in that it exploits the knowledge gained to replace dominated *uses* of the original value. EarlyCSE does not otherwise reason about specific uses, so this is the more arguable one. It does enable further simplication and constant folding within the rest of the visit by EarlyCSE.

In both cases, the added code only handles the easy dominance based case of each optimization. The general case is deferred to the existing passes.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:53:24 +00:00
David Majnemer
12baade498 [InstCombine] Don't eagerly propagate nsw for A*B+A*C => A*(B+C)
InstCombine transforms A *nsw B +nsw A *nsw C to A *nsw (B + C).
This is incorrect -- e.g. if A = -1, B = 1, C = INT_SMAX. Then
nothing in the LHS overflows, but the multiplication in RHS overflows.

We need to first make sure that we won't multiple by INT_SMAX + 1.

Test case `add_of_mul` contributed by Sanjoy Das.

This fixes PR23635.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238066 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:02:11 +00:00
Kostya Serebryany
464deacf05 [lib/Fuzzer] remove -use_coverage_pairs=1, an experimental feature that is unlikely to ever scale
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238063 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:47:03 +00:00
Kostya Serebryany
ebada2c2bc [lib/Fuzzer] extend the fuzzer interface to allow user-supplied mutators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238059 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 22:35:31 +00:00
Ahmed Bougacha
d8319655f2 [AArch64][CGP] Sink zext feeding stxr/stlxr into the same block.
The usual CodeGenPrepare trickery, on a target-specific intrinsic.
Without this, the expansion of atomics will usually have the zext
be hoisted out of the loop, defeating the various patterns we have
to catch this precise case.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:37:17 +00:00
Sanjay Patel
7e80a67d35 make reciprocal estimate code generation more flexible by adding command-line options
This patch adds a class for processing many recip codegen possibilities.
The TargetRecip class is intended to handle both command-line options to llc as well
as options passed in from a front-end such as clang with the -mrecip option.

The x86 backend is updated to use the new functionality.
Only -mcpu=btver2 with -ffast-math should see a functional change from this patch.
All other CPUs continue to *not* use reciprocal estimates by default with -ffast-math.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238051 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 21:10:06 +00:00
Renato Golin
0ceb20d6f4 Reinforce ARMTargetParser::getCanonicalArchName validation
Before, getCanonicalArchName was relying on parseArch() to validate the arch
name, which was a problem when other methods, that also needed to call it,
were duplicating the steps.

But to dissociate getCanonicalArchName from parseArch, we needed to make
getCanonicalArchName more robust in detecting valid arch names. It's still
not perfect, but will do for the time being, until we merge Triple with
TargetParser into a TargetDescription mega class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 20:43:30 +00:00
Chad Rosier
157fbac534 Use new MachineInstr mayLoadOrStore() API. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238044 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 20:07:34 +00:00
Alexei Starovoitov
1fd101c86d [bpf] emit jmp fixups in little endian
The 'off' field of 'struct bpf_insn' is in cpu-endianness,
since the rest is emitted as little endian, make sure
that 'off' field is little endian as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238038 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:47:33 +00:00
Renato Golin
84b1a805bb Adding profile and version parsers to ARMTargetParser
This allows us to match armv6m to default to thumb, but will also be used by
Clang's driver and remove the current incomplete copy in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:17:55 +00:00
Quentin Colombet
57cc146595 Reapply r238011 with a fix for the trap instruction.
The problem was that I slipped a change required for shrink-wrapping, namely I
used getFirstTerminator instead of the getLastNonDebugInstr that was here before
the refactoring, whereas the surrounding code is not yet patched for that.

Original message:
[X86] Refactor the prologue emission to prepare for shrink-wrapping.

- Add a late pass to expand pseudo instructions (tail call and EH returns).
 Instead of doing it in the prologue emission.
- Factor some static methods in X86FrameLowering to ease code sharing.

NFC.

Related to <rdar://problem/20821487>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238035 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 18:10:47 +00:00
Chandler Carruth
15fe7cf70f [Unroll] Separate the logic for testing each iteration of the loop,
accumulating estimated cost, and other loop-centric logic from the logic
used to analyze instructions in a particular iteration.

This makes the visitor very narrow in scope -- all it does is visit
instructions, update a map of simplified values, and return whether it
is able to optimize away a particular instruction.

The two cost metrics are now returned as an optional struct. When the
optional is left unengaged, there is no information about the unrolled
cost of the loop, when it is engaged the cost metrics are available to
run against the thresholds.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238033 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 17:41:35 +00:00
Bill Schmidt
490d207be4 [PPC64] Add support for clrbhrb, mfbhrbe, rfebb.
This patch adds support for the ISA 2.07 additions involving the
branch history rolling buffer and event-based branching.  These will
not be used by typical applications, so built-in support is not
required.  They will only be available via inline assembly.

Assembly/disassembly tests are included in the patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238032 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 16:44:10 +00:00
Rafael Espindola
7b677dd986 Stop inventing symbol sizes.
MachO and COFF quite reasonably only define the size for common symbols.

We used to try to figure out the "size" by computing the gap from one symbol to
the next.

This would not be correct in general, since a part of a section can belong to no
visible symbol (padding, private globals).

It was also really expensive, since we would walk every symbol to find the size
of one.

If a caller really wants this, it can sort all the symbols once and get all the
gaps ("size") in O(n log n) instead of O(n^2).

On MachO this also has the advantage of centralizing all the checks for an
invalid n_sect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:43:00 +00:00
Rafael Espindola
cc3f1db34c Detect invalid section indexes when we first read them.
We still detect the same errors, but now we do it earlier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238024 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 14:59:27 +00:00
John Brawn
8a95a5095d [ARM] Fix typo in subtarget feature list for 7em triple
The list of subtarget features for the 7em triple contains 't2xtpk',
which actually disables that subtarget feature. Correct that to
'+t2xtpk' and test that the instructions enabled by that feature do
actually work.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 14:16:22 +00:00
NAKAMURA Takumi
25103832b2 Reapply part of r237975, "Fix Clang -Wmissing-override warning", except for DIContext.h, to apease g++-4.7.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 10:11:07 +00:00
Tamas Berghammer
c189633586 Revert "[X86] Fix a variable name for r237977 so that it works with every compilers."
Revert "[X86] Refactor the prologue emission to prepare for shrink-wrapping."

This reverts commit 6b3b93fc8b.
This reverts commit ab0b15dff8.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 10:01:56 +00:00
Puyan Lotfi
d9a08b08ac Compile time improvements to VirtRegRewriter.
This change to VirtRegRewriter::addMBBLiveIns adds live-in registers for each
MachineBasicBlock's LiveIns set without isLiveIn checks as they are being added
because doing so is expensive. After all live-in registers are added, the LiveIn
vectors are sorted and uniqued.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 08:11:26 +00:00
NAKAMURA Takumi
b6b98c12d5 Revert r237954, "Resubmit r237708 (MIR Serialization: print and parse LLVM IR using MIR format)."
It brought cyclic dependencies between LLVMCodeGen and LLVMMIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238007 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 07:17:07 +00:00
Duncan P. N. Exon Smith
f5e0674d06 MC: Shave a pointer off of MCSymbol::Name
Shave a pointer off of `MCSymbolName` by storing `StringMapEntry<bool>*`
instead of `StringRef`.  This brings `sizeof(MCSymbol)` down to 64 on
64-bit platforms, a nice round number.  My profile showed memory
dropping from 914 MB down to 908 MB, roughly 0.7%.  Other than memory
usage, no functionality change here.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238005 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 06:04:42 +00:00
Tobias Grosser
b7888bd5ea Revert "Fix Clang -Wmissing-override warning"
This reverts commit r237975. This seems also to break with gcc 4.7

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 06:01:04 +00:00
Duncan P. N. Exon Smith
6c3a7cbe54 MC: Lift MCSymbolData::Index up to MCSymbol::Index, NFC
Lift `MCSymbolData::Index` up a level to `MCSymbol`, as preparation for
packing it into the bitfield in `MCSymbol`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:54:01 +00:00
Duncan P. N. Exon Smith
ec8c491a06 SDAG: Give SDDbgValues their own allocator (and reset it)
Previously `SDDbgValue`s used the general allocator that lives for all
of `SelectionDAG`.  Instead, give them their own allocator, and reset it
whenever `SDDbgInfo::clear()` is called, plugging a spiritual leak.

This drops `SelectionDAGBuilder::visitIntrinsicCall()` off of my heap
profile (was at around 2% of `llc` for codegen of `-flto -g`).  Thanks
to Pete Cooper for spotting the problem and suggesting the fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:45:19 +00:00
Duncan P. N. Exon Smith
73993abb6c SDAG: Cleanup initialization of SDDbgValue, NFC
Cleanup how `SDDbgValue` is initialized, and rearrange the fields to
save two pointers in the struct layout.  No real functionality change
though (and I doubt the memory savings would show up in a profile).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237997 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 05:35:53 +00:00
David Majnemer
fe0d65bcc6 [InstSimplify] Handle some overflow intrinsics in InstSimplify
This change does a few things:
- Move some InstCombine transforms to InstSimplify
- Run SimplifyCall from within InstCombine::visitCallInst
- Teach InstSimplify to fold [us]mul_with_overflow(X, undef) to 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:56:46 +00:00
Chandler Carruth
edcdc5cb6a [Unroll] Replace a hand-wavy FIXME with a FIXME that explains the actual
problem instead of suggesting doing something that is trivial to do but
incorrect given the current design of the libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:07:28 +00:00
Chandler Carruth
f5ed85b2c8 [Unroll] Extract the logic for caching SCEV-modeled GEPs with their
simplified model for use simulating each iteration into a separate
helper function that just returns the cache.

Building this cache had nothing to do with the rest of the unroll
analysis and so this removes an unnecessary coupling, etc. It should
also make it easier to think about the concept of providing fast cached
access to basic SCEV models as an orthogonal concept to the overall
unroll simulation.

I'd really like to see this kind of caching logic folded into SCEV
itself, it seems weird for us to provide it at this layer rather than
making repeated queries into SCEV fast all on their own.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 03:02:22 +00:00
Chandler Carruth
9233137390 [Unroll] Refactor the accumulation of optimized instruction costs into
a single location.

This reduces code duplication a bit and will also pave the way for
a better separation between the visitation algorithm and the unroll
analysis.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237990 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 02:47:29 +00:00
Philip Reames
2c78f9499c [LICM] Sinking doesn't involve the preheader
PR23608 pointed out that using the preheader to gain a context instruction isn't always legal because a loop might not have a preheader.  When looking into that, I realized that using the preheader to determine legality for sinking is questionable at best.  Given no test covers that case and the original commit didn't seem to intend it, I restructured the code to only ask context sensative queries for hoising of loads and stores.  This is effectively a partial revert of 237593.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237985 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 02:14:05 +00:00
Hans Wennborg
253c092e56 Revert r236894 "[BasicAA] Fix zext & sext handling"
This seems to have caused PR23626: Clang miscompiles webkit's base64 decoder

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237984 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 01:27:37 +00:00
Quentin Colombet
6b3b93fc8b [X86] Fix a variable name for r237977 so that it works with every compilers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 00:41:03 +00:00
Daniel Berlin
4ea24c84fb MergedLoadStoreMotion preserves MemoryDependenceAnalysis, it does not require it.
(It already was coded assuming it can sometimes be null, so no other changes are necessary)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 00:13:05 +00:00
Quentin Colombet
ab0b15dff8 [X86] Refactor the prologue emission to prepare for shrink-wrapping.
- Add a late pass to expand pseudo instructions (tail call and EH returns).
  Instead of doing it in the prologue emission.
- Factor some static methods in X86FrameLowering to ease code sharing.

NFC.

Related to <rdar://problem/20821487>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 00:12:31 +00:00
David Blaikie
a89d43a2ce Fix Clang -Wmissing-override warning
& remove the duplication by introducing a CRTP base to implement the
clone behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 00:00:00 +00:00
Hal Finkel
afcd3e68a8 [PPC] Correct iterator bug in PPCTLSDynamicCall
Unfortunately, I can't reduce a small test case for this (although compiling
mpfr-3.1.2 with -O2 -mcpu=a2 would fairly reliably trigger a crash), but the
problem is fairly clear (at least once you know you're looking for one). If the
TLS instruction being replaced was at the end of the block, we'd increment the
iterator past it (so it would then point to MBB.end()), and then we'd increment
it again as part of the for statement, thus overrunning the end of the list.
Don't do that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:45:49 +00:00
Peter Collingbourne
66811d9817 Revert r237590, "ARM: allow jump tables to be placed as constant islands."
Caused a miscompile of the Android port of Chromium, details
forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:20:55 +00:00
Jingyue Wu
41cf9ae1b8 [NaryReassoc] reassociate GEP for CSE
Summary:
x = &a[i];
y = &a[i + j];

=>

y = x + j;

along with some refactoring work such as extracting method
findClosestMatchingDominator.

Depends on D9786 which provides the ScalarEvolution::getGEPExpr interface.

Test Plan: nary-gep.ll

Reviewers: meheff, broune

Reviewed By: broune

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:17:30 +00:00
David Majnemer
41af60bdc0 [InstCombine] X - 0 is equal to X, not undef
A refactoring made @llvm.ssub.with.overflow.i32(i32 %X, i32 0) transform
into undef instead of %X.

This fixes PR23624.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237968 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 23:04:21 +00:00
Pete Cooper
1052042adf Use Op<0> accessor instead of OperandList for Instructions. NFC
This is consistent with other uses of the operand list.  I'm planning a future commit where this will actually matter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 22:48:54 +00:00
Chad Rosier
d525214b96 Use new MachineInstr mayLoadOrStore() API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237965 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:59:57 +00:00
Quentin Colombet
3ad083f2cb [InlineSpiller] Fix rematerialization for bundles.
Prior to this patch, we could update the operand of another MI in the same
bundle.

Longer version:
Before InlineSpiller rematerializes a vreg, it iterates over operands of each MI
in a bundle, collecting all (MI, OpNo) pairs that reference that vreg.

Then if it does rematerialize, it goes through the pair list and replaces the
operands with the new (rematerialized) vreg.  The problem is, it tries to
replace all of these operands in the main MI ! This works fine for single MIs.
However, if we are processing a bundle of MIs and the list contains multiple
pairs - the rematerialization will either crash trying to access a non-existing
operand of the main MI, or silently corrupt one of the existing ones. It will
also ignore other MIs in the bundle.

The obvious fix is to use the MI pointers saved in collected (MI, OpNo) pairs.
This must have been the original intent of the pair list but somehow these
pointers got lost.

Patch by Dmitri Shtilman <dshtilman@icloud.com>!

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

<rdar://problem/21002163>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237964 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:41:55 +00:00
Chad Rosier
676efa4d56 [AArch64] Enhance the load/store optimizer with target-specific alias analysis.
Phabricator: http://reviews.llvm.org/D9863

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237963 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:36:46 +00:00
Sanjay Patel
a33f5160eb fix typo in comment; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237962 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:29:13 +00:00
Keno Fischer
b6976af3cd Make it easier to use DwarfContext with MCJIT
Summary:
This supersedes http://reviews.llvm.org/D4010, hopefully properly
dealing with the JIT case and also adds an actual test case.
DwarfContext was basically already usable for the JIT (and back when
we were overwriting ELF files it actually worked out of the box by
accident), but in order to resolve relocations correctly it needs
to know the load address of the section.
Rather than trying to get this out of the ObjectFile or requiring
the user to create a new ObjectFile just to get some debug info,
this adds the capability to pass in that info directly.
As part of this I separated out part of the LoadedObjectInfo struct
from RuntimeDyld, since it is now required at a higher layer.

Reviewers: lhames, echristo

Reviewed By: echristo

Subscribers: vtjnash, friss, rafael, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237961 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:24:32 +00:00
David Blaikie
6777be3446 Put GEPOperator member function definition in the appropriate .cpp file
Last commit put it in Constants.cpp instead of Operator.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:17:12 +00:00
David Blaikie
bd75a9292e [opaque pointer type] Allow gep_type_iterator to work with the pointee type from the GEP instruction
The raw non-instruction/constant form of this is still relying on being
able to access the pointee type from a pointer type - those will be
cleaned up later. For now, just focus on the cases where the pointee
type is easily accessible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237958 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:12:43 +00:00
Rafael Espindola
477acf64d0 Stop forwarding (get|set)Aligment from MCSectionData to MCSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237956 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 21:02:35 +00:00
Alex Lorenz
3e5034d130 Resubmit r237708 (MIR Serialization: print and parse LLVM IR using MIR format).
This commit is a 2nd attempt at committing the initial MIR serialization patch.
The first commit (r237708) made the incremental buildbots unstable and was 
reverted in r237730. The original commit didn't add a terminating null 
character to the LLVM IR source which was passed to LLParser, and this 
sometimes caused the test 'llvmIR.mir' to fail with a parsing error because 
the LLVM IR source didn't have a null character immediately after the end 
and thus LLLexer encountered some garbage characters that ultimately caused 
the error.

This commit also includes the other test fixes I committed in
r237712 (llc path fix) and r237723 (remove target triple) which
also got reverted in r237730.

--Original Commit Message--

MIR Serialization: print and parse LLVM IR using MIR format.

This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR 
using the MIR format. This pass is then added as a last pass when a 
'stop-after' option is used in llc. The new library adds the initial 
functionality for parsing of MIR files as well. This commit also 
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:54:45 +00:00
Bill Schmidt
63292d1bba [PPC64] Handle vpkudum mask pattern correctly when vpkudum isn't available
My recent patch to add support for ISA 2.07 vector pack/unpack
instructions didn't properly check for availability of the vpkudum
instruction when recognizing it as a special vector shuffle case.
This causes us to leave the vector shuffle in place (rather than
converting it to a vector permute) so that it can be recognized later
as a vpkudum, but that pattern is invalid for processors prior to
POWER8.  Thus LLVM crashes with an "unable to select" message.  We
observed this since one of our buildbots is configured to generate
code for a POWER7.

This patch fixes the problem by checking for availability of the
vpkudum instruction during custom lowering of vector shuffles.

I've added a test case variant for the vpkudum pattern when the
instruction isn't available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:48:49 +00:00
Rafael Espindola
fabbc4985b Stop creating MCSectionData is the ELF writer.
Now is is just its use of MCSymbolData that requires it to take a non const
MCAssembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237951 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:43:13 +00:00
Kostya Serebryany
c9389db422 [lib/Fuzzer] ignore flags that start with --; use git pull --rebase instead of just git pull
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:39:13 +00:00
Adrian Prantl
849c7601a0 IR / debug info: Add a DWOId field to DICompileUnit,
so DWARF skeleton CUs can be expression in IR. A skeleton CU is a
(typically empty) DW_TAG_compile_unit that has a DW_AT_(GNU)_dwo_name and
a DW_AT_(GNU)_dwo_id attribute. It is used to refer to external debug info.

This is a prerequisite for clang module debugging as discussed in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-November/040076.html.
In order to refer to external types stored in split DWARF (dwo) objects,
such as clang modules, we need to emit skeleton CUs, which identify the
dwarf object (i.e., the clang module) by filename (the SplitDebugFilename)
and a hash value, the dwo_id.

This patch only contains the IR changes. The idea is that a CUs with a
non-zero dwo_id field will be emitted together with a DW_AT_GNU_dwo_name
and DW_AT_GNU_dwo_id attribute.

http://reviews.llvm.org/D9488
rdar://problem/20091852

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:37:30 +00:00
Hal Finkel
5368a26e16 [PPC/LoopUnrollRuntime] Don't avoid high-cost trip count computation on the PPC/A2
On X86 (and similar OOO cores) unrolling is very limited, and even if the
runtime unrolling is otherwise profitable, the expense of a division to compute
the trip count could greatly outweigh the benefits. On the A2, we unroll a lot,
and the benefits of unrolling are more significant (seeing a 5x or 6x speedup
is not uncommon), so we're more able to tolerate the expense, on average, of a
division to compute the trip count.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237947 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 20:30:23 +00:00
Rafael Espindola
3b294b5753 writeSymbolTable now only needs a MCContext.
It used to use an MCAssembler just to record the alignment of the sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:54:44 +00:00
Rafael Espindola
9a9984d0b5 Pass a const MCAssembler to writeSectionHeader.
It never creates sections, so it can use Asm.getSectionData instead of
Asm.getOrCreateSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:46:39 +00:00
Alex Lorenz
802ab073da YAML: Null terminate block scalar's value.
The commit null terminates the string value in the `yaml::BlockScalarNode`
class.

This change is motivated by the initial MIR serialization commit (r237708)
that I reverted in r237730 because the LLVM IR source from the block
scalar node wasn't terminated by a null character and thus the buildbots
failed on one testcase sometimes. This change enables me to recommit 
the reverted commit. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237942 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:45:02 +00:00
Rafael Espindola
a127bd0585 Remove unused argument. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:42:35 +00:00
Derek Schuff
493bc7e300 Fix StreamingMemoryObject to respect known object size.
The existing code for method StreamingMemoryObject.fetchToPos does not respect
the corresonding call to setKnownObjectSize(). As a result, it allows the
StreamingMemoryObject to read bytes past the object size.

This patch provides a test case, and code to fix the problem.

Patch by Karl Schimpf
Differential Revision: http://reviews.llvm.org/D8931

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237939 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:40:19 +00:00
Rafael Espindola
ad7c1174c7 Fetch alignment directly out of MCSection. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237938 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:36:43 +00:00
Nemanja Ivanovic
24ed4de261 Add support for VSX scalar single-precision arithmetic in the PPC target
http://reviews.llvm.org/D9891
Following up on the VSX single precision loads and stores added earlier, this
adds support for elementary arithmetic operations on single precision values
in VSX registers. These instructions utilize the new VSSRC register class.
Instructions added:
xsaddsp
xsdivsp
xsmulsp
xsresp
xsrsqrtesp
xssqrtsp
xssubsp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:32:49 +00:00
Rafael Espindola
7521964d28 Move alignment from MCSectionData to MCSection.
This starts merging MCSection and MCSectionData.

There are a few issues with the current split between MCSection and
MCSectionData.

* It optimizes the the not as important case. We want the production
of .o files to be really fast, but the split puts the information used
for .o emission in a separate data structure.

* The ELF/COFF/MachO hierarchy is not represented in MCSectionData,
leading to some ad-hoc ways to represent the various flags.

* It makes it harder to remember where each item is.

The attached patch starts merging the two by moving the alignment from
MCSectionData to MCSection.

Most of the patch is actually just dropping 'const', since
MCSectionData is mutable, but MCSection was not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 19:20:38 +00:00
Benjamin Kramer
4c919af335 [LoopDistribute] Remove a layer of pointer indirection.
Just store InstPartitions directly into the std::list. No functional change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237930 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 18:32:07 +00:00
Sanjay Patel
430cdabf46 use range-based for-loops; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:43:26 +00:00
Sanjay Patel
090f1dedf0 use range-based for-loops; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237917 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:22:45 +00:00
Rafael Espindola
921229e74e Fix warning on builds without asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:09:22 +00:00
Sanjay Patel
7d83b1223c use range-based for-loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237914 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:04:17 +00:00
Rafael Espindola
e0376b0782 Avoid unnecessary section switching. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237913 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 17:00:40 +00:00
Rafael Espindola
43356a1a45 Remove yet another method of creating begin and end symbol for sections.
I missed this one when first unifying how we handle begin and end symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237912 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 16:52:32 +00:00
Rafael Espindola
f209e26fcc Use existing helper for adding a section. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237909 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 16:19:32 +00:00
Sanjay Patel
57f70578fa use range-based for-loop; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237908 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 16:00:50 +00:00
Manuel Klimek
2267264ceb std::sort must be called with a strict weak ordering.
Found by a debug enabled stl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237906 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 15:38:25 +00:00
Elena Demikhovsky
86425451e5 AVX-512: Enabled SSE intrinsics on AVX-512.
Predicate UseAVX depricates pattern selection on AVX-512.
This predicate is necessary for DAG selection to select EVEX form.
But mapping SSE intrinsics to AVX-512 instructions is not ready yet.
So I replaced UseAVX with HasAVX for intrinsics patterns.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 14:01:32 +00:00
Renato Golin
b6ea67e027 Make Triple::parseARMArch use ARMTargetParser
Simplifying Triple::parseARMArch, leaving all the parsing to ARMTargetParser.

This commit also adds AArch64 detection to ARMTargetParser canonicalization,
and a two RedHat arch names (v{6,7}hl, meaning hard-float / little-endian).

Adding enough unit tests to cover the basics. Clang checks fine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237902 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 13:52:20 +00:00
Igor Laevsky
897d9bccdc [RewriteStatepointsForGC] Fix debug assertion during derivable pointer rematerialization
Correct assertion would be that there is no other uses from chain we are currently cloning. It is ok to have other uses of values not from this chain.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 13:02:14 +00:00
Artur Pilipenko
946d5f5631 Test commit. Fix typo in MemDerefPrinter.cpp comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237893 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 11:57:38 +00:00
Renato Golin
a9a920d652 Remove unnecessary FIXME comment
It has been fixed by commit r237797.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237890 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 10:47:56 +00:00
Simon Pilgrim
41c749a31f Fixed unused variable warning in non-assert builds from rL237885
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237889 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 10:22:10 +00:00
Simon Pilgrim
87d1836793 [X86][SSE] Improve support for 128-bit vector sign extension
This patch improves support for sign extension of the lower lanes of vectors of integers by making use of the SSE41 pmovsx* sign extension instructions where possible, and optimizing the sign extension by shifts on pre-SSE41 targets (avoiding the use of i64 arithmetic shifts which require scalarization).

It converts SIGN_EXTEND nodes to SIGN_EXTEND_VECTOR_INREG where necessary, that more closely matches the pmovsx* instruction than the default approach of using SIGN_EXTEND_INREG which splits the operation (into an ANY_EXTEND lowered to a shuffle followed by shifts) making instruction matching difficult during lowering. Necessary support for SIGN_EXTEND_VECTOR_INREG has been added to the DAGCombiner.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 10:05:03 +00:00
Hal Finkel
80bb2d981d [TableGen] Resolve complex def names inside multiclasses
We had not been trying hard enough to resolve def names inside multiclasses
that had complex concatenations, etc. Now we'll try harder.

Patch by Amaury Sechet!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237877 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 04:32:56 +00:00
Duncan P. N. Exon Smith
583dac827c AsmPrinter: Compute absolute label difference directly
Create a low-overhead path for `EmitLabelDifference()` that emits a
emits an absolute number when (1) the output is an object stream and (2)
the two symbols are in the same data fragment.

This drops memory usage on Mach-O from 975 MB down to 919 MB (5.8%).
The only call is when `!doesDwarfUseRelocationsAcrossSections()` --
i.e., on Mach-O -- since otherwise an absolute offset from the start of
the section needs a relocation.  (`EmitLabelDifference()` is cheaper on
ELF anyway, since it creates 1 fewer temp symbol, and it gets called far
less often.  It's not clear to me if this is even a bottleneck there.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237876 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 02:41:23 +00:00
Ahmed Bougacha
8eca988b00 [MemCpyOpt] Do move the memset, but look at its dest's dependencies.
In effect a partial revert of r237858, which was a dumb shortcut.
Looking at the dependencies of the destination should be the proper
fix: if the new memset would depend on anything other than itself,
the transformation isn't correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237874 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 01:43:39 +00:00
Duncan P. N. Exon Smith
4652459f64 MC: Simplify MCSymbolData initialization and remove MCSymbol pointer
Finally remove the `MCSymbolData::Symbol` pointer.  It was still being
used to track whether `MCSymbolData` had been initialized, but this is
better tracked by the bitfield in `MCSymbol`.

The only caller of `MCSymbolData::initialize()` was `MCAssembler`, which
(other than `Symbol`) passed in all-0 values.  Replace all that
indirection with a default constructor.

The main point is a cleanup (and there's more cleanup to do), but there
are also some small memory savings.  I measured ~989 MB down to ~975 MB,
cutting a little over 1% off the top of `llc`.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237873 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 01:33:03 +00:00
Duncan P. N. Exon Smith
aa87ff8440 MC: Remove last use of MCSymbolData::getSymbol(), NFC
Remove the last use of `MCSymbolData::getSymbol()`.  There's some
*really* hairy stuff going on in `MachObjectWriter::WriteNList()` that I
want to come back to.  In particular, it updates `Symbol` to point at
its aliasee (if any), but leaves `Data` behind, and it's not clear
whether everything makes sense there.

For now I've left the logic unchanged by adding `OrigSymbol` and moving
the FIXME from r237750 up a bit higher.  I've filed PR23598 to track
looking into this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237867 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 00:39:24 +00:00
Ahmed Bougacha
d591505d9f [MemCpyOpt] Pass Instruction to IRBuilder, no need for NextNode. NFC.
We're erasing the instructions anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 00:08:35 +00:00
David Blaikie
47ee653cdc [opaque pointer type] Pass explicit pointee type in another case of GEP constant folding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237860 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-21 00:06:38 +00:00
Andrew Kaylor
f12338a6b7 Fix build error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237859 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:58:44 +00:00
Ahmed Bougacha
6d1485e974 [MemCpyOpt] Don't move the memset when optimizing memset+memcpy.
Fixes PR23599, another miscompile introduced by r235232: when there is
another dependency on the destination of the created memset (i.e., the
part of the original destination that the memcpy doesn't depend on)
between the memcpy and the original memset, we would insert the created
memset after the memcpy, and thus after the other dependency.

Instead, insert the created memset right after the old one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237858 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:55:16 +00:00
Andrew Kaylor
008a1efecf Fix build warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237855 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:28:03 +00:00
Andrew Kaylor
d0f4ffa472 [WinEH] C++ EH state numbering fixes
Differential Revision: http://reviews.llvm.org/D9787



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237854 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:22:24 +00:00
Reid Kleckner
7681f6a1b0 [WinEH] Store pointers to the LSDA in the exception registration object
We aren't yet emitting the LSDA yet, so this will still fail to
assemble.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237852 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 23:08:04 +00:00
Pete Cooper
05b0f7dc93 Don't generate comments in the DebugLocStream unless required. NFC.
The ByteStreamer here wasn't taking account of whether the asm streamer was text based and verbose.  Only with that combination should we emit comments.

This change makes sure that we only actually convert a Twine to a string using Twine::str() if we need the comment.  This saves about 10000 small allocations on a test case involving the verify-use_list-order bitcode going through llc with debug info.

Note, this is NFC as the comments would ultimately never be emitted unless required.

Reviewed by Duncan Exon Smith and David Blaikie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 22:51:27 +00:00
Pete Cooper
d4483d4512 Revert "Add bool to DebugLocDwarfExpression to control emitting comments."
This reverts commit 0037b6bcbc874aa1b93d7ce3ad8dba3753ee2d9d (r237827).

David Blaikie suggested some alternatives to this which are better.  Reverting to apply a better solution later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 22:37:48 +00:00
Hans Wennborg
fa13c712af Revert r237828 "[X86] Remove unused node after morphing it from shr to and."
This caused assertions during DAG combine: PR23601.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237843 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 22:31:55 +00:00
David Blaikie
14a714f727 [opaque pointer type] Pass explicit type to Load instruction creation in AutoUpgrade
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 21:46:30 +00:00
Davide Italiano
e677c7bd22 [Target/ARM] Only enable OptimizeBarrierPass at -O1 and above.
Ideally this is going to be and LLVM IR pass (shared, among others
with AArch64), but for the time being just enable it if consumers
ask us for optimization and not unconditionally.

Discussed with Tim Northover on IRC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237837 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 21:40:38 +00:00
Alex Lorenz
3f1b2bdf5d AsmParser: Require a terminating null character when creating memory buffer.
This commit modifies the memory buffer creation in the AsmParser library so 
that it requires a terminating null character. The LLLexer in the AsmParser
library checks for EOF only when it sees a null character, thus it would
be best to require it when creating a memory buffer so that the memory
buffer constructor can verify that a terminating null character is indeed
present.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 20:41:27 +00:00
David Blaikie
e86ba4b571 [opaque pointer type] LoadInst: assert that the explicit type matches the implicit one
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 20:22:31 +00:00
Duncan P. N. Exon Smith
cfa5342444 MC: Remove most remaining uses of MCSymbolData::getSymbol(), NFC
Remove most remaining calls to `MCSymbolData::getSymbol()`, instead
using the already available `MCSymbol` directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237829 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 20:18:16 +00:00
Benjamin Kramer
644f1ff184 [X86] Remove unused node after morphing it from shr to and.
In some cases it won't get cleaned up properly leading to crashes
downstream. PR23353.

Based on a patch by Davide Italiano.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 20:10:26 +00:00
Pete Cooper
c212d49d75 Add bool to DebugLocDwarfExpression to control emitting comments.
DebugLocDwarfExpression::EmitOp was creating temporary strings by concatenating Twine's.

When emitting to object files, these comments are thrown away.

This commit adds a boolean to the constructor of the DwarfExpression to control whether it will actually emit
any comments.  This prevents it from even generating the temporary comments which would have been thrown away anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 19:50:03 +00:00
Duncan P. N. Exon Smith
96273f6cbe MC: Stop using MCSymbolData::getSymbol() in WinCOFF, NFC
Move APIs over from `MCSymbolData` to `MCSymbol`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237826 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 19:34:08 +00:00
Pete Cooper
bed96c8d97 Use a SmallString buffer instead of a std::string for debug info path lookup. NFC.
This code appends the filename to the directory then looks that up in a StringMap.  We should be using the existing Twine::toStringRef method instead of Twine::str() as most times we'll succeed in the lookup.

Its possible that we should also consider allowing StringMap to lookup a key using a Twine in addition to a StringRef but that would complicate the code with little known benefit above and beyond this change.

This saves 170k temporary allocations when running llc on the verify_use_list_order bitcode with debug info for x86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237823 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 19:12:14 +00:00
Matthias Braun
fa3d0dc026 DAGCombiner: Continue combining if FoldConstantArithmetic() fails.
DAG.FoldConstantArithmetic() can fail even though both operands are
Constants if OpaqueConstants are involved. Continue trying other combine
possibilities in tis case.

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

Somewhat related to PR21801 / rdar://19211454

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237822 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 18:54:02 +00:00
James Molloy
d594ba0815 Reapply r237539 with a fix for the Chromium build.
Make sure if we're truncating a constant that would then be sign extended
that the sign extension of the truncated constant is the same as the
original constant.

> Canonicalize min/max expressions correctly.
>
> This patch introduces a canonical form for min/max idioms where one operand
> is extended or truncated. This often happens when the other operand is a
> constant. For example:
>
> %1 = icmp slt i32 %a, i32 0
> %2 = sext i32 %a to i64
> %3 = select i1 %1, i64 %2, i64 0
>
> Would now be canonicalized into:
>
> %1 = icmp slt i32 %a, i32 0
> %2 = select i1 %1, i32 %a, i32 0
> %3 = sext i32 %2 to i64
>
> This builds upon a patch posted by David Majenemer
> (https://www.marc.info/?l=llvm-commits&m=143008038714141&w=2). That pass
> passively stopped instcombine from ruining canonical patterns. This
> patch additionally actively makes instcombine canonicalize too.
>
> Canonicalization of expressions involving a change in type from int->fp
> or fp->int are not yet implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 18:41:25 +00:00
Matthias Braun
ee15f86421 ARM: Fix comment and make it slightly more readable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237820 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 18:40:06 +00:00
Duncan P. N. Exon Smith
80b2cb6d4d MC: Use MCSymbol in LocalCommon, NFC
Switch from MCSymbolData to MCSymbol in LocalCommon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237816 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 18:25:40 +00:00
Pawel Bylica
12f6308247 Fix icmp lowering
Summary:
During icmp lowering it can happen that a constant value can be larger than expected (see the code around the change).
APInt::getMinSignedBits() must be checked again as the shift before can change the constant sign to positive.
I'm not sure it is the best fix possible though.

Test Plan: Regression test included.

Reviewers: resistor, chandlerc, spatel, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237812 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 17:21:09 +00:00
Pete Cooper
9584e07a9c Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC.
Now that Intrinsic::ID is a typed enum, we can forward declare it and so return it from this method.

This updates all users which were either using an unsigned to store it, or had a now unnecessary cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237810 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 17:16:39 +00:00
Duncan P. N. Exon Smith
91a675f972 MC: Add MCSymbolData back to MCAssembler dump
r237490 accidentally dropped MCSymbolData from the MCAssembler dump.
Add it back underneath the MCSymbol dump.  Remove the MCSymbol dump from
MCSymbolData, since this would cause an infinite co-recursion, and
besides, that back pointer is going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 16:34:36 +00:00
Duncan P. N. Exon Smith
20cf3f41e7 MC: Update MCAssembler to use MCSymbol, NFC
Use `MCSymbol` over `MCSymbolData` where both are needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237803 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 16:02:11 +00:00
Duncan P. N. Exon Smith
c8d166a437 MC: Use MCSymbol in MachObjectWriter, NFC
Replace uses of `MCSymbolData` with `MCSymbol` where both are needed, so
we can remove the backpointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 15:16:14 +00:00
Duncan P. N. Exon Smith
f5bdf04f09 MC: Use MCSymbol in MCObjectWriter::isWeak(), NFC
Continue to prefer `MCSymbol` when we need both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 15:10:03 +00:00
Renato Golin
8ca7ac2a38 Get Triple::getARMCPUForArch() to use TargetParser
First ARMTargetParser FIXME, conservatively changing the way we parse CPUs
in the back-end. Still not perfect, with a lot of special cases, but moving
towards a more generic solution.

Moving all logic to the target parser made some unwritten assumptions
about architectures in Clang to break. I've added a lot of architectures
required by Clang, and default to CPUs that Clang believes it should
(and I agree).

I've also added a lot of unit tests, with the correct CPU for each
architecture, and Clang seems to be working correctly, too.

It also became clear that using "unsigned ID" as the argument for the get
methods makes it hard to know what ID, so I also changed the argument names
to match the enum type names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237797 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 15:05:07 +00:00
Aaron Ballman
cc3dffb519 Silencing a -Wsign-compare warning; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 14:53:50 +00:00
Elena Demikhovsky
b65b24c0df AVX-512: fixed algorithm of building vectors of i1 elements
fixed extract-insert i1 element,
load i1, zextload i1 should be with "and $1, %reg" to prevent loading garbage.
added a bunch of new tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 14:32:03 +00:00
Daniel Sanders
a77462187f Revert r237789 - [mips] The naming convention for private labels is ABI dependant.
It works, but I've noticed that I missed several callers of createMCAsmInfo()
and many don't have a TargetMachine to provide.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237792 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 14:18:59 +00:00
Daniel Sanders
e1207bb8a2 [mips] The naming convention for private labels is ABI dependant.
Summary:
For N32/N64, private labels begin with '.L' but for O32 they begin with '$'.

MCAsmInfo now has an initializer function which can be used to provide information from the TargetMachine to control the assembly syntax.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: jfb, sandeep, llvm-commits, rafael

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237789 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 13:16:42 +00:00
Igor Laevsky
efab5a1dfa [StatepointLowering] Support of the gc.relocates for invoke statepoints.
This change implements support for lowering of the gc.relocates tied to the invoke statepoint.
This is acomplished by storing frame indices of the lowered values in "StatepointRelocatedValues" map inside FunctionLoweringInfo instead of storing them in per-basic block structure StatepointLowering.
After this change StatepointLowering is used only during "LowerStatepoint" call and it is not necessary to store it as a field in SelectionDAGBuilder anymore.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 11:37:25 +00:00
Toma Tabacu
362b8e5b52 [mips] [IAS] Factor out .set nomacro warning. NFC.
Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237780 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 08:54:45 +00:00
Craig Topper
43ec501d2c [TableGen] Make some variable names consistent with their type names and just generally consistent across all of the overloads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 05:40:13 +00:00
Craig Topper
ee25444b06 [TableGen] Fix a memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 05:40:09 +00:00
David Majnemer
349f0b12a4 [X86] Implement the local-exec TLS model for Windows targets
We know that _tls_index is zero for local-exec TLS variables because
they are always defined in the executable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 04:45:26 +00:00
Duncan P. N. Exon Smith
37e9aba0db MC: Use MCSymbol in most of ELFObjectWriter, NFC
Stop using MCSymbolData where we also need MCSymbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 04:39:01 +00:00
Swaroop Sridhar
95d08bce87 Add a GCStrategy for CoreCLR
This change adds a new GC strategy for supporting the CoreCLR runtime.

This strategy is currently identical to Statepoint-example GC, 
but is necessary for several upcoming changes specific to CoreCLR, such as:

1. Base-pointers not explicitly reported for interior pointers
2. Different format for stack-map encoding
3. Location of Safe-point polls: polls are only needed before loop-back edges and before tail-calls (not needed at function-entry)
4. Runtime specific handshake between calls to managed/unmanaged functions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237753 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 01:07:23 +00:00
Alexei Starovoitov
a6f501cb97 [bpf] fix build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 00:20:26 +00:00
Duncan P. N. Exon Smith
891fd53a90 MC: Take MCSymbol in MachObjectWriter::getSymbolAddress(), NFC
Pass through an `MCSymbol` instead of an `MCSymbolData` so we can get
rid of the back pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237750 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 00:02:39 +00:00
Duncan P. N. Exon Smith
e1fce8692d MC: Use MCSymbol in MCAsmLayout::getSymbolOffset(), NFC
Continue to canonicalize on MCSymbol instead of MCSymbolData when both
are needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:53:20 +00:00
Philip Reames
a5703bc52e [PlaceSafepoints] Stop special casing some intrinsics
We were special casing a handful of intrinsics as not needing a safepoint before them.  After running into another valid case - memset - I took a closer look and realized that almost no intrinsics need to have a safepoint poll before them.  Restructure the code to make that apparent so that we stop hitting these bugs.  The only intrinsics which need a safepoint poll before them are ones which can run arbitrary code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:40:11 +00:00
Hans Wennborg
c0f6113287 Revert r237539: "Reapply r237520 with another fix for infinite looping"
This caused PR23583.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237739 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 23:06:30 +00:00
Philip Reames
486f97bf19 Remove a stale comment
The todo was implemented a while ago; I just forgot to remove the comment.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237736 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 22:26:33 +00:00
Kostya Serebryany
556425f9a9 [lib/Fuzzer] change the meaning of -timeout flag: now timeout is applied to every unit of work separately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237735 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 22:12:57 +00:00
Alexey Samsonov
05f725eb67 [DWARF parser] Make DWARF parser more robust against missing compile/type units.
DWARF standard claims that each compilation/type unit header in
.debug_info/.debug_types section must be followed by corresponding
compile/type unit DIE, possibly with its children. Two situations
are possible:

 * compile/type unit DIE is missing because DWARF producer failed to
   emit it.
 * DWARF parser failed to parse unit DIE correctly, for instance if it
   contains some unsupported attributes (see r237721, for instance).

In either of these cases, the library, and the tools that use it
(llvm-dwarfdump, llvm-symbolizer) should not crash. Insert appropriate
checks to protect against this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:54:32 +00:00
Alex Lorenz
e5a723675b Revert r237708 (MIR serialization) - incremental buildbots became unstable.
The incremental buildbots entered a pass-fail cycle where during the fail
cycle one of the tests from this commit fails for an unknown reason. I
have reverted this commit and will investigate the cause of this problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:41:28 +00:00
Matthias Braun
dfc41dbcda MachineInstr: Remove unused parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 21:22:20 +00:00
Jingyue Wu
31d2ee7360 [Speculation] NFC: more header comments
explaining how it differs from SpeculativeExecuteBB in SimplifyCFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237724 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:52:45 +00:00
Pete Cooper
64b0d53256 Remove unnecessary cast. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237722 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:50:14 +00:00
Alexey Samsonov
4ca606f22f [DWARF parser] Add basic support for DWZ DWARF multifile extensions.
This change implements basic support for DWARF alternate sections
proposal: http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open

LLVM tools now understand new forms: DW_FORM_GNU_ref_alt and
DW_FORM_GNU_strp_alt, which are used as references to .debug_info and
.debug_str sections respectively, stored in a separate file, and
possibly shared between different executables / shared objects.

llvm-dwarfdump and llvm-symbolizer don't yet know how to access this
alternate debug file (usually pointed by .gnu_debugaltlink section),
but they can at lease properly parse and dump regular files, which
refer to it.

This change should fix crashes of llvm-dwarfdump and llvm-symbolizer on
files produced by running "dwz" tool. Such files are already installed
on some modern Linux distributions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:29:28 +00:00
Sanjoy Das
4d88c3ebad Dereferenceable, dereferenceable_or_null metadata for loads
Summary:
Introduce dereferenceable, dereferenceable_or_null metadata for loads
with the same semantic as corresponding attributes.

This patch depends on http://reviews.llvm.org/D9253

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: sanjoy, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237720 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:10:19 +00:00
Sanjay Patel
041ab65fcd use 'auto *' for pointers; clearer usage, no deep copying
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 20:10:16 +00:00
Sanjay Patel
0f9fcd22b3 tidy up
1. remove duplicate local variable
2. add local variable with name to match comment
3. remove useless comment



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237715 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 19:10:57 +00:00
Sanjay Patel
f75a247286 use range-based for-loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 18:24:33 +00:00
Alex Lorenz
328f462f3c MIR Serialization: print and parse LLVM IR using MIR format.
This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR 
using the MIR format. This pass is then added as a last pass when a 
'stop-after' option is used in llc. The new library adds the initial 
functionality for parsing of MIR files as well. This commit also 
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 18:17:39 +00:00
Matthias Braun
f7ad33bd8a RegisterCoalescer: Improve a comment.
Explain the relation of the example to the variables in the code,
explain what bad behaviour the code avoids in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 17:52:32 +00:00
Sanjay Patel
038aeda7cf use range-based for loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237705 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 17:49:14 +00:00
Igor Laevsky
92948b04c3 [RewriteStatepointsForGC] Fix up naming in "relocationViaAlloca" and run it through clang-format.
Differential Revision: http://reviews.llvm.org/D9774



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 16:29:43 +00:00
Wei Mi
51891f2364 Remove the InstructionSimplifierPass immediately after InstructionCombiningPass.
InstructionCombiningPass was added after LoopUnrollPass in r237395. Because
InstructionCombiningPass is strictly more powerful than InstructionSimplifierPass,
remove the unnecessary InstructionSimplifierPass.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237702 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 16:09:11 +00:00
Igor Laevsky
42737039d5 [RewriteStatepointsForGC] For some values (like gep's and bitcasts) it's cheaper to clone them after statepoint than to emit proper relocates for them. This change implements this logic. There is alredy similar optimization in CodeGenPrepare, but doing so during RewriteStatepointsForGC allows to capture more opprtunities such as relocates in loops and longer instruction chains.
Differential Revision: http://reviews.llvm.org/D9774



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 15:59:05 +00:00
Zoran Jovanovic
70d1005bbd [mips][microMIPSr6] Implement NOR, OR, ORI, XOR and XORI instructions
Differential Revision: http://reviews.llvm.org/D8800


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237697 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 14:12:55 +00:00
Zoran Jovanovic
94ddfe5e09 [mips][microMIPSr6] Implement AND and ANDI instructions
Differential Revision: http://reviews.llvm.org/D8772


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 13:32:31 +00:00
Yaron Keren
f1ed587ebf Rangify for loop in Cleanup(), NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 13:32:19 +00:00
Yaron Keren
add5ea661a Prevent Cleanup() from running more than once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237694 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 13:31:25 +00:00
Daniel Sanders
dfce63b1ba [mips] Correct and improve special-case shuffle instructions.
Summary:
The documentation writes vectors highest-index first whereas LLVM-IR writes
them lowest-index first. As a result, instructions defined in terms of
left_half() and right_half() had the halves reversed.

In addition to correcting them, they have been improved to allow shuffles
that use the same operand twice or in reverse order. For example, ilvev
used to accept masks of the form:
  <0, n, 2, n+2, 4, n+4, ...>
but now accepts:
  <0, 0, 2, 2, 4, 4, ...>
  <n, n, n+2, n+2, n+4, n+4, ...>
  <0, n, 2, n+2, 4, n+4, ...>
  <n, 0, n+2, 2, n+4, 4, ...>

One further improvement is that splati.[bhwd] is now the preferred instruction
for splat-like operations. The other special shuffles are no longer used
for splats. This lead to the discovery that <0, 0, ...> would not cause
splati.[hwd] to be selected and this has also been fixed.

This fixes the enc-3des test from the test-suite on Mips64r6 with MSA.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237689 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 12:24:52 +00:00
Yaron Keren
07cfd922f0 As r237678 was reverted, this is no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237687 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 11:46:27 +00:00
Zoran Jovanovic
7004ac8b5a [mips][microMIPSr6] Implement DIV, DIVU, MOD and MODU instructions
Differential Revision: http://reviews.llvm.org/D8769


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237685 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 11:21:37 +00:00
Yaron Keren
a44933e6d0 Fix Visual C++ errors C2784, C2780, C2782 after r237678.
It does not like std::min(unsigned, uint32_t).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237683 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 11:18:10 +00:00
Michael Kuperstein
5440f2198d [X86] ABI change for x86-32: pass 3 vector arguments in-register instead of 4, except on Darwin.
This changes the ABI used on 32-bit x86 for passing vector arguments. 
Historically, clang passes the first 4 vector arguments in-register, and additional vector arguments on the stack, regardless of platform. That is different from the behavior of gcc, icc, and msvc, all of which pass only the first 3 arguments in-register.
The 3-register convention is documented, unofficially, in Agner's calling convention guide, and, officially, in the recently released version 1.0 of the i386 psABI.

Darwin is kept as is because the OS X ABI Function Call Guide explicitly documents the current (4-register) behavior.

This fixes PR21510

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237682 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 11:06:56 +00:00
Matthias Braun
42cff157db SelectionDAG: Cleanup and simplify FoldConstantArithmetic
This cleans up the FoldConstantArithmetic code by factoring out the case
of two ConstantSDNodes into an own function. This avoids unnecessary
complexity for many callers who already have ConstantSDNode arguments.

This also avoids an intermeidate SmallVector datastructure and a loop
over that datastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237651 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 01:40:21 +00:00
Filipe Cabecinhas
bf27e11e02 [BitcodeReader] Error out if we read an invalid function argument type
Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237650 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 01:21:06 +00:00
Kostya Serebryany
3b3cbed1b0 [lib/Fuzzer] more efficient reload logic; also don't spam git too much
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 01:06:07 +00:00
Filipe Cabecinhas
c3ccd67d72 [BitcodeReader] It's a malformed block if CodeLenWidth is too big
Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237646 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:34:17 +00:00
Matthias Braun
09f87b4a7b DAGCombiner: Factor common pattern into isOneConstant() function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237645 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:25:21 +00:00
Matthias Braun
91088c696d DAGCombiner: Factor common pattern into isAllOnesConstant() function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237644 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:25:20 +00:00
Matthias Braun
a6698bb5d4 DAGCombiner: Use isNullConstant() where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237643 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:25:17 +00:00
Pete Cooper
a641a4a89e Store intrinsic ID by value in Function instead of a string lookup. NFC.
On 64-bit targets, Function has 4-bytes of padding in its struct layout.

This uses the space for the intrinsic ID. It is set and recalculated whenever the function name is set.  This is similar to the current behavior which clears the function from the intrinsic ID cache when its renamed.

The intrinsic cache itself is removed as the only purpose was to speedup calls to getIntrinsicID() which now just reading the new field in the struct.

Reviewed by Duncan.  http://reviews.llvm.org/D9836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:24:26 +00:00
Pete Cooper
d42228154f Move Function::lookupIntrinsicID to a static method. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 00:02:25 +00:00
Reid Kleckner
37f1bba13a Re-land r237175: [X86] Always return the sret parameter in eax/rax ...
This reverts commit r237210.

Also fix X86/complex-fca.ll to match the code that we used to generate
on win32 and now generate everwhere to conform to SysV.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237639 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:35:09 +00:00
Matthias Braun
42d8237570 Revert accidental change in r237633
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237635 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:18:13 +00:00
Jozef Kolek
1193b61df0 [mips][microMIPSr6] Implement LSA instruction
This patch implements LSA instruction using mapping.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237634 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:12:10 +00:00
Matthias Braun
4f5829ac4d DAGCombiner: Factor common pattern into isNullConstant() function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:07:27 +00:00
Filipe Cabecinhas
b2bf278152 [BitcodeReader] Make sure the type of the inserted value matches the type of the aggregate at those indices
Bug found with AFL-fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237628 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:27:11 +00:00
David Blaikie
042dd34f9c Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237624 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:13:54 +00:00
Tim Northover
6b57892624 AArch64: work around ld64 bug more aggressively.
ld64 currently mishandles internal pointer relocations (i.e.
ARM64_RELOC_UNSIGNED referred to by section & offset rather than symbol). The
existing __cfstring clause was an early discovery and workaround for this, but
the problem is wider and we should avoid such relocations wherever possible for
now.

This code should be reverted to allowing internal relocations as soon as
possible.

PR23437.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237621 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 22:07:20 +00:00
Eric Christopher
8b6f5f0909 Fix some odd whitespace and formatting errors while making
changes in ConstantsContext.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237620 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:49:02 +00:00
Filipe Cabecinhas
70a2c7260a Extract the load/store type verification to a separate function.
Summary:
Added isLoadableOrStorableType to PointerType.

We were doing some checks in some places, occasionally assert()ing instead
of telling the caller. With this patch, I'm putting all type checking in
the same place for load/store type instructions, and verifying the same
thing every time.

I also added a check for load/store of a function type.

Applied extracted check to Load, Store, and Cmpxcg.

I don't have exhaustive tests for all of these, but all Error() calls in
TypeCheckLoadStoreInst are being tested (in invalid.test).

Reviewers: dblaikie, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:48:55 +00:00
Kostya Serebryany
05ef67b6b9 [lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD CORPUS' to synchronize with other processes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:34:20 +00:00
Benjamin Kramer
825a528bbe [YAML] Plug a memory leak
The destructor of BlockScalarNode is never called. Store the contained
string in BumpPtrAllocated memory instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237614 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 21:11:27 +00:00
Matthias Braun
e4603f0daf MachineInstr: Change return value of getOpcode() to unsigned.
This was previously returning int. However there are no negative opcode
numbers and more importantly this was needlessly different from
MCInstrDesc::getOpcode() (which even is the value returned here) and
SDValue::getOpcode()/SDNode::getOpcode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 20:27:55 +00:00
Chen Li
881547e01b [Verifier] Assert gc_relocate always return a pointer type
Summary: Add an assertion in verifier.cpp to make sure gc_relocate relocate a gc pointer, and its return type has the same address space with the relocated pointer.

Reviewers: reames, AndyAyers, sanjoy, pgavlin

Reviewed By: pgavlin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237605 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:50:14 +00:00
Chen Li
2306579644 [PlaceSafepoints] Assertion on that gc_result can not have preceding phis should only apply to invoke statepoint
Summary: When PlaceSafepoints pass replaces old return result with gc_result from statepoint, it asserts that gc_result can not have preceding phis in its parent block. This is only true on invoke statepoint, which terminates the block and puts its result at the beginning of the normal successor block. Call statepoint does not terminate the block and thus its result is in the same block with it. There should be no restriction on whether there are phis or not.

Reviewers: reames, igor-laevsky

Reviewed By: igor-laevsky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 19:02:25 +00:00
Jim Grosbach
7b81f734ee MC: clang-format MCContext. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237595 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:43:23 +00:00
Jim Grosbach
19696daa21 MC: Clean up method names in MCContext.
The naming was a mish-mash of old and new style. Update to be consistent
with the new. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237594 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:43:14 +00:00
Sanjoy Das
0799eb1140 Exploit dereferenceable_or_null attribute in LICM pass
Summary:
Allow hoisting of loads from values marked with dereferenceable_or_null
attribute. For values marked with the attribute perform
context-sensitive analysis to determine whether it's known-non-null or
not.

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 18:07:00 +00:00
Tim Northover
9962fd0e2e ARM: allow jump tables to be placed as constant islands.
Previously, they were forced to immediately follow the actual branch
instruction. This was usually OK (the LEAs actually accessing them got emitted
nearby, and weren't usually separated much afterwards). Unfortunately, a
sufficiently nasty phi elimination dumps many instructions right before the
basic block terminator, and this can increase the range too much.

This patch frees them up to be placed as usual by the constant islands pass,
and consequently has to slightly modify the form of TBB/TBH tables to refer to
a PC-relative label at the final jump. The other jump table formats were
already position-independent.

rdar://20813304

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237590 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 17:10:40 +00:00
Jingyue Wu
2703007b7b [ScalarEvolution] refactor: extract interface getGEPExpr
Summary:
This allows other passes (such as SLSR) to compute the SCEV expression for an
imaginary GEP.

Test Plan: no regression

Reviewers: atrick, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 17:03:25 +00:00
Andrew Trick
0b9ee775f5 indvars cruft: don't replace phi nodes for no reason.
Don't replace a phi with an identical phi. This was done long ago to
"preserve" IVUsers analysis. The code has already called
SE->forgetValue(PN) so I see no purpose in creating a new value for
the phi.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:49:34 +00:00
Andrew Trick
688ae334a3 SimplifyIV comments and dead argument cleanup.
Remove crufty comments. IVUsers hasn't been used here for a long time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:49:31 +00:00
James Y Knight
ccafe05df1 Sparc: support the "set" synthetic instruction.
This pseudo-instruction expands into 'sethi' and 'or' instructions,
or, just one of them, if the other isn't necessary for a given value.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237585 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:43:33 +00:00
Hal Finkel
292c78ba68 Preserve the order of READ_REGISTER and WRITE_REGISTER
At the present time, we don't have a way to represent general dependency
relationships, so everything is represented using memory dependency. In order
to preserve the data dependency of a READ_REGISTER on WRITE_REGISTER, we need
to model WRITE_REGISTER as writing (which we had been doing) and model
READ_REGISTER as reading (which we had not been doing). Fix this, and also the
way that the chain operands were generated at the SDAG level.

Patch by Nicholas Paul Johnson, thanks! Test case by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:42:10 +00:00
Oliver Stannard
0139af335f Revert r237579, as it broke windows buildbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:39:16 +00:00
James Y Knight
1467a41471 Sparc: Support PSR, TBR, WIM read/write instructions.
Differential Revision: http://reviews.llvm.org/D8971

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:38:47 +00:00
James Y Knight
ee058202fa Sparc: Add the "alternate address space" load/store instructions.
- Adds support for the asm syntax, which has an immediate integer
  "ASI" (address space identifier) appearing after an address, before
  a comma.

- Adds the various-width load, store, and swap in alternate address
  space instructions. (ldsba, ldsha, lduba, lduha, lda, stba, stha,
  sta, swapa)

This does not attempt to hook these instructions up to pointer address
spaces in LLVM, although that would probably be a reasonable thing to
do in the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237581 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:35:04 +00:00
James Y Knight
f272788a95 Add support for the Sparc implementation-defined "ASR" registers.
(Note that register "Y" is essentially just ASR0).

Also added some test cases for divide and multiply, which had none before.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237580 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:29:48 +00:00
Oliver Stannard
d811b4bacb [LLVM - ARM/AArch64] Add ACLE special register intrinsics
This patch implements LLVM support for the ACLE special register intrinsics in
section 10.1, __arm_{w,r}sr{,p,64}.

This patch is intended to lower the read/write_register instrinsics, used to
implement the special register intrinsics in the clang patch for special
register intrinsics (see http://reviews.llvm.org/D9697), to ARM specific
instructions MRC,MCR,MSR etc. to allow reading an writing of coprocessor
registers in AArch32 and AArch64. This is done by inspecting the register
string passed to the intrinsic and then lowering to the appropriate
instruction.

Patch by Luke Cheeseman.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237579 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 16:23:33 +00:00
Hal Finkel
b6f6eee8fd [DAGCombine] Be more pedantic about use iteration in CombineToPreIndexedLoadStore
In CombineToPreIndexedLoadStore, when the offset is a constant, we have code
that looks for other uses of the pointer which are constant offset computations
so that they can be rewritten in terms of the updated pointer so that we don't
need to keep a copy of the base pointer to compute these constant offsets.

Unfortunately, when it iterated over the uses, it did so by SDNodes, and so we
could confuse ourselves if the base pointer was produced by a node that had
multiple results (because we would not immediately exclude uses of the other
node results). This was reported as PR22755. Unfortunately, we don't have a
test case (and I've also been unable to produce one thus far), but at least the
mistake is clear. The right way to fix this problem is to make use of the information
contained in the use iterators to filter out any uses of other results of the
node producing the base pointer.

This should be mostly NFC, but should also fix PR22755 (for which,
unfortunately, we have no in-tree test case).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237576 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 15:46:02 +00:00
Adam Nemet
a4c8c9292b [LoopAccesses] If shouldRetryWithRuntimeCheck, reset InterestingDependences
When dependence analysis encounters a non-constant distance between
memory accesses it aborts the analysis and falls back to run-time checks
only.  In this case we weren't resetting the array of dependences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 15:37:03 +00:00
Adam Nemet
2f2bbe4ced [LoopAccesses] Rearrange printed lines in -analyze
"Store to invariant address..." is moved as the last line.  This is not
the prime result of the analysis.  Plus it simplifies some of the tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237573 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 15:36:57 +00:00
Adam Nemet
59f6c04f94 [LoopAccesses] Debug improvement
Report pointers with unknown bounds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 15:36:52 +00:00
Jozef Kolek
865eb964f3 [mips][microMIPSr6] Implement ALIGN and AUI instructions
This patch implements ALIGN and AUI instructions using mapping.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237563 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 11:44:30 +00:00
Elena Demikhovsky
1c21f2ef8c AVX-512: Added intrinsics for ADDSS/D, MULSS/D, SUBSS/D, DIVSS/D
instructions. These intrinsics are comming with rounding mode.
Added intrinsics for MAXSS/D, MINSS/D - with and without  sae.

By Asaf Badouh (asaf.badouh@intel.com)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237560 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 07:24:19 +00:00
Elena Demikhovsky
324d41ce49 fixed compilation warning/error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237559 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 07:10:25 +00:00
Elena Demikhovsky
d026e5020b AVX-512: Added patterns for scalar-to-vector broadcast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237558 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 07:06:23 +00:00
Elena Demikhovsky
c4a426be4f AVX-512: Added VBROADCASTF64X4, VBROADCASTF64X2, VBROADCASTI32X8, and other instructions from this set
Added encoding tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237557 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 06:42:57 +00:00
Hal Finkel
78ce816d3f [PowerPC] Add extra r2 read deps on @toc@l relocations
If some commits are happy, and some commits are sad, this is a sad commit. It
is sad because it restricts instruction scheduling to work around a binutils
linker bug, and moreover, one that may never be fixed. On 2012-05-21, GCC was
updated not to produce code triggering this bug, and now we'll do the same...

When resolving an address using the ELF ABI TOC pointer, two relocations are
generally required: one for the high part and one for the low part. Only
the high part generally explicitly depends on r2 (the TOC pointer). And, so,
we might produce code like this:

.Ltmp526:
        addis 3, 2, .LC12@toc@ha
.Ltmp1628:
        std 2, 40(1)
        ld 5, 0(27)
        ld 2, 8(27)
        ld 11, 16(27)
        ld 3, .LC12@toc@l(3)
        rldicl 4, 4, 0, 32
        mtctr 5
        bctrl
        ld 2, 40(1)

And there is nothing wrong with this code, as such, but there is a linker bug
in binutils (https://sourceware.org/bugzilla/show_bug.cgi?id=18414) that will
misoptimize this code sequence to this:
        nop
        std     r2,40(r1)
        ld      r5,0(r27)
        ld      r2,8(r27)
        ld      r11,16(r27)
        ld      r3,-32472(r2)
        clrldi  r4,r4,32
        mtctr   r5
        bctrl
        ld      r2,40(r1)
because the linker does not know (and does not check) that the value in r2
changed in between the instruction using the .LC12@toc@ha (TOC-relative)
relocation and the instruction using the .LC12@toc@l(3) relocation.
Because it finds these instructions using the relocations (and not by
scanning the instructions), it has been asserted that there is no good way
to detect the change of r2 in between. As a result, this bug may never be
fixed (i.e. it may become part of the definition of the ABI). GCC was
updated to add extra dependencies on r2 to instructions using the @toc@l
relocations to avoid this problem, and we'll do the same here.

This is done as a separate pass because:
 1. These extra r2 dependencies are not really properties of the
    instructions, but rather due to a linker bug, and maybe one day we'll be
    able to get rid of them when targeting linkers without this bug (and,
    thus, keeping the logic centralized here will make that
    straightforward).
 2. There are ISel-level peephole optimizations that propagate the @toc@l
    relocations to some user instructions, and so the exta dependencies do
    not apply only to a fixed set of instructions (without undesirable
    definition replication).

The test case was reduced with the help of bugpoint, with minimal cleaning. I'm
looking forward to our upcoming MI serialization support, and with that, much
better tests can be created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 06:25:59 +00:00
Andrew Trick
01c0018953 MachineScheduler debug output clarity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237545 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 23:40:31 +00:00
Andrew Trick
eddedaab45 RegisterPressureTracker: reword stale comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237544 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 23:40:27 +00:00
James Molloy
2bb2ea8105 Reapply r237520 with another fix for infinite looping
SimplifyDemandedBits was "simplifying" a constant by removing just sign bits.
This caused a canonicalization race between different parts of instcombine.

Fix and regression test added - third time lucky?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237539 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 08:27:27 +00:00
Elena Demikhovsky
a0eb803376 AVX-512: fixed extended load to 512-bit register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237537 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 08:08:06 +00:00
Elena Demikhovsky
84b93666b3 AVX-512: fixed a bug in mask operations - (i1 1) pattern
Filling k-reg with all-ones value was wrong,
(i1 1) should switch on only one bit in mask register



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 07:28:51 +00:00
Logan Chien
9380329c4e Code cleanup: Reindent Fuzzer::MutateAndTestOne.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237533 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-17 02:44:31 +00:00
James Molloy
cca49027ef Revert commits r237521 and r237520.
The AArch64 LNT bot is unhappy - I've found that the problem is in
SimpliftDemandedBits, but that's going to require another code review
so reverting in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237528 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 21:27:14 +00:00
Benjamin Kramer
e9fd02be07 Move Pass into anonymous namespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 16:16:35 +00:00
Benjamin Kramer
11ba91f321 [WinEH] Push unique_ptr through the Action interface.
This was the source of many leaks in the past, this should fix them once and
for all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 15:40:03 +00:00
James Molloy
bc71c2fd8e Reapply r237453 with a fix for the test timeouts.
The test timeouts were due to instcombine fighting itself. Regression test added.
Original log message:

Canonicalize min/max expressions correctly.

This patch introduces a canonical form for min/max idioms where one operand
is extended or truncated. This often happens when the other operand is a
constant. For example:

  %1 = icmp slt i32 %a, i32 0
    %2 = sext i32 %a to i64
      %3 = select i1 %1, i64 %2, i64 0

Would now be canonicalized into:

  %1 = icmp slt i32 %a, i32 0
    %2 = select i1 %1, i32 %a, i32 0
      %3 = sext i32 %2 to i64

This builds upon a patch posted by David Majenemer
(https://www.marc.info/?l=llvm-commits&m=143008038714141&w=2). That pass
passively stopped instcombine from ruining canonical patterns. This
patch additionally actively makes instcombine canonicalize too.

Canonicalization of expressions involving a change in type from int->fp
or fp->int are not yet implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237520 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 13:10:45 +00:00
Daniel Sanders
f01f1c413a [x86] Distinguish the 'o', 'v', 'X', and 'i' inline assembly memory constraints.
Summary:
But still handle them the same way since I don't know how they differ on
this target.

Of these, 'o' and 'v' are not tested but were already implemented.

I'm not sure why 'i' is required for X86 since it's supposed to be an
immediate constraint rather than a memory constraint. A test asserts
without it so I've included it for now.

No functional change intended.

Reviewers: nadav

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 12:09:54 +00:00
Craig Topper
d43901cbb1 [TableGen] Change 'car' to 'head' and 'cdr' to 'tail' in assert comments. These were the old names for these operations long ago. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:13 +00:00
Craig Topper
5dddb1909c [TableGen] Remove !! that I can't really explain why I wrote. Also remove some unnecessary curly braces from the same area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:11 +00:00
Craig Topper
819ce3c51d Correct indentation. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:08 +00:00
Craig Topper
a4b093e2d3 [TableGen] Restructure a loop to make it exit early instead of skipping a portion of the body based on what will also be the terminating condition. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237511 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:03 +00:00
Matthias Braun
3ac70da982 MachineSink: Collect registers before clearing their killflags.
Currently whenever we sink any instruction, we do clearKillFlags for
every use of every use operand for that instruction, apparently there
are a lot of duplication, therefore compile time penalties.

This patch collect all the interested registers first, do clearKillFlags
for it all together at once at the end, so we only need to do
clearKillFlags once for one register, duplication is avoided.

Patch by Lawrence Hu!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 03:11:07 +00:00
Ahmed Bougacha
8081057fca [MemCpyOpt] Turn memcpy from just-memset'd source into memset.
There's no point in copying around constants, so, when all else fails,
we can still transform memcpy of memset into two independent memsets.

To quote the example, we can turn:
  memset(dst1, c, dst1_size);
  memcpy(dst2, dst1, dst2_size);
into:
  memset(dst1, c, dst1_size);
  memset(dst2, c, dst2_size);
When dst2_size <= dst1_size.

Like r235232 for copy constructors, this can occur in move constructors.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237506 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:32:26 +00:00
Ahmed Bougacha
487db4685a [MemCpyOpt] Remove dead argument. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237503 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:23:47 +00:00
Duncan P. N. Exon Smith
57e32d40b7 MC: Use MCSymbol in RelAndSymbol, NFC
Switch from `MCSymbolData` to `MCSymbol`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237502 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:14:19 +00:00
Bill Schmidt
24f0469865 [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

Appropriate tests have been added.

There is a companion patch to clang for the rest of this support.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237499 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:02:12 +00:00
Duncan P. N. Exon Smith
9e6378de57 MC: Use MCSymbol in MCObject::IsSymbolRefDifferenceFullyResolvedImpl()
Transition one API from `MCSymbolData` to `MCSymbol`.  The function
needs both, and the backpointer from `MCSymbolData` to `MCSymbol` is
going away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 01:01:55 +00:00
Duncan P. N. Exon Smith
5f7c1f8415 MC: Change MCFragment::Atom to an MCSymbol, NFC
Change `MCFragment::Atom` from an `MCSymbolData` to an `MCSymbol`,
moving in the direction of removing the back-pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:48:58 +00:00
Duncan P. N. Exon Smith
a5bb842d95 MC: Change MCAssembler::Symbols to store MCSymbol, NFC
Instead of storing a list of the `MCSymbolData` in use, store the
`MCSymbol`s.  Churning in the direction of removing the back pointer
from `MCSymbolData`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:35:24 +00:00
Filipe Cabecinhas
ddf553bb8d [BitcodeReader] Don't allow INSERTVAL/EXTRACTVAL with 0 indices
This would trigger an assertion later.

Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237494 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:33:12 +00:00
Duncan P. N. Exon Smith
c5f2ba0401 MC: Merge MCSymbol and MCSymbolData
Turn `MCSymbolData` into a field inside of `MCSymbol`.  Keep all the old
API alive for now, so that consumers can be updated in a later commit.
This means we still temporarily need the back pointer from
`MCSymbolData` to `MCSymbol`, but I'll remove it in a follow-up.

This optimizes for object emission over assembly emission.  By removing
the `DenseMap` in `MCAssembler`, llc memory usage drops from around 1040
MB to 1001 MB (3.8%).

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237490 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 00:03:06 +00:00
Filipe Cabecinhas
6bde794d52 Remove redundant checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237488 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 23:57:13 +00:00
Duncan P. N. Exon Smith
eaf14f30c8 MC: Reduce MCAssembler::Symbols API exposure, NFC
Stop exposing the storage for `MCAssembler::Symbols`, and have
`MCAssembler` add symbols directly to its list instead of using a hook
in `MCSymbolData`.  This opens up room for a follow-up commit to switch
from a linked list to a vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237486 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 22:33:34 +00:00
Pete Cooper
fc9bfcd184 Remove MCAssembler.h include from MCStreamer.h and fix users of MCStreamer.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 22:19:42 +00:00
Pete Cooper
39aa893201 Remove 3 includes from MCInstrDesc.h and explicitly include them where needed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 21:58:42 +00:00
Pete Cooper
9e514203d1 Move some methods to a new MCInstrDesc.cpp file to allow includes to be trimmed. NFC.
MCInstrDesc.h includes things like MCInst.h which i can now remove after this.  That will be a future commit.

Reviewed by Jim Grosbach.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237478 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 21:29:43 +00:00
David Majnemer
e892415f25 [RuntimeDyld] Use isInt to assert that a relocation didn't overflow
isInt is a little easier to read, let's use that more consistently.
Incidentally, this also silences a warning for shifting a negative
number.

This fixes PR23532.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237476 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 20:32:25 +00:00
David Majnemer
7fa889dd87 [X86] Use a better sentinel offset for the FrameAddr index
Other pieces of CodeGen want to negate frame object offsets to account
for architectures where the stack grows down.  Our object is a pseudo
object so it's offset doesn't matter.  However, we shouldn't choose an
offset which results in undefined behavior if you negate it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 20:08:27 +00:00
Jim Grosbach
21a996a0e3 MC: MCCodeGenInfo naming update. NFC.
s/InitMCCodeGenInfo/initMCCodeGenInfo/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 19:13:31 +00:00
Jim Grosbach
251a66ec37 MC: Update MCCodeEmitter naming. NFC.
s/EncodeInstruction/encodeInstruction/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 19:13:16 +00:00