platform/upstream/llvm.git
10 years agoUpdate the jscop tests and port them to isl codegen.
Johannes Doerfert [Sun, 3 Aug 2014 01:48:49 +0000 (01:48 +0000)]
Update the jscop tests and port them to isl codegen.

  The updated tests use a different context than the old ones did.
  Other than that only their path and the code generation we use
  changed.

llvm-svn: 214657

10 years agoTools.cpp: Avoid std::to_string() on -fbuild-session-timestamp to appease mingw32...
NAKAMURA Takumi [Sun, 3 Aug 2014 01:11:44 +0000 (01:11 +0000)]
Tools.cpp: Avoid std::to_string() on -fbuild-session-timestamp to appease mingw32 builder.

llvm-svn: 214656

10 years ago[SimplifyCFG] fix accessing deleted PHINodes in switch-to-table conversion.
Manman Ren [Sat, 2 Aug 2014 23:41:54 +0000 (23:41 +0000)]
[SimplifyCFG] fix accessing deleted PHINodes in switch-to-table conversion.

When we have a covered lookup table, make sure we don't delete PHINodes that
are cached in PHIs.

rdar://17887153

llvm-svn: 214642

10 years ago[Mips] Replace assembler code by YAML to make the 'gotsym.test' test
Simon Atanasyan [Sat, 2 Aug 2014 20:18:31 +0000 (20:18 +0000)]
[Mips] Replace assembler code by YAML to make the 'gotsym.test' test
target independent.

llvm-svn: 214641

10 years agotlbia support
Joerg Sonnenberger [Sat, 2 Aug 2014 20:16:29 +0000 (20:16 +0000)]
tlbia support

llvm-svn: 214640

10 years agomfdcr / mtdcr support
Joerg Sonnenberger [Sat, 2 Aug 2014 20:00:26 +0000 (20:00 +0000)]
mfdcr / mtdcr support

llvm-svn: 214639

10 years agofix bug 20513 - Crash in SLP Vectorizer
Erik Eckstein [Sat, 2 Aug 2014 19:39:42 +0000 (19:39 +0000)]
fix bug 20513 - Crash in SLP Vectorizer

llvm-svn: 214638

10 years agoUpdate test to use a more modern AArch64 triple, as requested by Renato.
James Molloy [Sat, 2 Aug 2014 17:15:11 +0000 (17:15 +0000)]
Update test to use a more modern AArch64 triple, as requested by Renato.

llvm-svn: 214637

10 years agoDon't use additional arguments for dss and friends to satisfy DSS_Form,
Joerg Sonnenberger [Sat, 2 Aug 2014 15:09:41 +0000 (15:09 +0000)]
Don't use additional arguments for dss and friends to satisfy DSS_Form,
when let can do the same thing. Keep the 64bit variants as codegen-only.
While they have a different register class, the encoding is the same for
32bit and 64bit mode. Having both present would otherwise confuse the
disassembler.

llvm-svn: 214636

10 years agovcfsx and dss instructions require immediates, variables are not valid.
Joerg Sonnenberger [Sat, 2 Aug 2014 15:07:21 +0000 (15:07 +0000)]
vcfsx and dss instructions require immediates, variables are not valid.

llvm-svn: 214635

10 years ago[AArch64] Teach DAGCombiner that converting two consecutive loads into a vector load...
James Molloy [Sat, 2 Aug 2014 14:51:24 +0000 (14:51 +0000)]
[AArch64] Teach DAGCombiner that converting two consecutive loads into a vector load is not a good transform when paired loads are available.

The combiner was creating Q-register loads and stores, which then had to be spilled because there are no callee-save Q registers!

llvm-svn: 214634

10 years agoMark a GPGPU test case as XFAIL
Tobias Grosser [Sat, 2 Aug 2014 13:37:32 +0000 (13:37 +0000)]
Mark a GPGPU test case as XFAIL

This area of code is currently not very much tested. It will hopefully be
superseeded by Yabin's GSoC project.

llvm-svn: 214633

10 years agoNo need to run -mem2reg twice
Tobias Grosser [Sat, 2 Aug 2014 13:37:25 +0000 (13:37 +0000)]
No need to run -mem2reg twice

llvm-svn: 214632

10 years ago[x86] Remove the FIXME that was implemented in r214628. Managed to
Chandler Carruth [Sat, 2 Aug 2014 11:34:23 +0000 (11:34 +0000)]
[x86] Remove the FIXME that was implemented in r214628. Managed to
forget to update the comment here... =/

llvm-svn: 214630

10 years ago[x86] Give this test a bare metal triple so it doesn't use the weird
Chandler Carruth [Sat, 2 Aug 2014 11:17:41 +0000 (11:17 +0000)]
[x86] Give this test a bare metal triple so it doesn't use the weird
Darwin x86 asm comment prefix designed to work around GAS on that
platform. That makes the comment-matching of the test much more stable.

llvm-svn: 214629

10 years ago[x86] Largely complete the use of PSHUFB in the new vector shuffle
Chandler Carruth [Sat, 2 Aug 2014 10:39:15 +0000 (10:39 +0000)]
[x86] Largely complete the use of PSHUFB in the new vector shuffle
lowering with a small addition to it and adding PSHUFB combining.

There is one obvious place in the new vector shuffle lowering where we
should form PSHUFBs directly: when without them we will unpack a vector
of i8s across two different registers and do a potentially 4-way blend
as i16s only to re-pack them into i8s afterward. This is the crazy
expensive fallback path for i8 shuffles and we can just directly use
pshufb here as it will always be cheaper (the unpack and pack are
two instructions so even a single shuffle between them hits our
three instruction limit for forming PSHUFB).

