platform/upstream/llvm.git
10 years agoASTUnit: ArrayRef'ize RemappedFiles
Dmitri Gribenko [Fri, 7 Feb 2014 15:00:22 +0000 (15:00 +0000)]
ASTUnit: ArrayRef'ize RemappedFiles

llvm-svn: 200975

10 years agoclang-format: Fix column limit violation for merged lines in macros.
Daniel Jasper [Fri, 7 Feb 2014 13:45:27 +0000 (13:45 +0000)]
clang-format: Fix column limit violation for merged lines in macros.

Before (81 columns):
  #define A                                                                       \
    void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { return aaaaaaaa; } \
    int i;

After:
  #define A                                                    \
    void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() { \
      return aaaaaaaa;                                         \
    }                                                          \
    int i;

llvm-svn: 200974

10 years agoTry to unbreak the mingw32 build.
Benjamin Kramer [Fri, 7 Feb 2014 12:05:36 +0000 (12:05 +0000)]
Try to unbreak the mingw32 build.

llvm-svn: 200973

10 years agotsan: improve the test
Dmitry Vyukov [Fri, 7 Feb 2014 11:48:06 +0000 (11:48 +0000)]
tsan: improve the test
remove TSAN_OPTIONS from the test, so that it runs in the presubmit script
add a CHECK, so that it can run with FileCheck as well

llvm-svn: 200972

10 years agoFix AAPCS compliance for HFAs containing doubles and long doubles
Oliver Stannard [Fri, 7 Feb 2014 11:25:57 +0000 (11:25 +0000)]
Fix AAPCS compliance for HFAs containing doubles and long doubles

An HFA is defined as a struct containing floating point values of the
same machine type. In the 32-bit ABI, double and long double have the
same machine type, so a struct with a mixture of these types must be an
HFA (assuming it meets the other criteria).

llvm-svn: 200971

10 years agoLLVM-1163: AAPCS-VFP violation when CPRC allocated to stack
Oliver Stannard [Fri, 7 Feb 2014 11:19:53 +0000 (11:19 +0000)]
LLVM-1163: AAPCS-VFP violation when CPRC allocated to stack

According to the AAPCS, when a CPRC is allocated to the stack, all other
VFP registers should be marked as unavailable.

I have also modified the rules for allocating non-CPRCs to the stack, to make
it more explicit that all GPRs must be made unavailable. I cannot think of a
case where the old version would produce incorrect answers, so there is no test
for this.

llvm-svn: 200970

10 years agoChanged comment.
Sasa Stankovic [Fri, 7 Feb 2014 11:16:02 +0000 (11:16 +0000)]
Changed comment.

llvm-svn: 200969

10 years agoclang-format: Fix range-based for-loop formatting.
Daniel Jasper [Fri, 7 Feb 2014 10:09:46 +0000 (10:09 +0000)]
clang-format: Fix range-based for-loop formatting.

Before:
  for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaa.aaaaaaaaaaaa()
           .aaaaaaaaa()
           .a()) {
  }

After:
  for (aaaaaaaaa aaaaaaaaaaaaaaaaaaaaa :
       aaaaaaaaaaaa.aaaaaaaaaaaa().aaaaaaaaa().a()) {
  }

llvm-svn: 200968

10 years agoDocument return value for FileManager::getNoncachedStatValue()
Dmitri Gribenko [Fri, 7 Feb 2014 09:31:00 +0000 (09:31 +0000)]
Document return value for FileManager::getNoncachedStatValue()

llvm-svn: 200967

10 years agotsan: run user OnInitialize callback later
Dmitry Vyukov [Fri, 7 Feb 2014 09:28:57 +0000 (09:28 +0000)]
tsan: run user OnInitialize callback later
when global and thread state are initialized,
this allows to do more things in the callback.

llvm-svn: 200966

10 years ago[Sparc] Add support for parsing synthetic instruction 'mov'.
Venkatraman Govindaraju [Fri, 7 Feb 2014 09:06:52 +0000 (09:06 +0000)]
[Sparc] Add support for parsing synthetic instruction 'mov'.

llvm-svn: 200965

10 years agoRevert r194097: "With this patch -Wwrite-strings is still implemented with the terrible
Argyrios Kyrtzidis [Fri, 7 Feb 2014 08:33:28 +0000 (08:33 +0000)]
Revert r194097: "With this patch -Wwrite-strings is still implemented with the terrible
    hack of passing -fconst-strings to -cc1"

Passing or not a language option based on diagnostic settings is a bad idea, it breaks
using a PCH that was compiled with different diagnostic settings.

Also add a test case to make sure we don't regress.

llvm-svn: 200964

10 years ago[Sparc] Emit correct encoding for atomic instructions. Also, add support for parsing...
Venkatraman Govindaraju [Fri, 7 Feb 2014 07:34:49 +0000 (07:34 +0000)]
[Sparc] Emit correct encoding for atomic instructions. Also, add support for parsing CAS instructions to test the CAS encoding.

llvm-svn: 200963

10 years ago[Sparc] Emit relocations for Thread Local Storage (TLS) when integrated assembler...
Venkatraman Govindaraju [Fri, 7 Feb 2014 05:54:20 +0000 (05:54 +0000)]
[Sparc] Emit relocations for Thread Local Storage (TLS) when integrated assembler is used.

llvm-svn: 200962

10 years ago[Sparc] Emit correct relocations for PIC code when integrated assembler is used.
Venkatraman Govindaraju [Fri, 7 Feb 2014 04:24:35 +0000 (04:24 +0000)]
[Sparc] Emit correct relocations for PIC code when integrated assembler is used.

