Commit Graph

112347 Commits

Author SHA1 Message Date
Chandler Carruth
047f8903b4 [PM] General doxygen and comment cleanup for this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 11:44:32 +00:00
Chandler Carruth
77f24c4265 [PM] Reformat this code with clang-format so that I can use clang-format
when refactoring for the new pass manager without introducing too many
formatting changes into meaning full diffs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227000 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 11:33:55 +00:00
Chandler Carruth
d4f6d111c1 [PM] Port LowerExpectIntrinsic to the new pass manager.
This just lifts the logic into a static helper function, sinks the
legacy pass to be a trivial wrapper of that helper fuction, and adds
a trivial wrapper for the new PM as well. Not much to see here.

I switched a test case to run in both modes, but we have to strip the
dead prototypes separately as that pass isn't in the new pass manager
(yet).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226999 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 11:13:02 +00:00
Chandler Carruth
f6efb2b30b [PM] Change LowerExpectIntrinsic to actually return true when it has
changed the IR. This is particularly easy as we can just look for the
existence of any expect intrinsic at all to know whether we've changed
the IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226998 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 11:12:57 +00:00
Chandler Carruth
c31d4e4a86 [PM] Use a more appropriate name for the statistics variable in
lower-expect, as we don't have 'if's in the IR and we use it for
switches as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226997 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:57:25 +00:00
Chandler Carruth
5999806daf [PM] Switch tihs code to use a range based for loop over the function.
We can't switch the loop over the instructions because it needs to
early-increment the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:57:19 +00:00
Chandler Carruth
fa50a1f2d5 [PM] Use a SmallVector instead of std::vector to avoid heap allocations
for small switches, and avoid using a complex loop to set up the
weights.

We know what the baseline weights will be so we can just resize the
vector to contain all that value and clobber the one slot that is
likely. This seems much more direct than the previous code that tested
at every iteration, and started off by zeroing the vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226995 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:47:13 +00:00
Chandler Carruth
d491dadacd [PM] Pull the two helpers for this pass into static functions. There are
no members for them to use.

Also, make them accept references as there is no possibility of a null
pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226994 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:39:24 +00:00
Chandler Carruth
0a9ef5f8c2 [PM] Add a basic doxygen comment for this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:32:53 +00:00
Chandler Carruth
1928e50d07 [PM] Clean up the formatting of the LowerExpectIntrinsic pass prior to
refactoring its code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226992 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:30:14 +00:00
Chandler Carruth
93647f18af [PM] Move the LowerExpectIntrinsic pass to the Scalar library.
It was already in the Scalar header and referenced extensively as being
in this library, the source file was just in the utils directory for
some reason. No actual functionality changed. I noticed as it didn't
make sense to add a pass header to the utils headers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 10:18:47 +00:00
Yunzhong Gao
d3198ce4bc If we see UTF-8 BOM sequence at the beginning of a response file, we shall
remove these bytes before parsing.

Phabricator Revision: http://reviews.llvm.org/D7156



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226988 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 04:23:08 +00:00
Chandler Carruth
7a98df7f74 [PM] Port instcombine to the new pass manager!
This is exciting as this is a much more involved port. This is
a complex, existing transformation pass. All of the core logic is shared
between both old and new pass managers. Only the access to the analyses
is separate because the actual techniques are separate. This also uses
a bunch of different and interesting analyses and is the first time
where we need to use an analysis across an IR layer.

This also paves the way to expose instcombine utility functions. I've
got a static function that implements the core pass logic over
a function which might be mildly interesting, but more interesting is
likely exposing a routine which just uses instructions *already in* the
worklist and combines until empty.

I've switched one of my favorite instcombine tests to run with both as
well to make sure this keeps working.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226987 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 04:19:17 +00:00
Filipe Cabecinhas
5d8bb5c7c5 [Bitcode] Diagnose errors instead of asserting from bad input
Eventually we can make some of these pass the error along to the caller.

Reports a fatal error if:
We find an invalid abbrev record
We try to get an invalid abbrev number
We can't fill the current word due to an EOF

Fixed an invalid bitcode test to check for output with FileCheck

Bugs found with afl-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226986 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 04:15:05 +00:00
Chandler Carruth
6f409cbc05 [PM] Rework how the TargetLibraryInfo pass integrates with the new pass
manager to support the actual uses of it. =]