However, this doesn't generate very good code in many cases, and it
leaves a bunch of common patterns not using PSHUFB. So this patch also
adds support for extracting a shuffle mask from PSHUFB in the X86
lowering code, and uses it to handle PSHUFBs in the recursive shuffle
combining. This allows us to combine through them, combine multiple ones
together, and generally produce sufficiently high quality code.

Extracting the PSHUFB mask is annoyingly complex because it could be
either pre-legalization or post-legalization. At least this doesn't have
to deal with re-materialized constants. =] I've added decode routines to
handle the different patterns that show up at this level and we dispatch
through them as appropriate.

The two primary test cases are updated. For the v16 test case there is
still a lot of room for improvement. Since I was going through it
systematically I left behind a bunch of FIXME lines that I'm hoping to
turn into ALL lines by the end of this.

llvm-svn: 214628

10 years ago[x86] Switch to using the variable we extracted this operand into.
Chandler Carruth [Sat, 2 Aug 2014 10:29:36 +0000 (10:29 +0000)]
[x86] Switch to using the variable we extracted this operand into.

Spotted this missed refactoring by inspection when reading code, and it
doesn't changethe functionality at all.

llvm-svn: 214627

10 years ago[x86] Fix a few typos in my comments spotted in passing.
Chandler Carruth [Sat, 2 Aug 2014 10:29:34 +0000 (10:29 +0000)]
[x86] Fix a few typos in my comments spotted in passing.

llvm-svn: 214626

10 years ago[x86] Teach the target shuffle mask extraction to recognize unary forms
Chandler Carruth [Sat, 2 Aug 2014 10:27:38 +0000 (10:27 +0000)]
[x86] Teach the target shuffle mask extraction to recognize unary forms
of normally binary shuffle instructions like PUNPCKL and MOVLHPS.

This detects cases where a single register is used for both operands
making the shuffle behave in a unary way. We detect this and adjust the
mask to use the unary form which allows the existing DAG combine for
shuffle instructions to actually work at all.

As a consequence, this uncovered a number of obvious bugs in the
existing DAG combine which are fixed. It also now canonicalizes several
shuffles even with the existing lowering. These typically are trying to
match the shuffle to the domain of the input where before we only really
modeled them with the floating point variants. All of the cases which
change to an integer shuffle here have something in the integer domain, so
there are no more or fewer domain crosses here AFAICT. Technically, it
might be better to go from a GPR directly to the floating point domain,
but detecting floating point *outputs* despite integer inputs is a lot
more code and seems unlikely to be worthwhile in practice. If folks are
seeing domain-crossing regressions here though, let me know and I can
hack something up to fix it.

Also as a consequence, a bunch of missed opportunities to form pshufb
now can be formed. Notably, splats of i8s now form pshufb.
Interestingly, this improves the existing splat lowering too. We go from
3 instructions to 1. Yes, we may tie up a register, but it seems very
likely to be worth it, especially if splatting the 0th byte (the
common case) as then we can use a zeroed register as the mask.

llvm-svn: 214625

10 years ago[x86] Teach my pshufb comment printer to handle VPSHUFB forms as well as
Chandler Carruth [Sat, 2 Aug 2014 10:08:17 +0000 (10:08 +0000)]
[x86] Teach my pshufb comment printer to handle VPSHUFB forms as well as
PSHUFB forms. This will be important to update some AVX tests when I add
PSHUFB combining.

llvm-svn: 214624

10 years ago[SDAG] Refactor the code which deletes nodes in the DAG combiner to do
Chandler Carruth [Sat, 2 Aug 2014 10:02:07 +0000 (10:02 +0000)]
[SDAG] Refactor the code which deletes nodes in the DAG combiner to do
so using a single helper which adds operands back onto the worklist.

Several places didn't rigorously do this but a couple already did.
Factoring them together and doing it rigorously is important to delete
things recursively early on in the combiner and get a chance to see
accurate hasOneUse values. While no existing test cases change, an
upcoming patch to add DAG combining logic for PSHUFB requires this to
work correctly.

llvm-svn: 214623

10 years agoFix issues with ISD::FNEG and ISD::FMA SDNodes where they would not be constant-folded
Owen Anderson [Sat, 2 Aug 2014 08:45:33 +0000 (08:45 +0000)]
Fix issues with ISD::FNEG and ISD::FMA SDNodes where they would not be constant-folded
during DAGCombine in certain circumstances.  Unfortunately, the circumstances required
to trigger the issue seem to require a pretty specific interaction of DAGCombines,
and I haven't been able to find a testcase that reproduces on X86, ARM, or AArch64.
The functionality added here is replicated in essentially every other DAG combine,
so it seems pretty obviously correct.

llvm-svn: 214622

10 years agoChanged tool-template to use CommonOptionsParser.
Alexander Kornienko [Sat, 2 Aug 2014 08:24:10 +0000 (08:24 +0000)]
Changed tool-template to use CommonOptionsParser.

Reviewers: pcc, klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 214621

10 years agolibclang/Makefile: Update LINK_COMPONENTS take #3. Sorry for the noise.
NAKAMURA Takumi [Sat, 2 Aug 2014 07:24:04 +0000 (07:24 +0000)]
libclang/Makefile: Update LINK_COMPONENTS take #3. Sorry for the noise.

llvm-svn: 214620

10 years agolibclang/Makefile: Update LINK_COMPONENTS take #2.
NAKAMURA Takumi [Sat, 2 Aug 2014 07:16:14 +0000 (07:16 +0000)]
libclang/Makefile: Update LINK_COMPONENTS take #2.

