Commit Graph

170607 Commits

Author SHA1 Message Date
Erik Verbruggen e706b88304 Simplify loop that worked around bugs in old GCC/Xcode.
GCC 4.0.1 and Xcode 2 are no longer supported for building llvm/clang.

llvm-svn: 204705
2014-03-25 09:06:18 +00:00
Yaron Keren 24fdbe5676 Disable Visual C++ warning 4722 about aborting a destructor,
it has no value for us.

llvm-svn: 204704
2014-03-25 08:42:49 +00:00
David Majnemer 273bff4713 WinCOFF: Add support for -fdata-sections
This is a pretty straight forward translation for COFF, we just need to
stick the data in a COMDAT section marked as
IMAGE_COMDAT_SELECT_NODUPLICATES.

N.B. We must be careful to avoid sticking entities with private linkage
in COMDAT groups.  COFF is pretty hostile to the renaming of entities so
we must be careful to disallow GlobalVariables with unstable names.

llvm-svn: 204703
2014-03-25 06:14:26 +00:00
David Blaikie 3ffe4dd67f DebugInfo: Add GNU_addr_base and GNU_ranges_base only when there are addresses or ranges
Based on code review feedback from Eric in r204672.

llvm-svn: 204702
2014-03-25 05:34:24 +00:00
Saleem Abdulrasool 1425622ad8 test: fix CHECK lines
Thanks to gix for pointing out that the CHECK-LABEL lines were incorrect!

llvm-svn: 204700
2014-03-25 03:39:39 +00:00
Andrew Trick c8ac7ea261 SLP vectorizer: Don't hoist vector extracts of phis.
Extracts coming from phis were being hoisted, while all others were
sunk to their uses. This was inconsistent and didn't seem to serve a
purpose. Changing all extracts to be sunk to uses is a prerequisite
for adding block frequency to the SLP vectorizer's cost model.

I benchmarked the change in isolation (without block frequency). I
only saw noise on x86 and some potentially significant improvements on
ARM. No major regressions is good enough for me.

llvm-svn: 204699
2014-03-25 02:18:47 +00:00
Ed Maste b9fe0dd781 Add ObjectFileJIT library
llvm-svn: 204698
2014-03-25 02:03:28 +00:00
David Blaikie 9c550ac4e7 DebugInfo: Support debug_loc under fission
Implement debug_loc.dwo, as well as llvm-dwarfdump support for dumping
this section.

Outlined in the DWARF5 spec and http://gcc.gnu.org/wiki/DebugFission the
debug_loc.dwo section has more variation than the standard debug_loc,
allowing 3 different forms of entry (plus the end of list entry). GCC
seems to, and Clang certainly, only use one form, so I've just
implemented dumping support for that for now.

It wasn't immediately obvious that there was a good refactoring to share
the implementation of dumping support between debug_loc and
debug_loc.dwo, so they're separate for now - ideas welcome or I may come
back to it at some point.

As per a comment in the code, we could choose different forms that may
reduce the number of debug_addr entries we emit, but that will require
further study.

llvm-svn: 204697
2014-03-25 01:44:02 +00:00
David Blaikie 2d33d6a4c2 DebugInfo: Remove unnecessary zero-size check
This seems excessive - switching section isn't expensive (or if it is
we're already being wasteful, since we emitted the debug_loc section
symbol earlier anyway) and otherwise there's no work that happens in
this function when the list is empty.

llvm-svn: 204696
2014-03-25 01:43:56 +00:00
Richard Smith 399a6035e0 Remove redundant and misleading check. This could also lead to painful cyclic
deserialization.

llvm-svn: 204695
2014-03-25 01:22:22 +00:00
Richard Smith 961eae5f95 Save out a correct lookup table if a lookup table entry is stale (it contains
an out-of-date external decls list). This happens if we declare some names,
force the lookup table for the decl context to be built, import a module that
adds more decls for the name, then write out our module without looking up the
name.