When I ported instcombine to the new pass manager I discover that it
didn't work because TLI wasn't available in the right places. This is
a somewhat surprising and/or subtle aspect of the new pass manager
design that came up before but I think is useful to be reminded of:

While the new pass manager *allows* a function pass to query a module
analysis, it requires that the module analysis is already run and cached
prior to the function pass manager starting up, possibly with
a 'require<foo>' style utility in the pass pipeline. This is an
intentional hurdle because using a module analysis from a function pass
*requires* that the module analysis is run prior to entering the
function pass manager. Otherwise the other functions in the module could
be in who-knows-what state, etc.

A somewhat surprising consequence of this design decision (at least to
me) is that you have to design a function pass that leverages
a module analysis to do so as an optional feature. Even if that means
your function pass does no work in the absence of the module analysis,
you have to handle that possibility and remain conservatively correct.
This is a natural consequence of things being able to invalidate the
module analysis and us being unable to re-run it. And it's a generally
good thing because it lets us reorder passes arbitrarily without
breaking correctness, etc.

This ends up causing problems in one case. What if we have a module
analysis that is *definitionally* impossible to invalidate. In the
places this might come up, the analysis is usually also definitionally
trivial to run even while other transformation passes run on the module,
regardless of the state of anything. And so, it follows that it is
natural to have a hard requirement on such analyses from a function
pass.

It turns out, that TargetLibraryInfo is just such an analysis, and
InstCombine has a hard requirement on it.

The approach I've taken here is to produce an analysis that models this
flexibility by making it both a module and a function analysis. This
exposes the fact that it is in fact safe to compute at any point. We can
even make it a valid CGSCC analysis at some point if that is useful.
However, we don't want to have a copy of the actual target library info
state for each function! This state is specific to the triple. The
somewhat direct and blunt approach here is to turn TLI into a pimpl,
with the state and mutators in the implementation class and the query
routines primarily in the wrapper. Then the analysis can lazily
construct and cache the implementations, keyed on the triple, and
on-demand produce wrappers of them for each function.

One minor annoyance is that we will end up with a wrapper for each
function in the module. While this is a bit wasteful (one pointer per
function) it seems tolerable. And it has the advantage of ensuring that
we pay the absolute minimum synchronization cost to access this
information should we end up with a nice parallel function pass manager
in the future. We could look into trying to mark when analysis results
are especially cheap to recompute and more eagerly GC-ing the cached
results, or we could look at supporting a variant of analyses whose
results are specifically *not* cached and expected to just be used and
discarded by the consumer. Either way, these seem like incremental
enhancements that should happen when we start profiling the memory and
CPU usage of the new pass manager and not before.

The other minor annoyance is that if we end up using the TLI in both
a module pass and a function pass, those will be produced by two
separate analyses, and thus will point to separate copies of the
implementation state. While a minor issue, I dislike this and would like
to find a way to cleanly allow a single analysis instance to be used
across multiple IR unit managers. But I don't have a good solution to
this today, and I don't want to hold up all of the work waiting to come
up with one. This too seems like a reasonable thing to incrementally
improve later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226981 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 02:06:09 +00:00
Richard Smith
104a21d250 Bring the modules buildbot back to life after r226940.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226980 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 01:55:52 +00:00
Kuba Brecka
7796c35818 Reverting r226937: lit: Make MCJIT's supported arch check case insensitive
The r226937 commit causes ASan lit tests to be all skipped on OS X.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226979 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 01:42:44 +00:00
Quentin Colombet
af1cd03764 [AArch64][LoadStoreOptimizer] Form LDPSW when possible.
This patch adds the missing LD[U]RSW variants to the load store optimizer, so
that we generate LDPSW when possible.