llvm-svn: 214619

10 years agoMake the swig generation script use the correct python executable.
Zachary Turner [Sat, 2 Aug 2014 07:11:22 +0000 (07:11 +0000)]
Make the swig generation script use the correct python executable.

It was hardcoding the value "python", which will end up at best
getting a different python executable (if the user has overridden
the value of PYTHON_EXECUTABLE), and at worst encountering an
error (if there is no copy of python on the system path).

This patch changes the script to use sys.executable so that it
runs the sub-script with the same executable that it was run with.

llvm-svn: 214618

10 years agolibclang/Makefile: Restore some components in LINK_COMPONENTS. Clang's Makefile(s...
NAKAMURA Takumi [Sat, 2 Aug 2014 07:05:38 +0000 (07:05 +0000)]
libclang/Makefile: Restore some components in LINK_COMPONENTS. Clang's Makefile(s) are not transitive on clang libs.

llvm-svn: 214617

10 years agolibclang: Update LINK_COMPONENTS.
NAKAMURA Takumi [Sat, 2 Aug 2014 06:58:39 +0000 (06:58 +0000)]
libclang: Update LINK_COMPONENTS.

llvm-svn: 214616

10 years agoCodeGen: Remove commented out code
Justin Bogner [Sat, 2 Aug 2014 06:47:07 +0000 (06:47 +0000)]
CodeGen: Remove commented out code

These two lines have been commented out for over 4 years. They aren't
helping anyone.

llvm-svn: 214615

10 years ago[ARM] In dynamic-no-pic mode, ARM's post-RA pseudo expansion was incorrectly
Akira Hatanaka [Sat, 2 Aug 2014 05:40:40 +0000 (05:40 +0000)]
[ARM] In dynamic-no-pic mode, ARM's post-RA pseudo expansion was incorrectly
expanding pseudo LOAD_STATCK_GUARD using instructions that are normally used
in pic mode. This patch fixes the bug.

<rdar://problem/17886592>

llvm-svn: 214614

10 years ago[MCJIT] Fix an overly-aggressive check in RuntimeDyldMachOARM.
Lang Hames [Sat, 2 Aug 2014 03:00:49 +0000 (03:00 +0000)]
[MCJIT] Fix an overly-aggressive check in RuntimeDyldMachOARM.

This should fix the MachO_ARM_PIC_relocations.s test failures on some 32-bit
testers.

llvm-svn: 214613

10 years agoR600: Cleanup fneg tests
Matt Arsenault [Sat, 2 Aug 2014 02:26:51 +0000 (02:26 +0000)]
R600: Cleanup fneg tests

llvm-svn: 214612

10 years agoAdd a small utility called bisect that enables commandline bisecting on a counter.
Michael Gottesman [Sat, 2 Aug 2014 01:39:08 +0000 (01:39 +0000)]
Add a small utility called bisect that enables commandline bisecting on a counter.

This is something that I have found to be very useful in my work and I
wanted to contribute it back to the community since several people in
the past have asked me for something along these lines. (Jakob, I know
this has been a while coming ; )]

The way you use this is you create a script that takes in as its first
argument a count. The script passes into LLVM the count via a command
line flag that disables a pass after LLVM has run after the pass has
run for count number of times. Then the script invokes a test of some
sort and indicates whether LLVM successfully compiled the test via the
scripts exit status. Then you invoke bisect as follows:

bisect --start=<start_num> --end=<end_num> ./script.sh "%(count)s"

And bisect will continually call ./script.sh with various counts using
the exit status to determine success and failure.

llvm-svn: 214610

10 years ago[lit] Add --show-xfail flag to LIT.
Eric Fiselier [Sat, 2 Aug 2014 01:29:52 +0000 (01:29 +0000)]
[lit] Add --show-xfail flag to LIT.

Summary:
This patch add a --show-xfail flag. If this flag is specified then each xfail test will be printed to output.
When it is not given xfail tests are ignored. Ignoring xfail tests is the current behavior.

This flag is meant to mirror the --show-unsupported flag that was recently added.

Reviewers: ddunbar, EricWF

Reviewed By: EricWF

Subscribers: llvm-commits

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

llvm-svn: 214609

10 years agoR600/SI: Fix formatting.
Matt Arsenault [Sat, 2 Aug 2014 01:10:28 +0000 (01:10 +0000)]
R600/SI: Fix formatting.

Avoid weird line wrapping of BuildMI dest register.

llvm-svn: 214608

10 years agoUse CommonOptionsParser in clang-query. This fixes its support of the fixed
Alexander Kornienko [Sat, 2 Aug 2014 01:02:33 +0000 (01:02 +0000)]
Use CommonOptionsParser in clang-query. This fixes its support of the fixed
compilation database and makes it behave consistently with other clang tools.

Reviewers: klimek, pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

llvm-svn: 214607

10 years agoIn the case of mangling collisions, make an attempt to note both definitions
Richard Smith [Sat, 2 Aug 2014 00:50:16 +0000 (00:50 +0000)]
In the case of mangling collisions, make an attempt to note both definitions
involved.

llvm-svn: 214606

10 years ago[x86] Make some questionable tests not spew assembly to stdout, which
Chandler Carruth [Sat, 2 Aug 2014 00:50:10 +0000 (00:50 +0000)]
[x86] Make some questionable tests not spew assembly to stdout, which
makes a mess of the lit output when they ultimately fail.

