platform/upstream/llvm.git
9 years ago[X86] Fix disassembly of absolute moves to work correctly in 16 and 32-bit modes...
Craig Topper [Wed, 31 Dec 2014 07:07:31 +0000 (07:07 +0000)]
[X86] Fix disassembly of absolute moves to work correctly in 16 and 32-bit modes with all 4 combinations of OpSize and AdSize prefixes being present or not.

llvm-svn: 225036

9 years ago[x86] Simplify detection of jcxz/jecxz/jrcxz in disassembler.
Craig Topper [Wed, 31 Dec 2014 07:07:11 +0000 (07:07 +0000)]
[x86] Simplify detection of jcxz/jecxz/jrcxz in disassembler.

llvm-svn: 225035

9 years agoInstCombine: try to transform A-B < 0 into A < B
David Majnemer [Wed, 31 Dec 2014 04:21:41 +0000 (04:21 +0000)]
InstCombine: try to transform A-B < 0 into A < B

We are allowed to move the 'B' to the right hand side if we an prove
there is no signed overflow and if the comparison itself is signed.

llvm-svn: 225034

9 years ago[llgo] Elide alloca for unused received values in select
Andrew Wilkins [Wed, 31 Dec 2014 03:46:49 +0000 (03:46 +0000)]
[llgo] Elide alloca for unused received values in select

Summary: If a receive case in a select statement is not assigned to a named variable, then we can eliminate the alloca and copy at runtime.

Test Plan: lit test added

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 225033

9 years agoRevert "merge consecutive stores of extracted vector elements"
Alexey Samsonov [Wed, 31 Dec 2014 00:40:28 +0000 (00:40 +0000)]
Revert "merge consecutive stores of extracted vector elements"

This reverts commit r224611. This change causes crashes
in X86 DAG->DAG Instruction Selection.

llvm-svn: 225031

9 years agoirgen: modify the ABI to use init guards instead of priority
Peter Collingbourne [Wed, 31 Dec 2014 00:25:39 +0000 (00:25 +0000)]
irgen: modify the ABI to use init guards instead of priority

The new ABI is simpler for use cases such as dynamically loaded packages.

The calling convention for import functions is similar to what go/ssa would
produce if BareInits were cleared. However, simply clearing this flag causes
two additional issues:

 1) We would need to special case the 'init$guard' variable (see
    discussion in https://codereview.appspot.com/78780043/).

 2) The call to __go_register_gc_roots needs to appear in the right
    place, i.e. after the guard check. Making this check appear
    in the right place with non-bare inits seems unreliable at best.

So we keep BareInits set and generate the necessary code manually.

It is still possible to get the old ABI by specifying a path to a gccgo
installation.

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

llvm-svn: 225030

9 years agoirgen: make it possible to use a custom importer
Peter Collingbourne [Wed, 31 Dec 2014 00:25:36 +0000 (00:25 +0000)]
irgen: make it possible to use a custom importer

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

llvm-svn: 225029

9 years agoirgen: return a types.Package to the compiler client
Peter Collingbourne [Wed, 31 Dec 2014 00:25:35 +0000 (00:25 +0000)]
irgen: return a types.Package to the compiler client

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

llvm-svn: 225028

9 years agoirgen: introduce ManglePackagePath function
Peter Collingbourne [Wed, 31 Dec 2014 00:25:34 +0000 (00:25 +0000)]
irgen: introduce ManglePackagePath function

This is useful for clients that need to use llgo's mangling of the package
path to look up a specific function within a given package.

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

llvm-svn: 225027

9 years agoirgen, driver: modify Compiler.Compile to take a FileSet and Files
Peter Collingbourne [Wed, 31 Dec 2014 00:25:32 +0000 (00:25 +0000)]
irgen, driver: modify Compiler.Compile to take a FileSet and Files

This change allows clients to generate IR using "files" received from locations
other than the file system. The regular file parser is moved to a new library,
"driver", which is intended to eventually contain much of the logic from
the existing driver.

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

llvm-svn: 225026

9 years ago[Hexagon] Adding accumulating add/sub, doubleword logic-not variants, doubleword...
Colin LeMahieu [Wed, 31 Dec 2014 00:08:34 +0000 (00:08 +0000)]
[Hexagon] Adding accumulating add/sub, doubleword logic-not variants, doubleword bitfield extract, word parity, accumulating multiplies with saturation.

llvm-svn: 225024

9 years agoUpdate the website with information about LLDB on Windows.
Zachary Turner [Wed, 31 Dec 2014 00:06:49 +0000 (00:06 +0000)]
Update the website with information about LLDB on Windows.

This patch updates the list of supported platforms to include
Windows, and also provides some detailed getting started instructions
for building LLDB on Windows.

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

llvm-svn: 225023