llvm-svn: 200961

10 years ago[Sparc] Use SparcMCExpr::VariantKind itself as MachineOperand's target flags.
Venkatraman Govindaraju [Fri, 7 Feb 2014 02:36:06 +0000 (02:36 +0000)]
[Sparc] Use SparcMCExpr::VariantKind itself as MachineOperand's target flags.

llvm-svn: 200960

10 years agoMS ABI: Don't be so hasty to judge an inheritance model
David Majnemer [Fri, 7 Feb 2014 00:43:07 +0000 (00:43 +0000)]
MS ABI: Don't be so hasty to judge an inheritance model

If we are in the middle of defining the class, don't attempt to
validate previously annotated declarations.  We may not have seen base
specifiers or virtual method declarations yet.

llvm-svn: 200959

10 years agoPGO branch weight: fix PR18752.
Manman Ren [Fri, 7 Feb 2014 00:38:56 +0000 (00:38 +0000)]
PGO branch weight: fix PR18752.

Fix a bug triggered in IfConverterTriangle when CvtBB has multiple predecessors
by getting the weights before removing a successor.

llvm-svn: 200958

10 years agoX86: Resolve a long standing FIXME and properly isel pextr[bw].
Jim Grosbach [Fri, 7 Feb 2014 00:16:33 +0000 (00:16 +0000)]
X86: Resolve a long standing FIXME and properly isel pextr[bw].

Generalize the AArch64 .td nodes for AssertZext and AssertSext. Use
them to match the relevant pextr store instructions.

The test widen_load-2.ll requires a slight change because with the
stores gone, the remaining instructions are scheduled in a different
order.

Add test cases for SSE4 and AVX variants.

Resolves rdar://13414672.

Patch by Adam Nemet <anemet@apple.com>.

llvm-svn: 200957

10 years ago[mach-o] use new way to copy StringRefs
Nick Kledzik [Thu, 6 Feb 2014 23:48:52 +0000 (23:48 +0000)]
[mach-o] use new way to copy StringRefs

llvm-svn: 200956

10 years agoConvert test to FileCheck.
Rafael Espindola [Thu, 6 Feb 2014 23:35:22 +0000 (23:35 +0000)]
Convert test to FileCheck.

llvm-svn: 200955

10 years agoTemporary fix for PR18473: Don't try to evaluate the initializer for a
Richard Smith [Thu, 6 Feb 2014 23:35:16 +0000 (23:35 +0000)]
Temporary fix for PR18473: Don't try to evaluate the initializer for a
type-dependent variable, even if the initializer isn't value-dependent. This
happens for ParenListExprs composed of non-value-dependent subexpressions, for
instance.

We should really give ParenListExprs (and InitListExprs) the type of the
initialized entity if they're used to represent a dependent initialization (and
if so, set them to be type-, value- and instantiation-dependent).

llvm-svn: 200954

10 years agoFixes PR18762, stop the StmtPrinter for ObjCPropertyRefExpr from crashing on
Richard Trieu [Thu, 6 Feb 2014 23:26:23 +0000 (23:26 +0000)]
Fixes PR18762, stop the StmtPrinter for ObjCPropertyRefExpr from crashing on
certain receiver types.

llvm-svn: 200953

10 years agoThe diagnostic printer expects the LangOptions to still be alive. Give it one that...
Nick Lewycky [Thu, 6 Feb 2014 22:57:16 +0000 (22:57 +0000)]
The diagnostic printer expects the LangOptions to still be alive. Give it one that lives at least as long as all the uses of it. This is still wrong though, we should be passing in the correct LangOpts for a given source file.

llvm-svn: 200952

10 years agoLock the JIT before using it.
Sean Callanan [Thu, 6 Feb 2014 22:25:20 +0000 (22:25 +0000)]
Lock the JIT before using it.

<rdar://problem/15958296>

llvm-svn: 200951

10 years agoRemoved spurious lookup of the $__lldb_expr
Sean Callanan [Thu, 6 Feb 2014 22:24:11 +0000 (22:24 +0000)]
Removed spurious lookup of the $__lldb_expr
selector when compiling an expression in an
Objective-C context.

<rdar://problem/15797390>

llvm-svn: 200950

10 years agoAdd isListInitialization matcher.
Peter Collingbourne [Thu, 6 Feb 2014 21:52:24 +0000 (21:52 +0000)]
Add isListInitialization matcher.

Differential Revision: http://llvm-reviews.chandlerc.com/D2708

llvm-svn: 200949

10 years agoPR18128: a lambda capture-default is not permitted for a non-local lambda
Richard Smith [Thu, 6 Feb 2014 21:49:08 +0000 (21:49 +0000)]
PR18128: a lambda capture-default is not permitted for a non-local lambda
expression.

llvm-svn: 200948

10 years ago[CodeGenPrepare] Move away sign extensions that get in the way of addressing
Quentin Colombet [Thu, 6 Feb 2014 21:44:56 +0000 (21:44 +0000)]
[CodeGenPrepare] Move away sign extensions that get in the way of addressing
mode.

Basically the idea is to transform code like this:
%idx = add nsw i32 %a, 1
%sextidx = sext i32 %idx to i64
%gep = gep i8* %myArray, i64 %sextidx
load i8* %gep

Into:
%sexta = sext i32 %a to i64
%idx = add nsw i64 %sexta, 1
%gep = gep i8* %myArray, i64 %idx
load i8* %gep

That way the computation can be folded into the addressing mode.

This transformation is done as part of the addressing mode matcher.
If the matching fails (not profitable, addressing mode not legal, etc.), the
matcher will revert the related promotions.

<rdar://problem/15519855>