The 2012-10-02-DAGCycle test is really frustrating because the *only*
explanation for what it is testing is a rdar link. I would really rather
that rdar links (which are not public or part of the open source
project) were not committed to the source code. Regardless, the actual
problem *must* be described as the rdar link is completely opaque. The
fact that this test didn't check for any particular output further
exacerbates the inability of any other developer to debug failures.

The mem-promote-integers test has nice comments and *seems* to be
a great test for our lowering... except that we don't actually check
that any of the generated code is correct or matches some pattern. We
just avoid crashing. It would be great to go back and populate this test
with the actual expectations.

llvm-svn: 214605

10 years ago[ASan] Use metadata to pass source-level information from Clang to ASan.
Alexey Samsonov [Sat, 2 Aug 2014 00:35:50 +0000 (00:35 +0000)]
[ASan] Use metadata to pass source-level information from Clang to ASan.

Instead of creating global variables for source locations and global names,
just create metadata nodes and strings. They will be transformed into actual
globals in the instrumentation pass (if necessary). This approach is more
flexible:
1) we don't have to ensure that our custom globals survive all the optimizations
2) if globals are discarded for some reason, we will simply ignore metadata for them
   and won't have to erase corresponding globals
3) metadata for source locations can be reused for other purposes: e.g. we may
   attach source location metadata to alloca instructions and provide better descriptions
   for stack variables in ASan error reports.

No functionality change.

llvm-svn: 214604

10 years agoAfter you attach, give the process plugin a chance to report back (through
Jim Ingham [Sat, 2 Aug 2014 00:33:35 +0000 (00:33 +0000)]
After you attach, give the process plugin a chance to report back (through
DidAttach) the architecture of the binary you attached to.

<rdar://problem/17891396>

llvm-svn: 214603

10 years ago[SDAG] Allow the legalizer to delete an illegally typed intermediate
Chandler Carruth [Sat, 2 Aug 2014 00:24:54 +0000 (00:24 +0000)]
[SDAG] Allow the legalizer to delete an illegally typed intermediate
introduced during legalization. This pattern is based on other patterns
in the legalizer that I changed in the same way. Now, the legalizer
eagerly collects its garbage when necessary so that we can survive
leaving such nodes around for it.

Instead, we add an assert to make sure the node will be correctly
handled by that layer.

llvm-svn: 214602

10 years ago[SDAG] Let the DAG combiner take care of dead nodes rather than manually
Chandler Carruth [Sat, 2 Aug 2014 00:19:10 +0000 (00:19 +0000)]
[SDAG] Let the DAG combiner take care of dead nodes rather than manually
deleting them. This already seems to work, as no tests fail without
this.

llvm-svn: 214601

10 years agoNow that setting an architecture from a mach-o CPU type and subtype doesn't set the...
Greg Clayton [Sat, 2 Aug 2014 00:15:37 +0000 (00:15 +0000)]
Now that setting an architecture from a mach-o CPU type and subtype doesn't set the OS type, make sure to set it.

llvm-svn: 214600

10 years agoAdd diagnostics to the vectorizer cost model.
Tyler Nowicki [Sat, 2 Aug 2014 00:14:03 +0000 (00:14 +0000)]
Add diagnostics to the vectorizer cost model.

When the cost model determines vectorization is not possible/profitable these remarks print an analysis of that decision.

Note that in selectVectorizationFactor() we can assume that OptForSize and ForceVectorization are mutually exclusive.

Reviewed by Arnold Schwaighofer

llvm-svn: 214599

10 years agoBitcodeTests: Fix LINK_COMPONENTS.
NAKAMURA Takumi [Sat, 2 Aug 2014 00:12:54 +0000 (00:12 +0000)]
BitcodeTests: Fix LINK_COMPONENTS.

llvm-svn: 214598

10 years agoverify-uselistorder: Reverse use-lists at every verification
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 23:49:41 +0000 (23:49 +0000)]
verify-uselistorder: Reverse use-lists at every verification

Updated `verify-uselistorder` to more than double the number of use-list
orders it checks.

  - Every time it verifies an order, it then reverses the order and
    verifies again.

  - It now verifies the initial order, before running any shuffles.

Changed the default to `-num-shuffles=1`, since this is already four
checks, and after r214584 shuffling is guaranteed to make a new order.

This is part of PR5680.

llvm-svn: 214596

10 years agoverify-uselistorder: Add missing `static`
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 23:31:13 +0000 (23:31 +0000)]
verify-uselistorder: Add missing `static`

llvm-svn: 214595

10 years agoIR: Add Value::reverseUseList()
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 23:28:49 +0000 (23:28 +0000)]
IR: Add Value::reverseUseList()

I'm going to use this to improve `verify-uselistorder`.  Part of PR5680.

llvm-svn: 214594

10 years agoPartiallyInlineLibCalls: Check sqrt result type before transforming it.
Peter Collingbourne [Fri, 1 Aug 2014 23:21:21 +0000 (23:21 +0000)]
PartiallyInlineLibCalls: Check sqrt result type before transforming it.

Some configure scripts declare this with the wrong prototype, which can lead
to an assertion failure.

llvm-svn: 214593

10 years agoverify-uselistorder: Move shuffleUseLists() out of lib/IR
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 23:03:36 +0000 (23:03 +0000)]
verify-uselistorder: Move shuffleUseLists() out of lib/IR

`shuffleUseLists()` is only used in `verify-uselistorder`, so move it
there to avoid bloating other executables.  As a drive-by, update some
of the header docs.

This is part of PR5680.

llvm-svn: 214592

10 years agoCleanup this test some more.
Adrian Prantl [Fri, 1 Aug 2014 23:01:32 +0000 (23:01 +0000)]
Cleanup this test some more.