<rdar://problem/19583480>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 01:25:54 +00:00
Lang Hames
6f18eb635a [Orc] Add some missing headers to the CompileOnDemandLayer.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 00:45:11 +00:00
Bruno Cardoso Lopes
88869354d8 [x86] Fix a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 00:22:04 +00:00
Lang Hames
4f437717d4 [Orc] Add orcjit to the dependencies list in the Makefile for lli.
This should fix a few more broken bots.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226973 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-24 00:01:29 +00:00
Tom Stellard
5b37a2e5ff R600/SI: Emit .hsa.version section for amdhsa OS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226970 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:59:08 +00:00
Reid Kleckner
339591e0a9 Fix assertion when C++ EH filters are present in functions using SEH
Should fix PR22305.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226969 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:51:25 +00:00
Adrian Prantl
eabbe07449 Address more review comments for DIExpression::iterator.
- input_iterator
- define an operator->
- make constructors private were possible

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:40:47 +00:00
Justin Bogner
d2925c201e InstrProf: debug dumps should go to dbgs(), not outs()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226964 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:28:30 +00:00
Justin Bogner
c6945d9e32 llvm-cov: Don't use llvm::outs() in library code
Nothing in lib/ should be using llvm::outs() directly. Thread it in
from the caller instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226961 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 23:09:27 +00:00
Justin Bogner
798383b3ff llvm-cov: Use range-for (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:57:02 +00:00
Reid Kleckner
4fefe4cfb8 mips: Fix "XPASS" test results by removing 'not' commands
These tests are asserting and crashing for me, and 'not' sees that as a
non-zero exit code instead of a signal code for obscure Windows reasons.
This causes the test to pass, giving me an unclean 'ninja check'.

The test is already XFAILd, so just run the test without 'not' and let
lit handle the failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226958 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:55:31 +00:00
Bruno Cardoso Lopes
807360ab08 [x86] Combine x86mmx/i64 to v2i64 conversion to use scalar_to_vector
Handle the poor codegen for i64/x86xmm->v2i64 (%mm -> %xmm) moves. Instead of
using stack store/load pair to do the job, use scalar_to_vector directly, which
in the MMX case can use movq2dq. This was the current behavior prior to
improvements for vector legalization of extloads in r213897.

This commit fixes the regression and as a side-effect also remove some
unnecessary shuffles.

In the new attached testcase, we go from:

pshufw  $-18, (%rdi), %mm0
movq    %mm0, -8(%rsp)
movq    -8(%rsp), %xmm0
pshufd  $-44, %xmm0, %xmm0
movd    %xmm0, %eax
...

To:

pshufw  $-18, (%rdi), %mm0
movq2dq %mm0, %xmm0
movd    %xmm0, %eax
...

Differential Revision: http://reviews.llvm.org/D7126
rdar://problem/19413324

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:44:16 +00:00
Justin Bogner
4c61bbe673 llvm-cov: clang-format the GCOV files (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:38:01 +00:00
Reid Kleckner
d09c631f07 Fix the MSVC build with the new Orc JIT APIs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:25:47 +00:00
Michael J. Spencer
cf990541a0 [YAMLIO] Dirty hack: Force integral conversion to allow strong typedefs to convert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:24:57 +00:00
Lang Hames
0ace78e7d4 [Orc] Remove a bunch of constructors from ObjectLinkingLayer.
These constructors were causing trouble for MSVC and older GCCs. This should
fix more of the build failures from r226940.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226946 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:11:07 +00:00
Tom Stellard
511a3c71fc R600/SI: Move i64 -> v2i32 load promotion into AMDGPUDAGToDAGISel::Select()
We used to do this promotion during DAG legalization, but this
caused an infinite loop in ExpandUnalignedLoad() because it assumed
that i64 loads were legal if i64 was a legal type.

It also seems better to report i64 loads as legal, since they actually
are and we were just promoting them to simplify our tablegen files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226945 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 22:05:45 +00:00
Michael J. Spencer
b5ef83de33 [Object][ELF] Test unknown type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:58:09 +00:00
Michael J. Spencer
96c609287d [YAMLIO] Add support for numeric values in enums.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226942 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:57:50 +00:00
Lang Hames
89eab6e7bd [Orc] LLVMLinkInOrcMCJITReplacement shouldn't be in the anonymous namespace.
This should fix some of the builder errors from r226940.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226941 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:49:12 +00:00
Lang Hames
63cc4f56a9 [Orc] New JIT APIs.
This patch adds a new set of JIT APIs to LLVM. The aim of these new APIs is to
cleanly support a wider range of JIT use cases in LLVM, and encourage the
development and contribution of re-usable infrastructure for LLVM JIT use-cases.

These APIs are intended to live alongside the MCJIT APIs, and should not affect
existing clients.

Included in this patch:

1) New headers in include/llvm/ExecutionEngine/Orc that provide a set of
   components for building JIT infrastructure.
   Implementation code for these headers lives in lib/ExecutionEngine/Orc.

2) A prototype re-implementation of MCJIT (OrcMCJITReplacement) built out of the
   new components.