llvm-svn: 200947

10 years agoUse correct ld emulation for EABI hardware float triple on NetBSD.
Joerg Sonnenberger [Thu, 6 Feb 2014 21:04:32 +0000 (21:04 +0000)]
Use correct ld emulation for EABI hardware float triple on NetBSD.

llvm-svn: 200946

10 years ago[sanitizer] Intercept if_indextoname() and if_nametoindex().
Sergey Matveev [Thu, 6 Feb 2014 20:39:33 +0000 (20:39 +0000)]
[sanitizer] Intercept if_indextoname() and if_nametoindex().

llvm-svn: 200945

10 years agoFix indentation of a code example in LibTooling's documentation.
James Dennett [Thu, 6 Feb 2014 20:16:05 +0000 (20:16 +0000)]
Fix indentation of a code example in LibTooling's documentation.

llvm-svn: 200944

10 years agoImplement ObjectFileMachO::SetLoadAddress().
Greg Clayton [Thu, 6 Feb 2014 20:10:16 +0000 (20:10 +0000)]
Implement ObjectFileMachO::SetLoadAddress().

llvm-svn: 200943

10 years ago[sanitizer] Fix build.
Sergey Matveev [Thu, 6 Feb 2014 19:36:10 +0000 (19:36 +0000)]
[sanitizer] Fix build.

llvm-svn: 200942

10 years agoTrack register pressure a bit more carefully (weird corner case).
Andrew Trick [Thu, 6 Feb 2014 19:20:41 +0000 (19:20 +0000)]
Track register pressure a bit more carefully (weird corner case).

This solves a problem where a def machine operand has no uses but has
not been marked dead. In this case, the initial RP analysis was being
extra precise and determining from LiveIntervals the the register was
actually dead. This caused us to omit the register from the RP
tracker's block live out. That's all good, but the per-instruction
summary still accounted for it as a valid def. This could cause an
assertion in the tracker later when we underflow pressure.

This is from a bug report on an out-of-tree target. It is not
reproducible on well-behaved targets. I'm just making an obvious fix
without unit test.

llvm-svn: 200941

10 years agoSilence build-bots from the fallout of r200921
David Majnemer [Thu, 6 Feb 2014 19:14:16 +0000 (19:14 +0000)]
Silence build-bots from the fallout of r200921

llvm-svn: 200940

10 years agoFactor some methods that were in DynamicLoaderPOSIXDYLD.
Steve Pucci [Thu, 6 Feb 2014 19:02:19 +0000 (19:02 +0000)]
Factor some methods that were in DynamicLoaderPOSIXDYLD.

Move some code that was in DynamicLoaderPOSIXDLYD into the
base class DynamicLoader.  In the case of UpdateLoadedSections(),
the test to see whether a file is loadable (its address is zero)
is not generally applicable so that test is changed to a more
universally applicable check for the SHF_ALLOC flag on the section.

Also make it explicit that the reading of the module_id in
DynamicLoaderPOSIXDYLD::GetThreadLocalData() is using a hardcoded
size (of module_id) of 4, which might not be appropriate on
big-endian 64-bit systems, leaving a FIXME comment in place.

llvm-svn: 200939

10 years agoMove -verify-pch to use VerifyJobAction
Ben Langmuir [Thu, 6 Feb 2014 18:53:25 +0000 (18:53 +0000)]
Move -verify-pch to use VerifyJobAction

Use the verify hook rather than the compile hook to represent the
-verify-pch action, and move the exising --verify-debug-info action
into its own subclass of VerifyJobAction.  Incidentally change the name
printed by -ccc-print-phases for --verify-debug-info.

llvm-svn: 200938

10 years agoRevert r200095 and r200152. It turns out when compiling with -arch armv7 -mcpu=cortex...
Evan Cheng [Thu, 6 Feb 2014 18:51:34 +0000 (18:51 +0000)]
Revert r200095 and r200152. It turns out when compiling with -arch armv7 -mcpu=cortex-m3, the triple would still set iOS as the OS so the hack is still needed. rdar://15984891

llvm-svn: 200937

10 years ago[sanitizer] One does not simply intercept getifaddrs().
Sergey Matveev [Thu, 6 Feb 2014 18:48:23 +0000 (18:48 +0000)]
[sanitizer] One does not simply intercept getifaddrs().

Upgrade the interceptor, and attempt to fix the Android build.

llvm-svn: 200936

10 years agoR600/SI: Add a MUBUF store pattern for Reg+Imm offsets
Tom Stellard [Thu, 6 Feb 2014 18:36:41 +0000 (18:36 +0000)]
R600/SI: Add a MUBUF store pattern for Reg+Imm offsets

llvm-svn: 200935

10 years agoR600/SI: Add a MUBUF store pattern for Imm offsets
Tom Stellard [Thu, 6 Feb 2014 18:36:39 +0000 (18:36 +0000)]
R600/SI: Add a MUBUF store pattern for Imm offsets

llvm-svn: 200934

10 years agoR600/SI: Add a MUBUF load pattern for Reg+Imm offsets
Tom Stellard [Thu, 6 Feb 2014 18:36:38 +0000 (18:36 +0000)]
R600/SI: Add a MUBUF load pattern for Reg+Imm offsets

llvm-svn: 200933

10 years agoR600/SI: Use immediates offsets for SMRD instructions whenever possible
Tom Stellard [Thu, 6 Feb 2014 18:36:34 +0000 (18:36 +0000)]
R600/SI: Use immediates offsets for SMRD instructions whenever possible

There was a problem with the old pattern, so we were copying some
larger immediates into registers when we could have been encoding
them in the instruction.