llvm-svn: 214591

10 years agoAdd the missing target triple to this testcase.
Adrian Prantl [Fri, 1 Aug 2014 23:01:30 +0000 (23:01 +0000)]
Add the missing target triple to this testcase.

llvm-svn: 214590

10 years agoFix test from r214577 for other timezones
Ben Langmuir [Fri, 1 Aug 2014 22:58:19 +0000 (22:58 +0000)]
Fix test from r214577 for other timezones

Unsurprisingly, changing a file modification time to a specific
date/time doesn't give the same epoch time everywhere. Just make the
file move into the past and look at only the first few digits of the
epoch time.

llvm-svn: 214589

10 years agoAttempt to increase the overall happiness of the MSCV-based buildbots.
Adrian Prantl [Fri, 1 Aug 2014 22:56:10 +0000 (22:56 +0000)]
Attempt to increase the overall happiness of the MSCV-based buildbots.

llvm-svn: 214588

10 years agoverify-uselistorder: Make the verification logic easier to reuse
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 22:52:06 +0000 (22:52 +0000)]
verify-uselistorder: Make the verification logic easier to reuse

llvm-svn: 214587

10 years agoInstrProf: Update for LLVM API change
Justin Bogner [Fri, 1 Aug 2014 22:50:16 +0000 (22:50 +0000)]
InstrProf: Update for LLVM API change

We've added support for a multiple functions with the same name in
LLVM's profile data, so the lookup returning the function hash it
found doesn't make sense anymore. Update to pass in the hash we
expect.

This also adds a test that the version 1 format is still readable,
since the new API is expected to handle that.

llvm-svn: 214586

10 years agoInstrProf: Allow multiple functions with the same name
Justin Bogner [Fri, 1 Aug 2014 22:50:07 +0000 (22:50 +0000)]
InstrProf: Allow multiple functions with the same name

This updates the instrumentation based profiling format so that when
we have multiple functions with the same name (but different function
hashes) we keep all of them instead of rejecting the later ones.

There are a number of scenarios where this can come up where it's more
useful to keep multiple function profiles:

* Name collisions in unrelated libraries that are profiled together.
* Multiple "main" functions from multiple tools built against a common
  library.
* Combining profiles from different build configurations (ie, asserts
  and no-asserts)

The profile format now stores the number of counters between the hash
and the counts themselves, so that multiple sets of counts can be
stored. Since this is backwards incompatible, I've bumped the format
version and added some trivial logic to skip this when reading the old
format.

llvm-svn: 214585

10 years agoUseListOrder: Guarantee that shuffles change use-list order
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 22:50:04 +0000 (22:50 +0000)]
UseListOrder: Guarantee that shuffles change use-list order

Change shuffleUseLists() always to change use-list order by rejecting
orders that have no changes.

This is part of PR5680.

llvm-svn: 214584

10 years agoFixed a problem in the Clang AST importer where
Sean Callanan [Fri, 1 Aug 2014 22:42:38 +0000 (22:42 +0000)]
Fixed a problem in the Clang AST importer where
we overrode debug information as the authoritative
source for type information, substituting types
from the Objective-C runtime.  The runtime should
never be the primary source.

<rdar://problem/16065049>

llvm-svn: 214583

10 years agoNotional simplification: defer emitting deferred inline methods until we finish
Richard Smith [Fri, 1 Aug 2014 22:42:16 +0000 (22:42 +0000)]
Notional simplification: defer emitting deferred inline methods until we finish
emitting everything, rather than potentially doing this reentrantly.

llvm-svn: 214582

10 years agoUseListOrder: Fix blockaddress use-list order
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 22:27:19 +0000 (22:27 +0000)]
UseListOrder: Fix blockaddress use-list order

`parseBitcodeFile()` uses the generic `getLazyBitcodeFile()` function as
a helper.  Since `parseBitcodeFile()` isn't actually lazy -- it calls
`MaterializeAllPermanently()` -- bypass the unnecessary call to
`materializeForwardReferencedFunctions()` by extracting out a common
helper function.  This removes the last of the use-list churn caused by
blockaddresses.

This highlights that we can't reproduce use-list order of globals and
constants when parsing lazily -- but that's necessarily out of scope.
When we're parsing lazily, we never have all the functions in memory, so
the use-lists of globals (and constants that reference globals) are
always incomplete.

This is part of PR5680.

llvm-svn: 214581

10 years ago[X86] Simplify X87 stackifier pass.
Akira Hatanaka [Fri, 1 Aug 2014 22:19:41 +0000 (22:19 +0000)]
[X86] Simplify X87 stackifier pass.

Stop using ST registers for function returns and inline-asm instructions and use
FP registers instead. This allows removing a large amount of code in the
stackifier pass that was needed to track register liveness and handle copies
between ST and FP registers and function calls returning floating point values.

It also fixes a bug which manifests when an ST register defined by an
inline-asm instruction was live across another inline-asm instruction, as shown
in the following sequence of machine instructions:

1. INLINEASM <es:frndint> $0:[regdef], %ST0<imp-def,tied5>
2. INLINEASM <es:fldcw $0>
3. %FP0<def> = COPY %ST0

<rdar://problem/16952634>

llvm-svn: 214580

10 years agoActually fix problem with modules buildbot this time.
Richard Smith [Fri, 1 Aug 2014 22:17:28 +0000 (22:17 +0000)]
Actually fix problem with modules buildbot this time.

llvm-svn: 214579