llvm-svn: 204694
2014-03-25 01:14:22 +00:00
Justin Bogner 8ce3b5fcaa Support: Functions for consuming endian specific data from a buffer.
This adds a function to Endian.h that reads from and updates a pointer
into a buffer with endian specific data. This is more convenient for
stream-like reading of data than endian::read.

llvm-svn: 204693
2014-03-25 01:04:44 +00:00
Richard Smith a8b7459115 If a DeclContext's lookups need to be reconciled, and we're given external declarations for a name, reconcile first. Otherwise, when we come to reconcile, we'll ask for external declarations for that name again. No functionality change intended.
llvm-svn: 204692
2014-03-25 00:34:21 +00:00
Richard Smith 05332ab354 Simplify: don't try to complete the list of decls twice when iterating over the
lookups for a DeclContext.

llvm-svn: 204691
2014-03-25 00:27:18 +00:00
Manman Ren 78cf02a07b Register Allocator: check other options before using a CSR for the first time.
When register allocator's stage is RS_Spill, we choose spill over using the CSR
for the first time, if the spill cost is lower than CSRCost. 
When register allocator's stage is < RS_Split, we choose pre-splitting over
using the CSR for the first time, if the cost of splitting is lower than
CSRCost.

CSRCost is set with command-line option "regalloc-csr-first-time-cost". The
default value is 0 to generate the same codes as before this commit.

With a value of 15 (1 << 14 is the entry frequency), I measured performance
gain of 3% on 253.perlbmk and 1.7% on 197.parser, with instrumented PGO,
on an arm device.

rdar://16162005

llvm-svn: 204690
2014-03-25 00:16:25 +00:00
Jim Ingham 2f2c876e4f Make "disassemble -a" work when the target is not running yet. It will dump all the functions matching that address, just like "disassemble -n" does before running.
<rdar://problem/16406570>

llvm-svn: 204689
2014-03-25 00:15:47 +00:00
Jim Ingham a0c0510845 Make ModuleList iterable.
llvm-svn: 204688
2014-03-25 00:12:30 +00:00
Kevin Enderby 89299400ac Fix crashes when assembler directives are used that are not
for Mach-O object files by generating an error instead.

rdar://16335232

llvm-svn: 204687
2014-03-25 00:05:50 +00:00
Richard Smith 750f511f11 Fix a bug where an explicit instantiation declaration of a class template
specialization would make us think it might have a key function.

llvm-svn: 204686
2014-03-24 23:54:09 +00:00
Greg Clayton 6f228bf965 Add ObjectFile/JIT to the makefile.
llvm-svn: 204685
2014-03-24 23:30:43 +00:00
Manman Ren 9db66b3d34 Register Allocator: refactoring (no functionality change).
Factor out two functions calculateRegionSplitCost and doRegionSplit
from tryRegionSplit. These two functions will be used in coming patches.

rdar://16162005

llvm-svn: 204684
2014-03-24 23:23:42 +00:00
Greg Clayton 8541258b4e Make cmake build the new ObjectFileJIT.
llvm-svn: 204683
2014-03-24 23:11:37 +00:00
Greg Clayton 23f8c95a44 JITed functions can now have debug info and be debugged with debug and source info:
(lldb) b puts
(lldb) expr -g -i0 -- (int)puts("hello")

First we will stop at the entry point of the expression before it runs, then we can step over a few times and hit the breakpoint in "puts", then we can continue and finishing stepping and fininsh the expression.

Main features:
- New ObjectFileJIT class that can be easily created for JIT functions
- debug info can now be enabled when parsing expressions
- source for any function that is run throught the JIT is now saved in LLDB process specific temp directory and cleaned up on exit
- "expr -g --" allows you to single step through your expression function with source code

<rdar://problem/16382881>