3) Minor changes to RTDyldMemoryManager needed to support the new components.
   These changes should not impact existing clients.

4) A new flag for lli, -use-orcmcjit, which will cause lli to use the
   OrcMCJITReplacement class as its underlying execution engine, rather than
   MCJIT itself.

Tests to follow shortly.

Special thanks to Michael Ilseman, Pete Cooper, David Blaikie, Eric Christopher,
Justin Bogner, and Jim Grosbach for extensive feedback and discussion.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:25:00 +00:00
Adrian Prantl
d5dc4cff6a Move the accessor functions from DIExpression::iterator into a wrapper
DIExpression::Operand, so we can write range-based for loops.

Thanks to David Blaikie for the idea.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226939 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:24:41 +00:00
Reid Kleckner
d4c7c06a39 lit: Make MCJIT's supported arch check case insensitive
Should make the tests run when using CMake on systems where 'uname -p'
reports "amd64", such as FreeBSD.

Should fix PR21559.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:11:40 +00:00
Kevin Enderby
f9857eb016 Fix the problem with llvm-objdump and -archive-headers in printing the archive header size field.
This problem showed up with the clang-cmake-armv7-a15-full bot.  Thanks to Renato Golin for his help.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:02:44 +00:00
Alexei Starovoitov
114fb20f6e [mips] fix spelling of 'disassembler'
trivial first commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226935 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 21:00:08 +00:00
Hans Wennborg
01e223e92e LowerSwitch: replace unreachable default with popular case destination
SimplifyCFG currently does this transformation, but I'm planning to remove that
to allow other passes, such as this one, to exploit the unreachable default.

This patch takes care to keep track of what case values are unreachable even
after the transformation, allowing for more efficient lowering.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226934 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 20:43:51 +00:00
Colin LeMahieu
88fa664c1b [Objdump] Output information about common symbols in a way closer to GNU objdump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 20:06:24 +00:00
Ramkumar Ramachandra
ae597a058a [emacs] llvm-mode: fix parens, font-lock i*
In llvm-mode, with electric-pair-mode turned on, typing a literal '['
would print out '[[', and '(' would print a '(('. This was a very
annoying bug caused by overzealous syntax-table entries: the parens are
already part of the '(' and ')' class by default. Fix this.

While at it, notice that i32, i64, i1 etc. are not font-locked despite a
clear intent to do so. The issue is that regexp-opt doesn't accept
regular expressions. So, spell out the common literal integers with
different widths.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226931 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 19:45:35 +00:00
Kevin Enderby
66e2ddc870 Add the option, -data-in-code, to llvm-objdump used with -macho to print the Mach-O data in code table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 18:52:17 +00:00
Reid Kleckner
26ba4c13a7 Classify functions by EH personality type rather than using the triple
This mostly reverts commit r222062 and replaces it with a new enum. At
some point this enum will grow at least for other MSVC EH personalities.

Also beefs up the way we were sniffing the personality function.
Previously we would emit the Itanium LSDA despite using
__C_specific_handler.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226920 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 18:49:01 +00:00
Adrian Prantl
7e97e25bfc Debug Info / PR22309: Allow union types to be emitted as unsigned constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226919 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 18:01:39 +00:00
Eric Christopher
ab74a03c00 Remove some local variables in place of just querying for them
in the couple of asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226917 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 17:22:44 +00:00
Toma Tabacu
d6fbb91ea2 [mips] Add new error message and improve testing for parsing the .module directive.
Summary:
We used to silently ignore any empty .module's and we used to give an error saying that we found
an "unexpected token at start of statement" when the value of the option wasn't an identifier (e.g. if it was a number).

We now give an error saying that we "expected .module option identifier" in both of those cases.

I also fixed the other tests in mips-abi-bad.s, which all seemed to be broken.


Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 10:40:19 +00:00