10 years agollvm/test/CodeGen/Mips/cconv/arguments-varargs.ll: Add explicit -mtriple=(mips|mipsel...
NAKAMURA Takumi [Fri, 1 Aug 2014 22:15:38 +0000 (22:15 +0000)]
llvm/test/CodeGen/Mips/cconv/arguments-varargs.ll: Add explicit -mtriple=(mips|mipsel)-linux on 4 lines.

llvm-svn: 214578

10 years agoAdd -fbuild-session-file as an alternative to -fbuild-session-timestamp
Ben Langmuir [Fri, 1 Aug 2014 22:12:21 +0000 (22:12 +0000)]
Add -fbuild-session-file as an alternative to -fbuild-session-timestamp

Build systems tend to traffic in files and modification times, so having
them touch a file at the beginning of the build can be easier than
having them update the compile command they use every time they build.

llvm-svn: 214577

10 years agoDebug info: Infrastructure to support debug locations for fragmented
Adrian Prantl [Fri, 1 Aug 2014 22:11:58 +0000 (22:11 +0000)]
Debug info: Infrastructure to support debug locations for fragmented
variables (for example, by-value struct arguments passed in registers, or
large integer values split across several smaller registers).
On the IR level, this adds a new type of complex address operation OpPiece
to DIVariable that describes size and offset of a variable fragment.
On the DWARF emitter level, all pieces describing the same variable are
collected, sorted and emitted as DWARF expressions using the DW_OP_piece
and DW_OP_bit_piece operators.

http://reviews.llvm.org/D3373
rdar://problem/15928306

What this patch doesn't do / Future work:
- This patch only adds the backend machinery to make this work, patches
  that change SROA and SelectionDAG's type legalizer to actually create
  such debug info will follow. (http://reviews.llvm.org/D2680)
- Making the DIVariable complex expressions into an argument of dbg.value
  will reduce the memory footprint of the debug metadata.
- The sorting/uniquing of pieces should be moved into DebugLocEntry,
  to facilitate the merging of multi-piece entries.

llvm-svn: 214576

10 years agoDon't hand compute mydir, do it using "TestBase.compute_mydir(__file__)".
Greg Clayton [Fri, 1 Aug 2014 22:10:13 +0000 (22:10 +0000)]
Don't hand compute mydir, do it using "TestBase.compute_mydir(__file__)".

llvm-svn: 214575

10 years ago[SDAG] MorphNodeTo recursively deletes dead operands of the old
Chandler Carruth [Fri, 1 Aug 2014 22:09:43 +0000 (22:09 +0000)]
[SDAG] MorphNodeTo recursively deletes dead operands of the old
fromulation of the node, which isn't really the desired behavior from
within the combiner or legalizer, but is necessary within ISel. I've
added a hopefully helpful comment and fixed the only two places where
this took place.

Yet another step toward the combiner and legalizer not needing to use
update listeners with virtual calls to manage the worklists behind
legalization and combining.

llvm-svn: 214574

10 years ago[unwinder] Tell the assembler that functions are functions so that the linker knows...
Jonathan Roelofs [Fri, 1 Aug 2014 22:02:21 +0000 (22:02 +0000)]
[unwinder] Tell the assembler that functions are functions so that the linker knows how to link them.

This fixes an interworking problem when the unwinder/libcxxabi is built for
Thumb. When unw_getcontext is not marked as a function, 'bl' is used for the
branch instead of 'bx'.

llvm-svn: 214573

10 years agoRevert "R600: Move code for generating REGISTER_LOAD into R600ISelLowering.cpp"
Tom Stellard [Fri, 1 Aug 2014 21:55:50 +0000 (21:55 +0000)]
Revert "R600: Move code for generating REGISTER_LOAD into R600ISelLowering.cpp"

This reverts commit r214566.

I did not mean to commit this yet.

llvm-svn: 214572

10 years agoMS inline asm: Hide symbol to attempt to fix test failure on darwin
Reid Kleckner [Fri, 1 Aug 2014 21:54:37 +0000 (21:54 +0000)]
MS inline asm: Hide symbol to attempt to fix test failure on darwin

If the symbol comes from an external DSO, it apparently requires
indirection through a register.

llvm-svn: 214571

10 years agoBitcodeReader: Change mechanics of BlockAddress forward references, NFC
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 21:51:52 +0000 (21:51 +0000)]
BitcodeReader: Change mechanics of BlockAddress forward references, NFC

Now that we can reliably handle forward references to `BlockAddress`
(r214563), change the mechanics to simplify predicting use-list order.

Previously, we created dummy `GlobalVariable`s to represent block
addresses.  After every function was materialized, we'd go through any
forward references to its blocks and RAUW them with a proper
`BlockAddress` constant.  This causes some (potentially a lot of)
unnecessary use-list churn, since any constant expression that it's a
part of will need to be rematerialized as well.

Instead, pre-construct a `BasicBlock` immediately -- without attaching
it to its (empty) `Function` -- and use that to construct a
`BlockAddress`.  This constant will not have to be regenerated.  When
the function body is parsed, hook this pre-constructed basic block up
in the right place using `BasicBlock::insertInto()`.

Both before and after this change, the IR is temporarily in an invalid
state that gets resolved when `materializeForwardReferencedFunctions()`
gets called.

This is a prep commit that's part of PR5680, but the only functionality
change is the reduction of churn in the constant pool.

llvm-svn: 214570

10 years agoR600/SI: Remove leftover debugging code
Tom Stellard [Fri, 1 Aug 2014 21:51:05 +0000 (21:51 +0000)]
R600/SI: Remove leftover debugging code

llvm-svn: 214569

10 years agorelational: Add islessequal(floatN) builtin
Jan Vesely [Fri, 1 Aug 2014 21:50:59 +0000 (21:50 +0000)]
relational: Add islessequal(floatN) builtin

v2: remove the initial undef

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 214568

10 years agorelational: Add isless(floatN) builtin
Jan Vesely [Fri, 1 Aug 2014 21:50:55 +0000 (21:50 +0000)]
relational: Add isless(floatN) builtin

v2: remove the initial undef

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 214567

10 years agoR600: Move code for generating REGISTER_LOAD into R600ISelLowering.cpp
Tom Stellard [Fri, 1 Aug 2014 21:50:47 +0000 (21:50 +0000)]
R600: Move code for generating REGISTER_LOAD into R600ISelLowering.cpp

SI doesn't use REGISTER_LOAD anymore, but it was still hitting this code
path for 8-bit and 16-bit private loads.

llvm-svn: 214566

10 years agodocs: Strongly recommend setting rpath when using a local GCC toolchain
Reid Kleckner [Fri, 1 Aug 2014 21:40:53 +0000 (21:40 +0000)]
docs: Strongly recommend setting rpath when using a local GCC toolchain

Users keep emailing us about the difficulties of getting LD_LIBRARY_PATH
into their environment, which should be completely unecessary. Try to
strengthen the rpath recommentation by putting in an example cmake
invocation.

Speaking of which, we might want to make CMake the recommended build
system in GettingStarted.html.

llvm-svn: 214565

10 years ago[Sanitizer] Introduce SanitizerMetadata class.
Alexey Samsonov [Fri, 1 Aug 2014 21:35:28 +0000 (21:35 +0000)]
[Sanitizer] Introduce SanitizerMetadata class.

It is responsible for generating metadata consumed by sanitizer instrumentation
passes in the backend. Move several methods from CodeGenModule to SanitizerMetadata.
For now the class is stateless, but soon it won't be the case.

Instead of creating globals providing source-level information to ASan, we will create
metadata nodes/strings which will be turned into actual global variables in the
backend (if needed).

No functionality change.

llvm-svn: 214564

10 years agoIR: Add BasicBlock::insertInto()
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 21:22:04 +0000 (21:22 +0000)]
IR: Add BasicBlock::insertInto()