llvm-svn: 204682
2014-03-24 23:10:19 +00:00
Greg Clayton 2256d0dced Add a "--threads N" option instead of having to use an environment variable. It also now defaults to running with the number of CPUs on the machine.
llvm-svn: 204681
2014-03-24 23:01:57 +00:00
David Blaikie 84d8e18f2b DebugInfo: Simplify debug loc list handling by keeping separate lists
Rather than using a flat list with "empty" entries (ala the actual
on-disk format), keep separate lists for each variable.

llvm-svn: 204680
2014-03-24 22:38:38 +00:00
David Blaikie 34ec5d07e1 DwarfDebug: Simplify debug_loc merging
No functional change intended.

Merging up-front rather than delaying this task until later. This just
seems simpler and more efficient (avoiding growing the debug loc list
only to have to skip over those post-merged entries, etc).

llvm-svn: 204679
2014-03-24 22:27:06 +00:00
Marshall Clow 4fdb070817 Add a test to make sure we're doing the right thing for throwing exceptions from deferred functions. This is LWG issue #2186. No change to the library needed.
llvm-svn: 204678
2014-03-24 22:25:24 +00:00
Eli Bendersky cb39943f6f Proper handling of static local variables with address space qualifiers.
Similar to the implementation for globals in r157167.

Patch by Jingyue Wu.

llvm-svn: 204677
2014-03-24 22:05:38 +00:00
Duncan P. N. Exon Smith 21b98a6c83 InstrProf: Change the extension of the default profile
Change the name of the default profile dumped by compiler-rt to
default.profraw.  This distinguishes it more clearly from the
(incompatible) format output by llvm-profdata that is read by clang
-fprofile-instr-use.

llvm-svn: 204676
2014-03-24 21:53:42 +00:00
David Majnemer 58e5bee17a MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.  Further, we avoid doing this if
either -fwritable-strings or -fsanitize=address are present.

This reverts commit r204596.

llvm-svn: 204675
2014-03-24 21:43:36 +00:00
Warren Hunt c89450e054 [MS-ABI] Drop Special Layout in 64-bit mode.
As of cl.exe version 18, the special layout rules for structs with 
alignment 16 or greater has been dropped.  This patch drops the behavior 
from clang.  This patch also updates the lit tests to reflect the 
change.

llvm-svn: 204674
2014-03-24 21:37:27 +00:00
Adrian Prantl c95ec91e2a Get rid of an unnecessary use of the * and & operators.
llvm-svn: 204673
2014-03-24 21:33:01 +00:00
David Blaikie 96dea0581e DebugInfo: Add DW_AT_GNU_ranges_base to skeleton CUs
This is used to avoid relocations in the dwo file by allowing
DW_AT_ranges specified in debug_info.dwo to be relative to this base
address. (r204667 implements the base-relative DW_AT_ranges side of
this)

llvm-svn: 204672
2014-03-24 21:31:35 +00:00
Justin Bogner b7da8b69cc Support: Document Endian.h functions
llvm-svn: 204671
2014-03-24 21:30:55 +00:00
Adrian Prantl 9b963516a3 Cleanup testcase by adding return statements and replacing CHECK-DAG's with
plain old CHECKs.

Follow-up to r204633.

llvm-svn: 204670
2014-03-24 21:19:34 +00:00
Will Schmidt 5fa50f3c57 Update the powerpc64le check to include CALL_ELF=2 check.
This is a testcase follow-up to r204627.
(see also r204614 for CALL_ELF usage).

llvm-svn: 204669
2014-03-24 21:09:16 +00:00
David Blaikie 26b2bd04fd DebugInfo: Implement relative addressing for DW_AT_ranges under fission
This removes the debug_ranges relocations from debug_info.dwo (but
doesn't implement the DW_AT_GNU_ranges_base which is also necessary for
correct functioning)

llvm-svn: 204668
2014-03-24 21:07:27 +00:00
David Blaikie 3c9a3cc495 DebugInfo: Don't emit relocations to abbreviations in debug_info.dwo
llvm-svn: 204667
2014-03-24 20:53:02 +00:00
Tom Stellard 6378f7a5e2 Add definition for M_PI_F v3
v2:
  - Use a hexadecimal constant.