llvm-svn: 200932

10 years agoWired-up the new LLVM diagnostic system into clang diagnostic system.
Quentin Colombet [Thu, 6 Feb 2014 18:30:43 +0000 (18:30 +0000)]
Wired-up the new LLVM diagnostic system into clang diagnostic system.
The approach is similar to the existing inline-asm reporting, just more
general.

<rdar://problem/15886278>

llvm-svn: 200931

10 years agoThe "-n" and "-p" options to the lldb driver no longer worked after recent IOHandler...
Greg Clayton [Thu, 6 Feb 2014 18:22:44 +0000 (18:22 +0000)]
The "-n" and "-p" options to the lldb driver no longer worked after recent IOHandler changes, this is now fixed.

<rdar://problem/15962763>

llvm-svn: 200930

10 years agoRemove const_cast for STI when parsing inline asm
David Peixotto [Thu, 6 Feb 2014 18:19:40 +0000 (18:19 +0000)]
Remove const_cast for STI when parsing inline asm

In a previous commit (r199818) we added a const_cast to an existing
subtarget info instead of creating a new one so that we could reuse
it when creating the TargetAsmParser for parsing inline assembly.
This cast was necessary because we needed to reuse the existing STI
to avoid generating incorrect code when the inline asm contained
mode-switching directives (e.g. .code 16).

The root cause of the failure was that there was an implicit sharing
of the STI between the parser and the MCCodeEmitter. To fix a
different but related issue, we now explicitly pass the STI to the
MCCodeEmitter (see commits r200345-r200351).

The const_cast is no longer necessary and we can now create a fresh
STI for the inline asm parser to use.

Differential Revision: http://llvm-reviews.chandlerc.com/D2709

llvm-svn: 200929

10 years agoX86: add costs for 64-bit vector ext/trunc & rebalance
Tim Northover [Thu, 6 Feb 2014 18:18:36 +0000 (18:18 +0000)]
X86: add costs for 64-bit vector ext/trunc & rebalance

The most important part of this is probably adding any cost at all for
operations like zext <8 x i8> to <8 x i32>. Before they were being
recorded as extremely costly (24, I believe) which made LLVM fall back
on a 4-wide vectorisation of a loop.

It also rebalances the values for sext, zext and trunc. Lacking any
other sane metric that might work across CPU microarchitectures I went
for instructions. This seems to be in reasonable accord with the rest
of the table (sitofp, ...) though no doubt at least one value is
sub-optimal for some bizarre reason.

Finally, separate AVX and AVX2 values are provided where appropriate.
The CodeGen is quite different in many cases.

rdar://problem/15981990

llvm-svn: 200928

10 years agoAdd a -suppress-warnings option to bitcode linking.
Eli Bendersky [Thu, 6 Feb 2014 18:01:56 +0000 (18:01 +0000)]
Add a -suppress-warnings option to bitcode linking.

llvm-svn: 200927

10 years ago[sanitizer] Intercept getifaddrs().
Sergey Matveev [Thu, 6 Feb 2014 17:42:36 +0000 (17:42 +0000)]
[sanitizer] Intercept getifaddrs().

llvm-svn: 200926

10 years ago[sanitizer] Intercept getresuid and getresgid.
Sergey Matveev [Thu, 6 Feb 2014 15:12:56 +0000 (15:12 +0000)]
[sanitizer] Intercept getresuid and getresgid.

llvm-svn: 200925

10 years agoImprove clang-tidy diagnostic output and filtering.
Alexander Kornienko [Thu, 6 Feb 2014 14:50:10 +0000 (14:50 +0000)]
Improve clang-tidy diagnostic output and filtering.

Summary:
This patch introduces several improvements to clang-tidy diagnostic;
  1. Make filtering of messages from non-user code more reliable. Output an
     error when it or any of the related notes touches user code. This fixes an
     assertion when an error has a location in a system header, and one of the
     notes relates to user code.
  2. In order for 1. to work, subscribe to the static analyzer diagnostics using
     a custom PathDiagnosticConsumer.
  3. Enable colors on supported terminals.
  4. Output FixItHints.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2714

llvm-svn: 200924

10 years ago[TSan] Add a regression test for https://code.google.com/p/thread-sanitizer/issues...
Alexander Potapenko [Thu, 6 Feb 2014 14:06:12 +0000 (14:06 +0000)]
[TSan] Add a regression test for https://code.google.com/p/thread-sanitizer/issues/detail?id=47

llvm-svn: 200923

10 years ago[TSan] Don't flush all file streams on program shutdown to avoid deadlocks on file...
Alexander Potapenko [Thu, 6 Feb 2014 13:37:14 +0000 (13:37 +0000)]
[TSan] Don't flush all file streams on program shutdown to avoid deadlocks on file stream locks.
This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=47.

llvm-svn: 200922

10 years agoMS ABI: Handle indirect field decls in template args
David Majnemer [Thu, 6 Feb 2014 12:46:52 +0000 (12:46 +0000)]
MS ABI: Handle indirect field decls in template args

Properly support fields that come from anonymous unions and structs
when used as template arguments for pointer to data member params.

llvm-svn: 200921

10 years agoMS ABI: Tweak pointer-to-member mangling/inheritance model selection
David Majnemer [Thu, 6 Feb 2014 10:59:19 +0000 (10:59 +0000)]
MS ABI: Tweak pointer-to-member mangling/inheritance model selection

Properly determine the inheritance model when dealing with nullptr:
- If a nullptr template argument is being checked against
  pointer-to-member parameter, nail down an inheritance model.
  N.B. We will chose an inheritance model even if we won't ultimately
  choose the template to instantiate!  Cooky, right?