Although unlinked `BasicBlock`s can be created, there's currently no way
to insert them into `Function`s after the fact.  In particular,
`moveAfter()` and `moveBefore()` require that the basic block is already
linked.

Extract the logic for initially linking a `BasicBlock` out of the
constructor and into a member function that can be used for lazy
insertion.

  - Asserts that the basic block is currently unlinked.
  - Matches the logic of the constructor.
  - Changed the constructor to use it since the logic matches.

This is needed in a follow-up commit for PR5680.

llvm-svn: 214563

10 years agoLet's assume PowerPC has no SSE.
Joerg Sonnenberger [Fri, 1 Aug 2014 21:20:02 +0000 (21:20 +0000)]
Let's assume PowerPC has no SSE.

llvm-svn: 214562

10 years ago[dfsan] Correctly handle loads and stores of zero size.
Peter Collingbourne [Fri, 1 Aug 2014 21:18:18 +0000 (21:18 +0000)]
[dfsan] Correctly handle loads and stores of zero size.

llvm-svn: 214561

10 years agoAdd a non-const subtarget returning function to the target machine
Eric Christopher [Fri, 1 Aug 2014 21:18:01 +0000 (21:18 +0000)]
Add a non-const subtarget returning function to the target machine
so that we can use it to get the old-style JIT out of the subtarget.

This code should be removed when the old-style JIT is removed
(imminently).

llvm-svn: 214560

10 years agoBitcodeReader: Fix some BlockAddress forward reference corner cases
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 21:11:34 +0000 (21:11 +0000)]
BitcodeReader: Fix some BlockAddress forward reference corner cases

`BlockAddress`es are interesting in that they can reference basic blocks
from *outside* the block's function.  Since basic blocks are not global
values, this presents particular challenges for lazy parsing.

One corner case was found in PR11677 and fixed in r147425.  In that
case, a global variable references a block address.  It's necessary to
load the relevant function to resolve the forward reference before doing
anything with the module.

By inspection, I found (and have fixed here) two other cases:

  - An instruction from one function references a block address from
    another function, and only the first function is lazily loaded.

    I fixed this the same way as PR11677: by eagerly loading the
    referenced function.

  - A function whose block address is taken is dematerialized, leaving
    invalid references to it.

    I fixed this by refusing to dematerialize functions whose block
    addresses are taken (if you have to load it, you can't unload it).

llvm-svn: 214559

10 years agoTry to fix configure+make after r214556
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 21:06:59 +0000 (21:06 +0000)]
Try to fix configure+make after r214556

llvm-svn: 214558

10 years agoRewrite BitReaderTest, NFC
Duncan P. N. Exon Smith [Fri, 1 Aug 2014 21:01:04 +0000 (21:01 +0000)]
Rewrite BitReaderTest, NFC

Rewrite the single unit test in `BitReaderTest` so that it's easier to
add more tests.

  - Parse from an assembly string rather than using API.
  - Use more helper functions.
  - Use a separate context for the module on the other side.

Aside from relying on the assembly parser, there's no functionality
change intended.

llvm-svn: 214556

10 years agoRe-commit r214547 with tests fixed. Hopefully all the bots will be happy now.
Richard Smith [Fri, 1 Aug 2014 20:39:36 +0000 (20:39 +0000)]
Re-commit r214547 with tests fixed. Hopefully all the bots will be happy now.
Original message:

Fix iterator invalidation issues that are breaking my modules buildbot's
bootstrap.