9 years agoFix HTML formatting and non-conformance.
Zachary Turner [Wed, 31 Dec 2014 00:06:41 +0000 (00:06 +0000)]
Fix HTML formatting and non-conformance.

llvm-svn: 225022

9 years agoHandle PPC64 return type (signext i32 rather than plain i32) in test case
David Blaikie [Wed, 31 Dec 2014 00:06:08 +0000 (00:06 +0000)]
Handle PPC64 return type (signext i32 rather than plain i32) in test case

llvm-svn: 225021

9 years agoFix a test case to not depend on asm comment syntax, so as to be portable
David Blaikie [Tue, 30 Dec 2014 23:33:55 +0000 (23:33 +0000)]
Fix a test case to not depend on asm comment syntax, so as to be portable

Too many different comment characters - instead of trying to account for
them all, instead disable the comments and just check for end-of-line
instead.

llvm-svn: 225020

9 years agoGeneralize even further, for ARM comment syntax (@)
David Blaikie [Tue, 30 Dec 2014 23:23:58 +0000 (23:23 +0000)]
Generalize even further, for ARM comment syntax (@)

llvm-svn: 225019

9 years ago[Hexagon] Adding double-logic on predicate instructions.
Colin LeMahieu [Tue, 30 Dec 2014 23:22:39 +0000 (23:22 +0000)]
[Hexagon] Adding double-logic on predicate instructions.

llvm-svn: 225018