- Null pointer-to-datamembers have a virtual base table offset of -1,
  not zero. Previously, we chose an offset of 0.

llvm-svn: 200920

10 years agoYet another patch to reduce compile time for small programs:
Puyan Lotfi [Thu, 6 Feb 2014 09:57:39 +0000 (09:57 +0000)]
Yet another patch to reduce compile time for small programs:

The aim in this patch is to reduce work that VirtRegRewriter needs to do when
telling MachineRegisterInfo which physregs are in use. Up until now
VirtRegRewriter::rewrite has been doing rewriting and populating def info and
then proceeding to set whether a physreg is used based this info for every
physreg that the target provides. This can be expensive when a target has an
unusually high number of supported physregs, and is a noticeable chunk of
compile time for small programs on such targets.

So to reduce compile time, this patch simply adds the use of a SparseSet to the
rewrite function that is used to flag each physreg that is encountered in a
MachineFunction. Afterward, rather than iterating over the set of all physregs
for a given target to set the physregs used in MachineRegisterInfo, the new way
is to iterate over the set of physregs that were actually encountered and set
in the SparseSet. This improves compile time because the existing rewrite
function was iterating over all MachineOperands already, and because the
iterations afterward to setPhysRegUsed is reduced by use of the SparseSet data.

llvm-svn: 200919

10 years agoX86: deduplicate V[SZ]EXT_MOVL and V[SZ]EXT nodes
Tim Northover [Thu, 6 Feb 2014 09:54:51 +0000 (09:54 +0000)]
X86: deduplicate V[SZ]EXT_MOVL and V[SZ]EXT nodes

I believe VZEXT_MOVL means "zero all vector elements except the first" (and
should have identical input & output types) whereas VZEXT means "zero extend
each element of a vector (discarding higher elements if necessary)".

For example:
    (v4i32 (vzext (v16i8 ...)))

should zero extend the low 4 bytes of the incoming vector to 32-bits,
discarding higher bytes.

However, somewhere in the past, these two concepts had become confused, even
leading to a nonsensical VSEXT_MOVL.

This re-merges the nodes where appropriate (all VSEXT_MOVL -> VSEXT, VZEXT_MOVL
-> VZEXT when it's an actual extension).

rdar://problem/15981990

llvm-svn: 200918

10 years agoThe following patch' purpose is to reduce compile time for compilation of small
Puyan Lotfi [Thu, 6 Feb 2014 09:23:24 +0000 (09:23 +0000)]
The following patch' purpose is to reduce compile time for compilation of small
programs on targets with large register files. The root of the compile time
overhead was in the use of llvm::SmallVector to hold PhysRegEntries, which
resulted in slow-down from calling llvm::SmallVector::assign(N, 0). In contrast
std::vector uses the faster __platform_bzero to zero out primitive buffers when
assign is called, while SmallVector uses an iterator.

The fix for this was simply to replace the SmallVector with a dynamically
allocated buffer and to initialize or reinitialize the buffer based on the
total registers that the target architecture requires. The changes support
cases where a pass manager may be reused for different targets, and note that
the PhysRegEntries is allocated using calloc mainly for good for, and also to
quite tools like Valgrind (see comments for more info on this).

There is an rdar to track the fact that SmallVector doesn't have platform
specific speedup optimizations inside of it for things like this, and I'll
create a bugzilla entry at some point soon as well.

TL;DR: This fix replaces the expensive llvm::SmallVector<unsigned
char>::assign(N, 0) with a call to calloc for N bytes which is much faster
because SmallVector's assign uses iterators.

llvm-svn: 200917

10 years agotsan: simplify Go build script
Dmitry Vyukov [Thu, 6 Feb 2014 09:23:12 +0000 (09:23 +0000)]
tsan: simplify Go build script
we don't use assembly files

llvm-svn: 200916

10 years agotsan: remove unused functions
Dmitry Vyukov [Thu, 6 Feb 2014 09:22:50 +0000 (09:22 +0000)]
tsan: remove unused functions

llvm-svn: 200915

10 years agotsan: improve error message for Go
Dmitry Vyukov [Thu, 6 Feb 2014 09:22:29 +0000 (09:22 +0000)]
tsan: improve error message for Go

llvm-svn: 200914

10 years agoThis small change reduces compile time for small programs on targets that have
Puyan Lotfi [Thu, 6 Feb 2014 08:42:01 +0000 (08:42 +0000)]
This small change reduces compile time for small programs on targets that have
large register files. The omission of Queries.clear() is perfectly safe because
LiveIntervalUnion::Query doesn't contain any data that needs freeing and
because LiveRegMatrix::runOnFunction happens to reset the OwningArrayPtr
holding Queries every time it is run, so there's no need to zero out the
queries either. Not having to do this for very large numbers of physregs
is a noticeable constant cost reduction in compilation of small programs.

llvm-svn: 200913

10 years agoAccept and handle absolute symbols with empty name.
Simon Atanasyan [Thu, 6 Feb 2014 07:35:16 +0000 (07:35 +0000)]
Accept and handle absolute symbols with empty name.

llvm-svn: 200911

10 years ago[asan] fix testing on Mac
Kostya Serebryany [Thu, 6 Feb 2014 07:19:52 +0000 (07:19 +0000)]
[asan] fix testing on Mac

llvm-svn: 200910

10 years agocheck-clang: Introduce the feature "utf8-capable-terminal".
NAKAMURA Takumi [Thu, 6 Feb 2014 07:15:59 +0000 (07:15 +0000)]
check-clang: Introduce the feature "utf8-capable-terminal".

clang/test/FixIt/fixit-unicode-with-utf8-output.c has begun complained since LLVM r200885.
Although it is changes for StringRef, it brought LLVM_ON_WIN32 to Support/Locale.cpp.

Before r200885, LLVM_ON_WIN32 was undefined in Locale.cpp!

FIXME: We should consider i18n on win32.
llvm-svn: 200909

10 years ago[asan] introduce two functions that will allow implementations of C++ garbage colecti...
Kostya Serebryany [Thu, 6 Feb 2014 06:56:22 +0000 (06:56 +0000)]
[asan] introduce two functions that will allow implementations of C++ garbage colection to work with asan's fake stack

llvm-svn: 200908

10 years agoA memcpy out of an fresh alloca is a no-op, delete it. Patch by Patrick Walton!
Nick Lewycky [Thu, 6 Feb 2014 06:29:19 +0000 (06:29 +0000)]
A memcpy out of an fresh alloca is a no-op, delete it. Patch by Patrick Walton!

llvm-svn: 200907

10 years agoDelete all of the CodeGenInstructions from CodeGenTarget destructor.
Craig Topper [Thu, 6 Feb 2014 06:27:59 +0000 (06:27 +0000)]
Delete all of the CodeGenInstructions from CodeGenTarget destructor.

llvm-svn: 200906

10 years ago[PM] Fix horrible typos that somehow didn't cause a failure in a C++11
Chandler Carruth [Thu, 6 Feb 2014 05:17:02 +0000 (05:17 +0000)]
[PM] Fix horrible typos that somehow didn't cause a failure in a C++11
build but spectacularly changed behavior of the C++98 build. =]