llvm-svn: 214555

10 years agoMS inline asm: Tests for r214550
Reid Kleckner [Fri, 1 Aug 2014 20:23:29 +0000 (20:23 +0000)]
MS inline asm: Tests for r214550

These tests seem like an exception to the rule against assembly emitting
tests in clang.  I made an LLVM side change that can only be tested by
setting up the inline assembly machinery that is only implemented by
Clang.

llvm-svn: 214552

10 years agoMS inline asm: Add tests for LLVM r214468
Reid Kleckner [Fri, 1 Aug 2014 20:23:03 +0000 (20:23 +0000)]
MS inline asm: Add tests for LLVM r214468

This used to assert.

llvm-svn: 214551

10 years agoMS inline asm: Use memory constraints for functions instead of registers
Reid Kleckner [Fri, 1 Aug 2014 20:21:24 +0000 (20:21 +0000)]
MS inline asm: Use memory constraints for functions instead of registers

This is consistent with how we parse them in a standalone .s file, and
inline assembly shouldn't differ.

This fixes errors about requiring more registers than available in
cases like this:
  void f();
  void __declspec(naked) g() {
    __asm pusha
    __asm call f
    __asm popa
    __asm ret
  }

There are no registers available to pass the address of 'f' into the asm
blob.  The asm should now directly call 'f'.

Tests will land in Clang shortly.

llvm-svn: 214550

10 years agoRevert r214547 due to test breakage.
Richard Smith [Fri, 1 Aug 2014 20:09:39 +0000 (20:09 +0000)]
Revert r214547 due to test breakage.

llvm-svn: 214549

10 years agollvm-profdata: Replace redundant tests with more targeted ones
Justin Bogner [Fri, 1 Aug 2014 19:59:48 +0000 (19:59 +0000)]
llvm-profdata: Replace redundant tests with more targeted ones

llvm-svn: 214548

10 years agoFix iterator invalidation issues that are breaking my modules buildbot's bootstrap.
Richard Smith [Fri, 1 Aug 2014 19:59:14 +0000 (19:59 +0000)]
Fix iterator invalidation issues that are breaking my modules buildbot's bootstrap.

llvm-svn: 214547

10 years ago[SDAG] Begin simplifying the way in which the legalizer deletes nodes.
Chandler Carruth [Fri, 1 Aug 2014 19:49:59 +0000 (19:49 +0000)]
[SDAG] Begin simplifying the way in which the legalizer deletes nodes.

This lifts the (very few) places the legalizer would delete dead nodes
into the outer loop around the legalizer. This is significantly simpler
because it doesn't require the legalizer itself to manage the iterator
validity, and it doesn't require the legalizer to be a DAG update
listener in order to remove things from the legalized set. It also makes
the interface much less contrived for the case of the legalizer running
inside the last phase of DAG combining.

I'm working on centralizing the deletion of nodes during both legalizing
and combining as much as possible. My hope is to remove the need for DAG
update listeners from the combiner next, which would remove a costly
virtual dispatch chain on every deletion. This in turn should allow us
to more aggressively delete DAG nodes during combining which will in
turn allow us to combine more aggressively by exposing the actual nodes
which have single users to the combine phases.

llvm-svn: 214546

10 years ago[FastISel][AArch64] Fold offset into the memory operation.
Juergen Ributzka [Fri, 1 Aug 2014 19:40:16 +0000 (19:40 +0000)]
[FastISel][AArch64] Fold offset into the memory operation.

Fold simple offsets into the memory operation:
  add x0, x0, #8
  ldr x0, [x0]
-->
  ldr x0, [x0, #8]

Fixes <rdar://problem/17887945>.

llvm-svn: 214545

10 years agoAdd FreeBSD support to the address sanitizer's deep_stack_uaf.cc test case
Viktor Kutuzov [Fri, 1 Aug 2014 19:37:05 +0000 (19:37 +0000)]
Add FreeBSD support to the address sanitizer's deep_stack_uaf.cc test case
Differential Revision: http://reviews.llvm.org/D4668

llvm-svn: 214544

10 years agoFix the waitid sanitizer interceptor to work on FreeBSD in 32-bit mode
Viktor Kutuzov [Fri, 1 Aug 2014 19:33:14 +0000 (19:33 +0000)]
Fix the waitid sanitizer interceptor to work on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4670

llvm-svn: 214543

10 years agoInclude Archive.h
Rafael Espindola [Fri, 1 Aug 2014 19:28:15 +0000 (19:28 +0000)]
Include Archive.h

MSVC was complaining about Archive being an incomplete type.

llvm-svn: 214542

10 years agoFix building with in-tree libc++abi on FreeBSD
Viktor Kutuzov [Fri, 1 Aug 2014 19:23:15 +0000 (19:23 +0000)]
Fix building with in-tree libc++abi on FreeBSD
Differential Revision: http://reviews.llvm.org/D4743

llvm-svn: 214541

10 years agoMove virtual method out of line.
Rafael Espindola [Fri, 1 Aug 2014 18:49:24 +0000 (18:49 +0000)]
Move virtual method out of line.

Should fix the MSVC build.

llvm-svn: 214539

10 years agoAdd support for StackMap section for ELF/Linux systems
Philip Reames [Fri, 1 Aug 2014 18:47:09 +0000 (18:47 +0000)]
Add support for StackMap section for ELF/Linux systems

This patch adds code to emits the StackMap section on ELF systems. This section is required to support llvm.experimental.stackmap and llvm.experimental.patchpoint intrinsics.

Reviewers: ributzka, echristo

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

llvm-svn: 214538