v3:
  - Use a hexadecimal constant in floating-point notation.

llvm-svn: 204666
2014-03-24 20:36:44 +00:00
David Blaikie f72ed5f9ed DwarfDebug: Remove an unused parameter
llvm-svn: 204665
2014-03-24 20:31:01 +00:00
Matt Arsenault db8b1d5b6c R600: Don't viewCFG() under DEBUG() except on failure.
Having these popping up every time you use -debug is really
irritating.

llvm-svn: 204664
2014-03-24 20:29:02 +00:00
David Blaikie d82b237785 Remove unused parameter
llvm-svn: 204663
2014-03-24 20:28:10 +00:00
Matt Arsenault 684dc80b6d R600/SI: Fix extra mov from legalizing 64-bit SALU ops.
Check the register class of each operand individually
to avoid an extra copy to a vgpr.

llvm-svn: 204662
2014-03-24 20:08:13 +00:00
Matt Arsenault 248b7b6ba1 R600/SI: Sub-optimial fix for 64-bit immediates with SALU ops.
No longer asserts, but now you get moves loading legal immediates
into the split 32-bit operations.

llvm-svn: 204661
2014-03-24 20:08:09 +00:00
Matt Arsenault f35182c783 R600/SI: Fix 64-bit bit ops that require the VALU.
Try to match scalar and first like the other instructions.
Expand 64-bit ands to a pair of 32-bit ands since that is not
available on the VALU.

llvm-svn: 204660
2014-03-24 20:08:05 +00:00
Yaron Keren 7b085a4799 In Release modes, Visual Studio complains that the Operator destructor in User.cpp
never returns, which is true by design. 

Initially assumed that the reason is llvm_unreachable being dependent on NDEBUG.

However, even if llvm_unreachable is replaced by __assume(false), VC still warns in
Release modes but not in Debug modes...

The real reason turned out to be optimization flags.
With /Od in Debug modes the warning is not issued whereas with /O1 it is.

I could not find any documentation to this effect, but it is reproducable:

Try compiling http://msdn.microsoft.com/en-us/library/khwfyc5d(v=vs.90).aspx
with /O1 and then with /Od.

llvm-svn: 204659
2014-03-24 19:48:13 +00:00
Matt Arsenault a7f1e0c44f R600: Implement isNarrowingProfitable.
llvm-svn: 204658
2014-03-24 19:43:31 +00:00
Aaron Ballman 69e6e7c604 Capability attributes can now be declared on a typedef declaration as well as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability)))
llvm-svn: 204657
2014-03-24 19:29:19 +00:00
Dmitry Vyukov d23118c3b2 tsan: optimize vector clock operations
Make vector clock operations O(1) for several important classes of use cases.
See comments for details.
Below are stats from a large server app, 77% of all clock operations are handled as O(1).

Clock acquire                     :         25983645
  empty clock                     :          6288080
  fast from release-store         :         14917504
  contains my tid                 :          4515743
  repeated (fast)                 :          2141428
  full (slow)                     :          2636633
  acquired something              :          1426863
Clock release                     :          2544216
  resize                          :             6241
  fast1                           :           197693
  fast2                           :          1016293
  fast3                           :             2007
  full (slow)                     :          1797488
  was acquired                    :           709227
  clear tail                      :                1
  last overflow                   :                0
Clock release store               :          3446946
  resize                          :           200516
  fast                            :           469265
  slow                            :          2977681
  clear tail                      :                0
Clock acquire-release             :           820028

llvm-svn: 204656
2014-03-24 18:54:20 +00:00
Dmitry Vyukov f49921ba53 tsan: reorder SyncVar members to reduce contention
llvm-svn: 204655
2014-03-24 18:51:37 +00:00