This shows my one problem with not having unittests -- basic API
expectations aren't well exercised by the integration tests because they
*happen* to not come up, even though they might later. I'll probably add
a basic unittest to complement the integration testing later, but
I wanted to revive the bots.

llvm-svn: 200905

10 years agoFix PR17221 - can't catch virtual base classes when throwing derived NULL pointers...
Marshall Clow [Thu, 6 Feb 2014 04:47:02 +0000 (04:47 +0000)]
Fix PR17221 - can't catch virtual base classes when throwing derived NULL pointers. Specifically, libc++abi would crash when you tried it.

llvm-svn: 200904

10 years ago[PM] Add a new "lazy" call graph analysis pass for the new pass manager.
Chandler Carruth [Thu, 6 Feb 2014 04:37:03 +0000 (04:37 +0000)]
[PM] Add a new "lazy" call graph analysis pass for the new pass manager.

The primary motivation for this pass is to separate the call graph
analysis used by the new pass manager's CGSCC pass management from the
existing call graph analysis pass. That analysis pass is (somewhat
unfortunately) over-constrained by the existing CallGraphSCCPassManager
requirements. Those requirements make it *really* hard to cleanly layer
the needed functionality for the new pass manager on top of the existing
analysis.

However, there are also a bunch of things that the pass manager would
specifically benefit from doing differently from the existing call graph
analysis, and this new implementation tries to address several of them:

- Be lazy about scanning function definitions. The existing pass eagerly
  scans the entire module to build the initial graph. This new pass is
  significantly more lazy, and I plan to push this even further to
  maximize locality during CGSCC walks.
- Don't use a single synthetic node to partition functions with an
  indirect call from functions whose address is taken. This node creates
  a huge choke-point which would preclude good parallelization across
  the fanout of the SCC graph when we got to the point of looking at
  such changes to LLVM.
- Use a memory dense and lightweight representation of the call graph
  rather than value handles and tracking call instructions. This will
  require explicit update calls instead of some updates working
  transparently, but should end up being significantly more efficient.
  The explicit update calls ended up being needed in many cases for the
  existing call graph so we don't really lose anything.
- Doesn't explicitly model SCCs and thus doesn't provide an "identity"
  for an SCC which is stable across updates. This is essential for the
  new pass manager to work correctly.
- Only form the graph necessary for traversing all of the functions in
  an SCC friendly order. This is a much simpler graph structure and
  should be more memory dense. It does limit the ways in which it is
  appropriate to use this analysis. I wish I had a better name than
  "call graph". I've commented extensively this aspect.

This is still very much a WIP, in fact it is really just the initial
bits. But it is about the fourth version of the initial bits that I've
implemented with each of the others running into really frustrating
problms. This looks like it will actually work and I'd like to split the
actual complexity across commits for the sake of my reviewers. =] The
rest of the implementation along with lots of wiring will follow
somewhat more rapidly now that there is a good path forward.

Naturally, this doesn't impact any of the existing optimizer. This code
is specific to the new pass manager.

A bunch of thanks are deserved for the various folks that have helped
with the design of this, especially Nick Lewycky who actually sat with
me to go through the fundamentals of the final version here.

llvm-svn: 200903

10 years ago[PM] Back out one hunk of the patch in r200901 that was *supposed* to go
Chandler Carruth [Thu, 6 Feb 2014 04:32:33 +0000 (04:32 +0000)]
[PM] Back out one hunk of the patch in r200901 that was *supposed* to go
in my next patch. Sorry for the breakage.

llvm-svn: 200902

10 years ago[PM] Wire up the analysis managers in the opt driver. This isn't really
Chandler Carruth [Thu, 6 Feb 2014 04:25:13 +0000 (04:25 +0000)]
[PM] Wire up the analysis managers in the opt driver. This isn't really
necessary until we add analyses to the driver, but I have such an
analysis ready and wanted to split this out. This is actually exercised
by the existing tests of the new pass manager as the analysis managers
are cross-checked and validated by the function and module managers.

llvm-svn: 200901