9 years agoGeneralize test case to handle different asm syntax (# or // comments)
David Blaikie [Tue, 30 Dec 2014 23:21:57 +0000 (23:21 +0000)]
Generalize test case to handle different asm syntax (# or // comments)

llvm-svn: 225017

9 years ago[asan] fix coverage between fork() and exec(): reinitialize the guards after fork()
Kostya Serebryany [Tue, 30 Dec 2014 23:16:12 +0000 (23:16 +0000)]
[asan] fix coverage between fork() and exec(): reinitialize the guards after fork()

llvm-svn: 225016

9 years ago[Hexagon] Adding newvalue compare and jumps.
Colin LeMahieu [Tue, 30 Dec 2014 23:04:21 +0000 (23:04 +0000)]
[Hexagon] Adding newvalue compare and jumps.

llvm-svn: 225015

9 years agoRTDyldMemoryManager.cpp: Make the reference to __morestack weak.
Peter Collingbourne [Tue, 30 Dec 2014 22:52:33 +0000 (22:52 +0000)]
RTDyldMemoryManager.cpp: Make the reference to __morestack weak.

This fixes the DSO build for now. Eventually we should develop some
other mechanism to make this work correctly with DSOs.

llvm-svn: 225014

9 years agoDriver: unify compiler-rt component selection
Saleem Abdulrasool [Tue, 30 Dec 2014 22:52:08 +0000 (22:52 +0000)]
Driver: unify compiler-rt component selection

Unify the component handling for compiler-rt.  The components are regularly
named, built up from:

  ${LIBRARY_PREFIX}clang_rt.${component}-${arch}[-${environment}]${LIBRARY_SUFFIX}

Unify the handling for all the various components, into a single path to link
against the various components in a number of places.  This reduces duplication
of the clang_rt library name construction logic.

llvm-svn: 225013

9 years agoDriver: whitespace
Saleem Abdulrasool [Tue, 30 Dec 2014 22:52:06 +0000 (22:52 +0000)]
Driver: whitespace

Fixup some whitespace/style issues.  NFC.

llvm-svn: 225012

9 years agoDebugInfo: Omit is_stmt from line table entries on the same line.
David Blaikie [Tue, 30 Dec 2014 22:47:13 +0000 (22:47 +0000)]
DebugInfo: Omit is_stmt from line table entries on the same line.

GCC does this for non-zero discriminators and since GCC doesn't produce
column info, that was the only place it comes up there. For LLVM, since
we can emit discriminators and/or column info, it makes more sense to
invert the condition and just test for changes in line number.

This should resolve at least some of the GDB 7.5 test suite failures
created by recent Clang changes that increase the location fidelity
(which, since Clang defaults to including column info on Linux by
default created a bunch of cases that confused GDB).

In theory we could do this better/differently by grouping actual source
statements together in a similar manner to the way lexical scopes are
handled but given that GDB isn't really in a position to consume that (&
users are probably somewhat used to different lines being different
'statements') this seems the safest and cheapest change. (I'm concerned
that doing this 'right' would bloat the debugloc data even further -
something Duncan's working hard to address)

llvm-svn: 225011

9 years ago[Hexagon] Adding postincrement register newvalue stores.
Colin LeMahieu [Tue, 30 Dec 2014 22:34:08 +0000 (22:34 +0000)]
[Hexagon] Adding postincrement register newvalue stores.

llvm-svn: 225010

9 years ago[Hexagon] Removing old newvalue store variants. Adding postincrement immediate newva...
Colin LeMahieu [Tue, 30 Dec 2014 22:28:31 +0000 (22:28 +0000)]
[Hexagon] Removing old newvalue store variants.  Adding postincrement immediate newvalue stores.

llvm-svn: 225009

9 years ago[mips][microMIPS] Relocate with symbol for micromips symbols
Zoran Jovanovic [Tue, 30 Dec 2014 22:04:16 +0000 (22:04 +0000)]
[mips][microMIPS] Relocate with symbol for micromips symbols
Differential Revision: http://reviews.llvm.org/D6796

llvm-svn: 225008

9 years ago[Hexagon] Adding indexed store new-value variants.
Colin LeMahieu [Tue, 30 Dec 2014 22:00:26 +0000 (22:00 +0000)]
[Hexagon] Adding indexed store new-value variants.

llvm-svn: 225007

9 years ago[Hexagon] Adding indexed store of immediates.
Colin LeMahieu [Tue, 30 Dec 2014 21:01:38 +0000 (21:01 +0000)]
[Hexagon] Adding indexed store of immediates.

llvm-svn: 225006

9 years ago[Hexagon] Adding indexed stores.
Colin LeMahieu [Tue, 30 Dec 2014 20:42:23 +0000 (20:42 +0000)]
[Hexagon] Adding indexed stores.

llvm-svn: 225005

9 years agoRemove a comment that appears a second time 22 lines further down.
Nico Weber [Tue, 30 Dec 2014 20:13:37 +0000 (20:13 +0000)]
Remove a comment that appears a second time 22 lines further down.

llvm-svn: 225004

9 years agox86_64: Fix calls to __morestack under the large code model.
Peter Collingbourne [Tue, 30 Dec 2014 20:05:19 +0000 (20:05 +0000)]
x86_64: Fix calls to __morestack under the large code model.

Under the large code model, we cannot assume that __morestack lives within
2^31 bytes of the call site, so we cannot use pc-relative addressing. We
cannot perform the call via a temporary register, as the rax register may
be used to store the static chain, and all other suitable registers may be
either callee-save or used for parameter passing. We cannot use the stack
at this point either because __morestack manipulates the stack directly.

To avoid these issues, perform an indirect call via a read-only memory
location containing the address.

This solution is not perfect, as it assumes that the .rodata section
is laid out within 2^31 bytes of each function body, but this seems to
be sufficient for JIT.

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

llvm-svn: 225003

9 years ago[asan] add flag coverage_pcs. When false, the coverage is not dumped as PCs. Useful...
Kostya Serebryany [Tue, 30 Dec 2014 19:55:04 +0000 (19:55 +0000)]
[asan] add flag coverage_pcs. When false, the coverage is not dumped as PCs. Useful e.g. if the user only needs coverage is bitset

llvm-svn: 225002

9 years agoReapply debug info changes now that more precise column information is available.
David Blaikie [Tue, 30 Dec 2014 19:54:25 +0000 (19:54 +0000)]
Reapply debug info changes now that more precise column information is available.

(recommitting as the Clang patch is back in with the latest fix -
hopefully it sticks)

llvm-svn: 225001

9 years agoReapply "DebugInfo: Generalize debug info location handling"
David Blaikie [Tue, 30 Dec 2014 19:39:33 +0000 (19:39 +0000)]
Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Recommitted in r224941 and reverted in r224970 after it caused a crash
when building compiler-rt. Looks to be due to this change zeroing out
the debug location when emitting default arguments (which were meant to
inherit their outer expression's location) thus creating call
instructions without locations - these create problems for inlining and
must not be created. That is fixed and tested in this version of the
change.

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

llvm-svn: 225000

9 years ago[asan] change _sanitizer_cov_module_init to accept int* instead of int**
Kostya Serebryany [Tue, 30 Dec 2014 19:29:28 +0000 (19:29 +0000)]
[asan] change _sanitizer_cov_module_init to accept int* instead of int**

llvm-svn: 224999

9 years ago[COFF] Don't try to add quotes to already quoted linker directives
Michael Kuperstein [Tue, 30 Dec 2014 19:23:48 +0000 (19:23 +0000)]
[COFF] Don't try to add quotes to already quoted linker directives

If a linker directive is already quoted, don't try to quote it again, otherwise it creates a mess.
This pops up in places like:
#pragma comment(linker,"\"/foo bar'\"")

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

llvm-svn: 224998

9 years ago[Hexagon] Adding reg-reg indexed load forms.
Colin LeMahieu [Tue, 30 Dec 2014 18:58:47 +0000 (18:58 +0000)]
[Hexagon] Adding reg-reg indexed load forms.

llvm-svn: 224997

9 years agoDriver: use the canonical library prefix on Windows
Saleem Abdulrasool [Tue, 30 Dec 2014 18:55:37 +0000 (18:55 +0000)]
Driver: use the canonical library prefix on Windows

Unlike Unices, Windows does not use a library prefix.  Use the traditional
naming scheme even for Windows itanium environments.  This makes the builtins
behave more like the sanitisers as well.

llvm-svn: 224996

9 years agoAdd non-const version getFileSystemOpts() access function.
Yaron Keren [Tue, 30 Dec 2014 18:46:42 +0000 (18:46 +0000)]
Add non-const version getFileSystemOpts() access function.
All the other get*Opts have both versions.

llvm-svn: 224995

9 years agoThe __morestack function is only available on i386 and x86_64 architectures.
Peter Collingbourne [Tue, 30 Dec 2014 18:22:06 +0000 (18:22 +0000)]
The __morestack function is only available on i386 and x86_64 architectures.

llvm-svn: 224994

9 years agoMake the __morestack function available to the JIT memory manager under Linux.
Peter Collingbourne [Tue, 30 Dec 2014 18:06:52 +0000 (18:06 +0000)]
Make the __morestack function available to the JIT memory manager under Linux.

This function's implementation lives in libgcc, a static library, so we need
to expose it explicitly, like the other such functions.

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

llvm-svn: 224993

9 years ago[Hexagon] Dropping old combine instructions without encodings.
Colin LeMahieu [Tue, 30 Dec 2014 17:53:54 +0000 (17:53 +0000)]
[Hexagon] Dropping old combine instructions without encodings.

llvm-svn: 224992

9 years ago[Hexagon] Adding compare byte/halfword reg-reg/reg-imm forms. Adding compare to...
Colin LeMahieu [Tue, 30 Dec 2014 17:39:24 +0000 (17:39 +0000)]
[Hexagon] Adding compare byte/halfword reg-reg/reg-imm forms.  Adding compare to general register reg-imm form.

llvm-svn: 224991

9 years agoCleanup lldb-mi test cases.
Hafiz Abid Qadeer [Tue, 30 Dec 2014 17:11:31 +0000 (17:11 +0000)]
Cleanup lldb-mi test cases.
Following changes were done.
1. Remove the extra line after -exec-run.
2. Remove check for prompt.
3. Remove 'quit' command.

Initial patch was contributed by ki.stfu@gmail.com.

llvm-svn: 224990

9 years ago[Hexagon] Updating constant extender def, adding alu-not instructions, compare to...
Colin LeMahieu [Tue, 30 Dec 2014 15:44:17 +0000 (15:44 +0000)]
[Hexagon] Updating constant extender def, adding alu-not instructions, compare to general register, and inverted compares.

llvm-svn: 224989

9 years agoFollow-up to r224987: fix a lint warning
Timur Iskhodzhanov [Tue, 30 Dec 2014 15:30:19 +0000 (15:30 +0000)]
Follow-up to r224987: fix a lint warning

llvm-svn: 224988

9 years ago[ASan/Win] Sort the list of modules when we fail to reserve the shadow memory range
Timur Iskhodzhanov [Tue, 30 Dec 2014 14:44:12 +0000 (14:44 +0000)]
[ASan/Win] Sort the list of modules when we fail to reserve the shadow memory range

llvm-svn: 224987

9 years agoSome code improvements in Masked Load/Store.
Elena Demikhovsky [Tue, 30 Dec 2014 14:28:14 +0000 (14:28 +0000)]
Some code improvements in Masked Load/Store.
No functional changes.

llvm-svn: 224986

9 years agoRemove doesSectionRequireSymbols.
Rafael Espindola [Tue, 30 Dec 2014 13:13:27 +0000 (13:13 +0000)]
Remove doesSectionRequireSymbols.

In an assembly expression like

bar:
.long L0 + 1

the intended semantics is that bar will contain a pointer one byte past L0.

In sections that are merged by content (strings, 4 byte constants, etc), a
single position in the section doesn't give the linker enough information.
For example, it would not be able to tell a relocation must point to the
end of a string, since that would look just like the start of the next.

The solution used in ELF to use relocation with symbols if there is a non-zero
addend.

In MachO before this patch we would just keep all symbols in some sections.

This would miss some cases (only cstrings on x86_64 were implemented) and was
inefficient since most relocations have an addend of 0 and can be represented
without the symbol.

This patch implements the non-zero addend logic for MachO too.

llvm-svn: 224985

9 years agoreverted prev commit (it was a mistake)
Elena Demikhovsky [Tue, 30 Dec 2014 10:17:21 +0000 (10:17 +0000)]
reverted prev commit (it was a mistake)

llvm-svn: 224984

9 years agov
Elena Demikhovsky [Tue, 30 Dec 2014 10:13:38 +0000 (10:13 +0000)]
v

llvm-svn: 224983

9 years agoAdd a public accessor for GlobalCtors in CodeGenModule
Keno Fischer [Tue, 30 Dec 2014 08:12:39 +0000 (08:12 +0000)]
Add a public accessor for GlobalCtors in CodeGenModule

Summary:
In a JIT context it is useful to be able to access the GlobalCtors
and especially clear them once they have been emitted and called.
This adds a public method to be able to access the list.

Subscribers: yaron.keren, cfe-commits

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

llvm-svn: 224982

9 years agoAdd IRBuilder routines for gc.statepoints, gc.results, and gc.relocates
Philip Reames [Tue, 30 Dec 2014 05:55:58 +0000 (05:55 +0000)]
Add IRBuilder routines for gc.statepoints, gc.results, and gc.relocates

Nothing particularly interesting, just adding infrastructure for use by in tree users and out of tree users.

Note: These were extracted out of a working frontend, but they have not been well tested in isolation.

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

llvm-svn: 224981

9 years agoSimplify test a bit.
Rafael Espindola [Tue, 30 Dec 2014 05:09:17 +0000 (05:09 +0000)]
Simplify test a bit.

It looks like the original intent was to check which symbols were created.
With macho-dump the sections were being checked just to match which symbol
was in which section.

llvm-objdump prints the section a symbol is in.

llvm-svn: 224980

9 years ago[OCaml] Fix bitrot in tests.
Peter Zotov [Tue, 30 Dec 2014 03:24:14 +0000 (03:24 +0000)]
[OCaml] Fix bitrot in tests.

llvm-svn: 224979

9 years ago[lit] Make config.llvm_lib_dir available on cmake, too.
Peter Zotov [Tue, 30 Dec 2014 03:24:11 +0000 (03:24 +0000)]
[lit] Make config.llvm_lib_dir available on cmake, too.

The OCaml tests require config.llvm_lib_dir to determine
the OCaml package search path.

llvm-svn: 224978

9 years ago[OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.
Peter Zotov [Tue, 30 Dec 2014 03:24:07 +0000 (03:24 +0000)]
[OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.

The latter variable is internal.

Original patch by Ramkumar Ramachandra <artagnon@gmail.com>

llvm-svn: 224977

9 years agoTestcases for r224939.
Craig Topper [Tue, 30 Dec 2014 02:35:56 +0000 (02:35 +0000)]
Testcases for r224939.

llvm-svn: 224976

9 years agoDriver: unify addClangRT{Linux,Windows}
Saleem Abdulrasool [Tue, 30 Dec 2014 02:10:36 +0000 (02:10 +0000)]
Driver: unify addClangRT{Linux,Windows}

The differences are pretty superficial:
- .lib vs .a extensions
- whether or not to link (potentially) incorrectly against libgcc_s

llvm-svn: 224975

9 years agoDon't crash on an invalid trailing return type on a function before a '...'
Nico Weber [Tue, 30 Dec 2014 02:06:40 +0000 (02:06 +0000)]
Don't crash on an invalid trailing return type on a function before a '...'

clang tries to produce a helpful diagnostic for the traiilng '...', but the
code that r216778 added for this doesn't expect an invalid trailing return type.
Add code to explicitly handle this.

Having explicit code for this but not for other things looks a bit strange, but
trailing return types are special in that they have a separate existence bit in
addition to the type (see r158348).

llvm-svn: 224974

9 years agoConvert test to llvm-readobj. NFC.
Rafael Espindola [Tue, 30 Dec 2014 01:34:06 +0000 (01:34 +0000)]
Convert test to llvm-readobj. NFC.

llvm-svn: 224973

9 years agoRevert "UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases"
Alexey Samsonov [Tue, 30 Dec 2014 00:33:50 +0000 (00:33 +0000)]
Revert "UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases"

This reverts commit r221445. This change leads to false positives
reports from -fsanitize=vptr. See original commit thread for more
details.

llvm-svn: 224972

9 years agoSemantic tests for memory invalidation at statepoints
Philip Reames [Mon, 29 Dec 2014 23:55:33 +0000 (23:55 +0000)]
Semantic tests for memory invalidation at statepoints

These are simply a collection of tests intended to show that information about the contents of gc references in the heap is lost at a statepoint. I've tried to write them so that they don't disallow correct transformations, while still being fairly easy to understand.

p.s. Ideas for additional tests are welcome.

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

llvm-svn: 224971

9 years agoRevert "DebugInfo: Generalize debug info location handling"
David Blaikie [Mon, 29 Dec 2014 23:49:00 +0000 (23:49 +0000)]
Revert "DebugInfo: Generalize debug info location handling"

Asserting when building compiler-rt when using a GCC host compiler.
Reverting while I investigate.

This reverts commit r224941.

llvm-svn: 224970

9 years agoRevert "Reapply debug info changes now that r224385 has been recommitted to clang...
David Blaikie [Mon, 29 Dec 2014 23:48:46 +0000 (23:48 +0000)]
Revert "Reapply debug info changes now that r224385 has been recommitted to clang (in r224941)"

Asserting when building compiler-rt when using a gcc host compiler.
Reverting while I investigate.

This reverts commit r224942.

llvm-svn: 224969

9 years agoCarry facts about nullness and undef across GC relocation
Philip Reames [Mon, 29 Dec 2014 23:27:30 +0000 (23:27 +0000)]
Carry facts about nullness and undef across GC relocation

This change implements four basic optimizations:

    If a relocated value isn't used, it doesn't need to be relocated.
    If the value being relocated is null, relocation doesn't change that. (Technically, this might be collector specific. I don't know of one which it doesn't work for though.)
    If the value being relocated is undef, the relocation is meaningless.
    If the value being relocated was known nonnull, the relocated pointer also isn't null. (Since it points to the same source language object.)

I outlined other planned work in comments.

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

llvm-svn: 224968

9 years agoFix build breakage
David Majnemer [Mon, 29 Dec 2014 23:24:27 +0000 (23:24 +0000)]
Fix build breakage

That's what I get for last second changes...

llvm-svn: 224967

9 years agoParse: Recover more gracefully from extra :: tokens before a {
David Majnemer [Mon, 29 Dec 2014 23:12:23 +0000 (23:12 +0000)]
Parse: Recover more gracefully from extra :: tokens before a {

Instead of crashing, recover by eating the extra trailing scope
qualifier.  This means we will treat 'struct A:: {' as 'struct A {'.

llvm-svn: 224966

9 years agoRefine the notion of MayThrow in LICM to include a header specific version
Philip Reames [Mon, 29 Dec 2014 23:00:57 +0000 (23:00 +0000)]
Refine the notion of MayThrow in LICM to include a header specific version

In LICM, we have a check for an instruction which is guaranteed to execute and thus can't introduce any new faults if moved to the preheader. To handle a function which might unconditionally throw when first called, we check for any potentially throwing call in the loop and give up.

This is unfortunate when the potentially throwing condition is down a rare path. It prevents essentially all LICM of potentially faulting instructions where the faulting condition is checked outside the loop. It also greatly diminishes the utility of loop unswitching since control dependent instructions - which are now likely in the loops header block - will not be lifted by subsequent LICM runs.

define void @nothrow_header(i64 %x, i64 %y, i1 %cond) {
; CHECK-LABEL: nothrow_header
; CHECK-LABEL: entry
; CHECK: %div = udiv i64 %x, %y
; CHECK-LABEL: loop
; CHECK: call void @use(i64 %div)
entry:
  br label %loop
loop: ; preds = %entry, %for.inc
  %div = udiv i64 %x, %y
  br i1 %cond, label %loop-if, label %exit
loop-if:
  call void @use(i64 %div)
  br label %loop
exit:
  ret void
}

The current patch really only helps with non-memory instructions (i.e. divs, etc..) since the maythrow call down the rare path will be considered to alias an otherwise hoistable load.  The one exception is that it does kick in for loads which are known to be invariant without regard to other possible stores, i.e. those marked with either !invarant.load metadata of tbaa 'is constant memory' metadata.

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

llvm-svn: 224965

9 years ago[cmake/multilib] Teach llgo to respect the LLVM_LIBDIR_SUFFIX variable for
Chandler Carruth [Mon, 29 Dec 2014 22:57:21 +0000 (22:57 +0000)]
[cmake/multilib] Teach llgo to respect the LLVM_LIBDIR_SUFFIX variable for
multilib build and installs.

Summary:
This requires introducing a generated header to encapsulate the
LLVM_LIBDIR_SUFFIX value from the build system and push it into the go
code. From there, I've adjusted the gllgo code to systematically use
this rather than a raw "lib". This requires some awkwardness as one of
the flags *must* be "lib"-relative for compatibility with how gccgo
works. For that flag, we use ".." to back up a directory and then go
into the proper lib directory.

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

llvm-svn: 224964

9 years agoPR22051: Missing debug location on calls in dtor thunks in Windows.
David Blaikie [Mon, 29 Dec 2014 22:53:52 +0000 (22:53 +0000)]
PR22051: Missing debug location on calls in dtor thunks in Windows.

llvm-svn: 224963

9 years ago[go] Teach the go cmake build functions to funnel the include directories down into...
Chandler Carruth [Mon, 29 Dec 2014 22:50:30 +0000 (22:50 +0000)]
[go] Teach the go cmake build functions to funnel the include directories down into the cgo-setup variables of llvm-go.

Summary:
This in turn allows us to use #includes with cgo that rely on CMake
provided include directories which is particularly useful for handling
generated headers that aren't reasonable to put in an "installable"
location.

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

llvm-svn: 224962

9 years agoLoading from null is valid outside of addrspace 0
Philip Reames [Mon, 29 Dec 2014 22:46:21 +0000 (22:46 +0000)]
Loading from null is valid outside of addrspace 0

This patches fixes a miscompile where we were assuming that loading from null is undefined and thus we could assume it doesn't happen.  This transform is perfectly legal in address space 0, but is not neccessarily legal in other address spaces.

We really should introduce a hook to control this property on a per target per address space basis.  We may be loosing valuable optimizations in some address spaces by being too conservative.

Original patch by Thomas P Raoux (submitted to llvm-commits), tests and formatting fixes by me.

llvm-svn: 224961

9 years agoUse std::find_if instead of manual loop.
David Blaikie [Mon, 29 Dec 2014 22:39:45 +0000 (22:39 +0000)]
Use std::find_if instead of manual loop.

llvm-svn: 224960

9 years agoConvert test to llvm-readobj. NFC.
Rafael Espindola [Mon, 29 Dec 2014 22:14:35 +0000 (22:14 +0000)]
Convert test to llvm-readobj. NFC.

llvm-svn: 224959

9 years agoCrash even less on malformed attributes in an incorrect location.
Nico Weber [Mon, 29 Dec 2014 21:56:22 +0000 (21:56 +0000)]
Crash even less on malformed attributes in an incorrect location.

This is a follow-up to r224915.  This adds a bit more line noise to the tests
added in that revision to make sure the parser is ready for a toplevel decl
after each incorrect line.  Use this to move the tests up to where they belong.
This uncovered that the early return was missing a call to
ActOnTagDefinitionError(), so add that. (Also fixes at least one of the crashes
on SLi's bot.)

llvm-svn: 224958

9 years ago[Hexagon] Adding allocframe, post-increment circular immediate stores, post-increment...
Colin LeMahieu [Mon, 29 Dec 2014 21:33:45 +0000 (21:33 +0000)]
[Hexagon] Adding allocframe, post-increment circular immediate stores, post-increment circular register stores, and bit reversed post-increment stores.

llvm-svn: 224957

9 years agoFix use-after-destruction introduced in r224924.
Alexey Samsonov [Mon, 29 Dec 2014 21:28:15 +0000 (21:28 +0000)]
Fix use-after-destruction introduced in r224924.

getMainExecutable() returns a std::string, assigning its result
to StringRef immediately creates a dangling pointer. This was
detected by half-broken fast-MSan-bootstrap bot.

llvm-svn: 224956

9 years ago[Hexagon] Fixing 224952 where an addressing mode update was missed.
Colin LeMahieu [Mon, 29 Dec 2014 21:18:02 +0000 (21:18 +0000)]
[Hexagon] Fixing 224952 where an addressing mode update was missed.

llvm-svn: 224955

9 years agoDriver: convert a couple more instances to range based loops
Saleem Abdulrasool [Mon, 29 Dec 2014 21:02:47 +0000 (21:02 +0000)]
Driver: convert a couple more instances to range based loops

More conversion to range based for loops rather than direct iterators with
dereferencing.  NFC.

llvm-svn: 224954

9 years agoRemove unnecessary StringRef->std::string conversion.
Alexey Samsonov [Mon, 29 Dec 2014 20:59:02 +0000 (20:59 +0000)]
Remove unnecessary StringRef->std::string conversion.

llvm-svn: 224953

9 years ago[Hexagon] Adding post-increment register form stores and register-immediate form...
Colin LeMahieu [Mon, 29 Dec 2014 20:44:51 +0000 (20:44 +0000)]
[Hexagon] Adding post-increment register form stores and register-immediate form stores with tests.

llvm-svn: 224952

9 years ago[Hexagon] Replacing the remaining postincrement stores with versions that have encodi...
Colin LeMahieu [Mon, 29 Dec 2014 20:00:43 +0000 (20:00 +0000)]
[Hexagon] Replacing the remaining postincrement stores with versions that have encoding bits.

llvm-svn: 224951

9 years agoConvert test to FileCheck. NFC.
Rafael Espindola [Mon, 29 Dec 2014 19:50:32 +0000 (19:50 +0000)]
Convert test to FileCheck. NFC.

llvm-svn: 224950

9 years ago[Hexagon] Renaming old multiclass for removal. Adding post-increment store classes...
Colin LeMahieu [Mon, 29 Dec 2014 19:42:14 +0000 (19:42 +0000)]
[Hexagon] Renaming old multiclass for removal.  Adding post-increment store classes and instruction defs.

llvm-svn: 224949

9 years ago[py3] Teach the CMake build to reject Python versions older than 2.7.
Chandler Carruth [Mon, 29 Dec 2014 19:36:05 +0000 (19:36 +0000)]
[py3] Teach the CMake build to reject Python versions older than 2.7.
Continue to require Python 2 however as recent experiments suggest
LLDB's build requires it.

llvm-svn: 224948

9 years ago[py3] Make this test compatible with Python 3 where bytes and
Chandler Carruth [Mon, 29 Dec 2014 19:23:31 +0000 (19:23 +0000)]
[py3] Make this test compatible with Python 3 where bytes and
strings don't mix so easily. This fixes the last remaining failure
I have in 'check-all' on a system with both Python3 and and Python2
installed.

llvm-svn: 224947

9 years agoRemove darwin_fat.mk.
Alexey Samsonov [Mon, 29 Dec 2014 19:21:59 +0000 (19:21 +0000)]
Remove darwin_fat.mk.

Summary:
Its seems to be replaced by clang_darwin.mk in the Makefile-based
build, and is only referenced in unittest scripts, which are
broken for a long time now.

Test Plan: n/a

Reviewers: bob.wilson

Subscribers: llvm-commits

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

llvm-svn: 224946

9 years agoParse: Ignore '::' in 'struct :: {'
David Majnemer [Mon, 29 Dec 2014 19:19:18 +0000 (19:19 +0000)]
Parse: Ignore '::' in 'struct :: {'

Let's pretend that we didn't see the '::' instead of go on believing
that we've got some anonymous, but globally qualified, struct.

llvm-svn: 224945

9 years agoDriver: convert a number of loops to range based
Saleem Abdulrasool [Mon, 29 Dec 2014 19:01:36 +0000 (19:01 +0000)]
Driver: convert a number of loops to range based

Iterate over the arguments via range based for loops rather than iterators and
explicitly dereferencing them.  NFC.

llvm-svn: 224944

9 years agoAdd an assertion to verify a container is non-empty before calling 'back()'
David Blaikie [Mon, 29 Dec 2014 18:37:03 +0000 (18:37 +0000)]
Add an assertion to verify a container is non-empty before calling 'back()'

This would've helped stabilize/deflake some failures that were seen
after some recent changes.

llvm-svn: 224943

9 years agoReapply debug info changes now that r224385 has been recommitted to clang (in r224941)
David Blaikie [Mon, 29 Dec 2014 18:19:36 +0000 (18:19 +0000)]
Reapply debug info changes now that r224385 has been recommitted to clang (in r224941)

llvm-svn: 224942

9 years agoReapply "DebugInfo: Generalize debug info location handling"
David Blaikie [Mon, 29 Dec 2014 18:18:45 +0000 (18:18 +0000)]
Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

llvm-svn: 224941

9 years ago[X86] Fix some cases where some 8-bit instructions were marked as being convertible...
Craig Topper [Mon, 29 Dec 2014 16:25:26 +0000 (16:25 +0000)]
[X86] Fix some cases where some 8-bit instructions were marked as being convertible to three address instructions, but aren't really.

llvm-svn: 224940

9 years ago[X86] Add the 0x82 instructions to the disassebmler. They are identical in functional...
Craig Topper [Mon, 29 Dec 2014 16:25:23 +0000 (16:25 +0000)]
[X86] Add the 0x82 instructions to the disassebmler. They are identical in functionality to the 0x80 opcode instructions, but are not valid in 64-bit mode.

llvm-svn: 224939

9 years ago[x86] Refactor some tablegen instruction info classes slightly to prepare for another...
Craig Topper [Mon, 29 Dec 2014 16:25:22 +0000 (16:25 +0000)]
[x86] Refactor some tablegen instruction info classes slightly to prepare for another change. NFC.

llvm-svn: 224938

9 years ago[x86] Remove unused classes from tablegen instruction info.
Craig Topper [Mon, 29 Dec 2014 16:25:19 +0000 (16:25 +0000)]
[x86] Remove unused classes from tablegen instruction info.

llvm-svn: 224937

9 years agoAdd segmented stack support for DragonFlyBSD.
Rafael Espindola [Mon, 29 Dec 2014 15:47:28 +0000 (15:47 +0000)]
Add segmented stack support for DragonFlyBSD.

Patch by Michael Neumann.

llvm-svn: 224936

9 years agoRefactor duplicated code.
Rafael Espindola [Mon, 29 Dec 2014 15:18:31 +0000 (15:18 +0000)]
Refactor duplicated code.

No intended functionality change.

llvm-svn: 224935