10 years ago[DAG] Don't pull the binary operation though the shift if the operands have opaque...
Juergen Ributzka [Thu, 6 Feb 2014 04:09:06 +0000 (04:09 +0000)]
[DAG] Don't pull the binary operation though the shift if the operands have opaque constants.

During DAGCombine visitShiftByConstant assumes that certain binary operations
with only constant operands can always be folded successfully. This is no longer
true when the constant is opaque. This commit fixes visitShiftByConstant by not
performing the optimization for opaque constants. Otherwise we would end up in
an infinite DAGCombine loop.

llvm-svn: 200900

10 years agoAllow transformation of VariableArray to ConstantArray.
Serge Pavlov [Thu, 6 Feb 2014 03:49:11 +0000 (03:49 +0000)]
Allow transformation of VariableArray to ConstantArray.

In the following code:

    struct A { static const int sz; };
    template<class T> void f() { T arr[A::sz]; }

the array 'arr' is represented as a variable size array in the template.
If 'A::sz' gets value below in the translation unit, the array in
instantiation can turn into constant size array.

This change fixes PR18633.

Differential Revision: http://llvm-reviews.chandlerc.com/D2688

llvm-svn: 200899

10 years agoSet default of inlinecold-threshold to 225.
Manman Ren [Thu, 6 Feb 2014 01:59:22 +0000 (01:59 +0000)]
Set default of inlinecold-threshold to 225.

225 is the default value of inline-threshold. This change will make sure
we have the same inlining behavior as prior to r200886.

As Chandler points out, even though we don't have code in our testing
suite that uses cold attribute, there are larger applications that do
use cold attribute.

r200886 + this commit intend to keep the same behavior as prior to r200886.
We can later on tune the inlinecold-threshold.

The main purpose of r200886 is to help performance of instrumentation based
PGO before we actually hook up inliner with analysis passes such as BPI and BFI.
For instrumentation based PGO, we try to increase inlining of hot functions and
reduce inlining of cold functions by setting inlinecold-threshold.

Another option suggested by Chandler is to use a boolean flag that controls
if we should use OptSizeThreshold for cold functions. The default value
of the boolean flag should not change the current behavior. But it gives us
less freedom in controlling inlining of cold functions.

llvm-svn: 200898

10 years agoDR101, PR12770: If a function is declared in the same context as a
Richard Smith [Thu, 6 Feb 2014 01:31:33 +0000 (01:31 +0000)]
DR101, PR12770: If a function is declared in the same context as a
using-declaration, and they declare the same function (either because
the using-declaration is in the same namespace as the declaration it
imports, or because they're both extern "C"), they do not conflict.

llvm-svn: 200897

10 years agoUpdate the X86 assembler for .intel_syntax to accept
Kevin Enderby [Thu, 6 Feb 2014 01:21:15 +0000 (01:21 +0000)]
Update the X86 assembler for .intel_syntax to accept
the << and >> bitwise operators.

rdar://15975725

llvm-svn: 200896

10 years agodon't set HasReliableSymbolDifference for ELF.
Rafael Espindola [Thu, 6 Feb 2014 01:06:31 +0000 (01:06 +0000)]
don't set HasReliableSymbolDifference for ELF.

It is only used in MachObjectWriter.cpp. Another leftover from early days
of ELF in MC.

llvm-svn: 200895

10 years agodoesSectionRequireSymbols is meaningless on ELF, remove.
Rafael Espindola [Thu, 6 Feb 2014 00:54:53 +0000 (00:54 +0000)]
doesSectionRequireSymbols is meaningless on ELF, remove.

This is a nop. doesSectionRequireSymbols is only used from
isSymbolLinkerVisible. isSymbolLinkerVisible only use from ELF was in

if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined())
  return false;

if (Symbol.isTemporary())
  return false;

If the symbol is a temporary this code returns false and it is irrelevant if
we take the first if or not. If the symbol is not a temporary,
Asm.isSymbolLinkerVisible returns true without ever calling
doesSectionRequireSymbols.

This was an horrible leftover from when support for ELF was first added.

llvm-svn: 200894

10 years agoSimplify code by combining ifs.
Manman Ren [Thu, 6 Feb 2014 00:08:15 +0000 (00:08 +0000)]
Simplify code by combining ifs.

llvm-svn: 200893

10 years agoDisable most IR-level transform passes on functions marked 'optnone'.
Paul Robinson [Thu, 6 Feb 2014 00:07:05 +0000 (00:07 +0000)]
Disable most IR-level transform passes on functions marked 'optnone'.
Ideally only those transform passes that run at -O0 remain enabled,
in reality we get as close as we reasonably can.
Passes are responsible for disabling themselves, it's not the job of
the pass manager to do it for them.

llvm-svn: 200892

10 years agoFix Werror introduced at r200874.
Manman Ren [Thu, 6 Feb 2014 00:03:20 +0000 (00:03 +0000)]
Fix Werror introduced at r200874.

llvm-svn: 200891

10 years agoJust returning false is the default.
Rafael Espindola [Thu, 6 Feb 2014 00:03:15 +0000 (00:03 +0000)]
Just returning false is the default.

llvm-svn: 200890

10 years agoFix -Wunused-variable 'FD' by using it instead of ND when they're equal but FD
Nick Lewycky [Wed, 5 Feb 2014 23:53:29 +0000 (23:53 +0000)]
Fix -Wunused-variable 'FD' by using it instead of ND when they're equal but FD
has a more precise type.

llvm-svn: 200889

10 years agoPass address space to allowsUnalignedMemoryAccesses
Matt Arsenault [Wed, 5 Feb 2014 23:16:05 +0000 (23:16 +0000)]
Pass address space to allowsUnalignedMemoryAccesses

llvm-svn: 200888

10 years agoAdd address space argument to allowsUnalignedMemoryAccess.
Matt Arsenault [Wed, 5 Feb 2014 23:15:53 +0000 (23:15 +0000)]
Add address space argument to allowsUnalignedMemoryAccess.

On R600, some address spaces have more strict alignment
requirements than others.

llvm-svn: 200887

10 years agoInliner uses a smaller inline threshold for callees with cold attribute.
Manman Ren [Wed, 5 Feb 2014 22:53:44 +0000 (22:53 +0000)]
Inliner uses a smaller inline threshold for callees with cold attribute.

Added command line option inlinecold-threshold to set threshold for inlining
functions with cold attribute. Listen to the cold attribute when it would
decrease the inline threshold.

llvm-svn: 200886

10 years agoFix layering StringRef copy using BumpPtrAllocator.
Nick Kledzik [Wed, 5 Feb 2014 22:22:56 +0000 (22:22 +0000)]
Fix layering StringRef copy using BumpPtrAllocator.

Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy:

   StringRef myCopy = myStr.copy(myAllocator);

llvm-svn: 200885

10 years agoAdd a CC1 option -verify-pch
Ben Langmuir [Wed, 5 Feb 2014 22:21:15 +0000 (22:21 +0000)]
Add a CC1 option -verify-pch

This option will:
- load the given pch file
- verify it is not out of date by stat'ing dependencies, and
- return 0 on success and non-zero on error

llvm-svn: 200884

10 years ago[RegAlloc] Add a last chance recoloring mechanism when everything else failed to
Quentin Colombet [Wed, 5 Feb 2014 22:13:59 +0000 (22:13 +0000)]
[RegAlloc] Add a last chance recoloring mechanism when everything else failed to
find a register.

The idea is to choose a color for the variable that cannot be allocated and
recolor its interferences around. Unlike the current register allocation scheme,
it is allowed to change the color of an already assigned (but maybe not
splittable or spillable) live interval while propagating this change to its
neighbors.
In other word, there are two things that may help finding an available color:
- Already assigned variables (RS_Done) can be recolored to different color.
- The recoloring allows to catch solutions that needs to touch more that just
  the neighbors of the current allocated variable.

E.g.,
vA can use {R1, R2    }
vB can use {    R2, R3}
vC can use {R1        }
Where vA, vB, and vC cannot be split anymore (they are reloads for instance) and
they all interfere.

vA is assigned R1
vB is assigned R2
vC tries to evict vA but vA is already done.
=> Regular register allocation heuristic fails.

Last chance recoloring kicks in:
vC does as if vA was evicted => vC uses R1.
vC is marked as fixed.
vA needs to find a color.
None are available.
vA cannot evict vC: vC is a fixed virtual register now.
vA does as if vB was evicted => vA uses R2.
vB needs to find a color.
R3 is available.
Recoloring => vC = R1, vA = R2, vB = R3.

<rdar://problem/15947839>

llvm-svn: 200883

10 years agoDon't print out "script" results twice.
Greg Clayton [Wed, 5 Feb 2014 21:46:20 +0000 (21:46 +0000)]
Don't print out "script" results twice.

We now properly detect when a result object has an immediate output stream and don't echo the results a second time.

<rdar://problem/15954906>

llvm-svn: 200882

10 years ago[PM] Don't require analysis results to be const in the new pass manager.
Chandler Carruth [Wed, 5 Feb 2014 21:41:42 +0000 (21:41 +0000)]
[PM] Don't require analysis results to be const in the new pass manager.

I think this was just over-eagerness on my part. The analysis results
need to often be non-const because they need to (in some cases at least)
be updated by the transformation pass in order to remain correct. It
also makes lazy analyses (a common case) needlessly annoying to write in
order to make their entire state mutable.

llvm-svn: 200881

10 years agoTry to fix ppc bot failure.
Manman Ren [Wed, 5 Feb 2014 21:40:10 +0000 (21:40 +0000)]
Try to fix ppc bot failure.

llvm-svn: 200880

10 years agoAn example summary provider for PyObject and the LLDB wrapper PythonObject hierarchy...
Enrico Granata [Wed, 5 Feb 2014 21:38:50 +0000 (21:38 +0000)]
An example summary provider for PyObject and the LLDB wrapper PythonObject hierarchy - this would have probably helped track down those refcount bugs..

llvm-svn: 200879

10 years agoFix the --source-quietly option to the driver so that it actually works. Clean up...
Jim Ingham [Wed, 5 Feb 2014 21:35:09 +0000 (21:35 +0000)]
Fix the --source-quietly option to the driver so that it actually works.  Clean up the help
output a bit.

llvm-svn: 200878

10 years agoClean up some particularly ugly casting.
Benjamin Kramer [Wed, 5 Feb 2014 21:29:05 +0000 (21:29 +0000)]
Clean up some particularly ugly casting.

No functionality change.

llvm-svn: 200877

10 years agoChanged OptionCategory variables to be static.
Alexander Kornienko [Wed, 5 Feb 2014 21:28:03 +0000 (21:28 +0000)]
Changed OptionCategory variables to be static.

llvm-svn: 200876

10 years agoFixed output to display correctly for "command source" by fixing the correct flags...
Greg Clayton [Wed, 5 Feb 2014 21:03:22 +0000 (21:03 +0000)]
Fixed output to display correctly for "command source" by fixing the correct flags being set.

Also emit the "Executing commands" message so it properly only comes out when desired and so it comes out in the right place.

<rdar://problem/15992208>

llvm-svn: 200875