platform/upstream/llvm.git
9 years agoCodeGen: Don't form weak dllexport aliases
David Majnemer [Fri, 24 Oct 2014 22:05:27 +0000 (22:05 +0000)]
CodeGen: Don't form weak dllexport aliases

The MS linker cannot do anything interesting with these, it doesn't make
sense to emit them.

This fixes PR21373.

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

llvm-svn: 220595

9 years agoSink DwarfUnit::constructImportedEntityDIE into DwarfCompileUnit.
Frederic Riss [Fri, 24 Oct 2014 21:31:09 +0000 (21:31 +0000)]
Sink DwarfUnit::constructImportedEntityDIE into DwarfCompileUnit.

So that it has access to getOrCreateGlobalVariableDIE. If we ever support
decsribing using directive in C++ classes (thus requiring support in type
units), it will certainly use another mechanism anyway.

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

llvm-svn: 220594

9 years agotest: correct an overzealous search-and-replace
Saleem Abdulrasool [Fri, 24 Oct 2014 21:23:49 +0000 (21:23 +0000)]
test: correct an overzealous search-and-replace

The temporary initialized is referenced as %0, not as the auto-release pool.
Fixes R+A tests.

llvm-svn: 220593

9 years ago[X86][SSE] Bitcast assertion in XFormVExtractWithShuffleIntoLoad
Simon Pilgrim [Fri, 24 Oct 2014 21:04:41 +0000 (21:04 +0000)]
[X86][SSE] Bitcast assertion in XFormVExtractWithShuffleIntoLoad

Minor patch to fix an issue in XFormVExtractWithShuffleIntoLoad where a load is unary shuffled, then bitcast (to a type with the same number of elements) before extracting an element.

An undef was created for the second shuffle operand using the original (post-bitcasted) vector type instead of the pre-bitcasted type like the rest of the shuffle node - this was then causing an assertion on the different types later on inside SelectionDAG::getVectorShuffle.

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

llvm-svn: 220592

9 years agoRemove duplicated new file content
Ed Maste [Fri, 24 Oct 2014 20:49:50 +0000 (20:49 +0000)]
Remove duplicated new file content

llvm-svn: 220591

9 years agoCodeGen: correct materialize temporary aggregates in ARC mode
Saleem Abdulrasool [Fri, 24 Oct 2014 20:23:43 +0000 (20:23 +0000)]
CodeGen: correct materialize temporary aggregates in ARC mode

Avoid an assertion when materializing a lifetime type aggregate temporary.  When
performing CodeGen for ObjC++, we could generate a lifetime-only aggregate
temporary by using an initializer list (which is effectively an array).  We
would reach through the temporary expression, fishing out the inner expression.
If this expression was a lifetime expression, we would attempt to emit this as a
scalar.  This would eventually result in an assertion as the emission would
eventually assert that the expression being emitted has a scalar evaluation
kind.

Add a case to handle the aggregate expressions.  Use the EmitAggExpr to emit the
aggregate expression rather than the EmitScalarInit.

Addresses PR21347.

llvm-svn: 220590

9 years ago[modules] Support combining 'textual' with 'private'.
Richard Smith [Fri, 24 Oct 2014 20:23:01 +0000 (20:23 +0000)]
[modules] Support combining 'textual' with 'private'.

llvm-svn: 220589

9 years agoItanium ABI: Template template parameters are usable as substitutions
David Majnemer [Fri, 24 Oct 2014 20:22:57 +0000 (20:22 +0000)]
Itanium ABI: Template template parameters are usable as substitutions

Template template parameters weren't added to the list of substitutions.
This would make the substitution map contain inaccurate mappings,
leading to Clang violating the Itanium ABI and breaking compatibility
with GCC.

This fixes PR21351.

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

llvm-svn: 220588

9 years agoCodeGen: trivial conversion to range based loop
Saleem Abdulrasool [Fri, 24 Oct 2014 19:54:32 +0000 (19:54 +0000)]
CodeGen: trivial conversion to range based loop

Switch to a range-based for loop.  NFC.

llvm-svn: 220587

9 years agotest: add -std=c++11
Saleem Abdulrasool [Fri, 24 Oct 2014 19:54:29 +0000 (19:54 +0000)]
test: add -std=c++11

This test uses C++11 features (r-value references) in ObjC++.  Add a -std=c++11
to silence a warning.  NFC.

llvm-svn: 220586

9 years agoCodeGen: GLValue exprs in template parameters should have reference type
David Majnemer [Fri, 24 Oct 2014 19:49:04 +0000 (19:49 +0000)]
CodeGen: GLValue exprs in template parameters should have reference type

This fixes a corner-case where __uuidof as a template argument would
result in us trying to emit a GLValue as an RValue.  This would lead to
a crash down the road.

llvm-svn: 220585

9 years ago[Hexagon] Resubmission of 220427
Colin LeMahieu [Fri, 24 Oct 2014 19:00:32 +0000 (19:00 +0000)]
[Hexagon] Resubmission of 220427
Modified library structure to deal with circular dependency between HexagonInstPrinter and HexagonMCInst.
Adding encoding bits for add opcode.
Adding llvm-mc tests.
Removing unit tests.

http://reviews.llvm.org/D5624

llvm-svn: 220584

9 years agoPatch from ovyalov@google.com:
Jim Ingham [Fri, 24 Oct 2014 18:51:57 +0000 (18:51 +0000)]
Patch from ovyalov@google.com:

Handle pexpect exceptions correctly so that processes spawned with
pexpect are always reaped.

llvm-svn: 220583

9 years agoAdd runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames...
Alexey Samsonov [Fri, 24 Oct 2014 18:34:43 +0000 (18:34 +0000)]
Add runtime flag 'symbolize_inline_frames' to disable symbolization of inlined frames done in llvm-symbolizer

llvm-svn: 220582

9 years agoFix copy paste comment
Matt Arsenault [Fri, 24 Oct 2014 18:13:10 +0000 (18:13 +0000)]
Fix copy paste comment

llvm-svn: 220581

9 years agoDon't ever call materializeAllPermanently during LTO.
Rafael Espindola [Fri, 24 Oct 2014 18:13:04 +0000 (18:13 +0000)]
Don't ever call materializeAllPermanently during LTO.

To do this, change the representation of lazy loaded functions.

The previous representation cannot differentiate between a function whose body
has been removed and one whose body hasn't been read from the .bc file. That
means that in order to drop a function, the entire body had to be read.

llvm-svn: 220580

9 years agoAllow AVX vrsqrtps generation.
Sanjay Patel [Fri, 24 Oct 2014 17:59:18 +0000 (17:59 +0000)]
Allow AVX vrsqrtps generation.

This is a follow-on to r220570 that allows a 256-bit (v8f32)
version of vrsqrtps to be generated.

llvm-svn: 220579

9 years agoDebugInfo: Sink DwarfDebug::ScopeVariables down into DwarfFile
David Blaikie [Fri, 24 Oct 2014 17:57:34 +0000 (17:57 +0000)]
DebugInfo: Sink DwarfDebug::ScopeVariables down into DwarfFile

(part of refactoring to allow subprogram emission in both the skeleton
and main units to enable -gmlt-like data to be included in the skeleton
for live inlined backtracing purposes)

llvm-svn: 220578

9 years agoremove class/function/variable names from comments; NFC
Sanjay Patel [Fri, 24 Oct 2014 17:55:59 +0000 (17:55 +0000)]
remove class/function/variable names from comments; NFC

llvm-svn: 220577

9 years agoFix windows-cross.c test on my machine
Reid Kleckner [Fri, 24 Oct 2014 17:55:29 +0000 (17:55 +0000)]
Fix windows-cross.c test on my machine

I suspect it will need a custom sysroot to pass reliably elsewhere.

llvm-svn: 220576

9 years agoRemove DwarfDebug::FirstCU as it has no use
David Blaikie [Fri, 24 Oct 2014 17:53:38 +0000 (17:53 +0000)]
Remove DwarfDebug::FirstCU as it has no use

It was only being used as a flag to identify the lack of debug info from
within endModule - use the section labels for that instead.

llvm-svn: 220575

9 years agoMake ProcessWindows just use Host::LaunchProcess.
Zachary Turner [Fri, 24 Oct 2014 17:51:56 +0000 (17:51 +0000)]
Make ProcessWindows just use Host::LaunchProcess.

llvm-svn: 220574

9 years agoAdd frontend support for __vectorcall
Reid Kleckner [Fri, 24 Oct 2014 17:42:17 +0000 (17:42 +0000)]
Add frontend support for __vectorcall

Wire it through everywhere we have support for fastcall, essentially.

This allows us to parse the MSVC "14" CTP headers, but we will
miscompile them because LLVM doesn't support __vectorcall yet.

Reviewed By: Aaron Ballman

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

llvm-svn: 220573

9 years agoUse enumerators instead of hardcoded integers when processing macro names.
Serge Pavlov [Fri, 24 Oct 2014 17:31:32 +0000 (17:31 +0000)]
Use enumerators instead of hardcoded integers when processing macro names.

llvm-svn: 220572

9 years agotsan: support mmap(MAP_32BIT)
Dmitry Vyukov [Fri, 24 Oct 2014 17:07:29 +0000 (17:07 +0000)]
tsan: support mmap(MAP_32BIT)
Allow user memory in the first TB of address space.
This also enabled non-pie binaries and freebsd.
Fixes issue:
https://code.google.com/p/thread-sanitizer/issues/detail?id=5

llvm-svn: 220571

9 years agoUse rsqrt (X86) to speed up reciprocal square root calcs
Sanjay Patel [Fri, 24 Oct 2014 17:02:16 +0000 (17:02 +0000)]
Use rsqrt (X86) to speed up reciprocal square root calcs

This is a first step for generating SSE rsqrt instructions for
reciprocal square root calcs when fast-math is allowed.

For now, be conservative and only enable this for AMD btver2
where performance improves significantly - for example, 29%
on llvm/projects/test-suite/SingleSource/Benchmarks/BenchmarkGame/n-body.c
(if we convert the data type to single-precision float).

This patch adds a two constant version of the Newton-Raphson
refinement algorithm to DAGCombiner that can be selected by any target
via a parameter returned by getRsqrtEstimate()..

See PR20900 for more details:
http://llvm.org/bugs/show_bug.cgi?id=20900

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

llvm-svn: 220570

9 years ago[Modules] Free modules that failed signature verification.
Benjamin Kramer [Fri, 24 Oct 2014 16:31:42 +0000 (16:31 +0000)]
[Modules] Free modules that failed signature verification.

The control flow and ownership is weird enough so unique_ptr doesn't help here :(

llvm-svn: 220569

9 years ago[mips] Replace MipsABIEnum with a MipsABIInfo class.
Daniel Sanders [Fri, 24 Oct 2014 16:15:27 +0000 (16:15 +0000)]
[mips] Replace MipsABIEnum with a MipsABIInfo class.

Summary:
No functional change yet, it's just an object replacement for an enum.
It will allow us to gather ABI information in a single place so that we can
start testing for properties of the ABI's instead of the ABI itself.

For example we will eventually be able to use:
  ABI.MinStackAlignmentInBytes()
instead of:
  (isABI_N32() || isABI_N64()) ? 16 : 8
which is clearer and more maintainable.

Reviewers: matheusalmeida

Reviewed By: matheusalmeida

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

llvm-svn: 220568

9 years ago[Object] Fix MachO's getUuid to return a pointer into the object instead of a danglin...
Benjamin Kramer [Fri, 24 Oct 2014 15:52:05 +0000 (15:52 +0000)]
[Object] Fix MachO's getUuid to return a pointer into the object instead of a dangling ArrayRef.

This works because uuid's are always little endian so it's not swapped.
Fixes use-after-return reported by asan.

llvm-svn: 220567

9 years ago[mips] Mark aggregate arguments passed in registers with the inreg attribute
Daniel Sanders [Fri, 24 Oct 2014 15:30:16 +0000 (15:30 +0000)]
[mips] Mark aggregate arguments passed in registers with the inreg attribute

Summary:
This allows us to easily identify them in the backend which in turn allows us
to handle them correctly for big-endian targets (where they must be shifted
into the upper bits of the register).

Depends on D5961

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

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

llvm-svn: 220566

9 years agoThese functions are not actually defined for NDEBUG or !LLVM_DUMP_ENABLED, so guardin...
Aaron Ballman [Fri, 24 Oct 2014 15:16:39 +0000 (15:16 +0000)]
These functions are not actually defined for NDEBUG or !LLVM_DUMP_ENABLED, so guarding the declarations as well. NFC, silences MSVC warnings in release builds.

llvm-svn: 220565

9 years ago[mips] Fix >80-column line
Daniel Sanders [Fri, 24 Oct 2014 14:46:00 +0000 (14:46 +0000)]
[mips] Fix >80-column line

llvm-svn: 220564

9 years ago[mips] Promote all integral/enumeration types to the GPR width
Daniel Sanders [Fri, 24 Oct 2014 14:42:42 +0000 (14:42 +0000)]
[mips] Promote all integral/enumeration types to the GPR width

Summary:
Ensure all integral/enumeration types are appropriately annotated with
signext/zeroext. In particular, i32 now has these attributes when using the
N32/N64 ABI. This paves the way for accurately representing the way the
N32/N64 ABI's promotes integer arguments to i64.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits, theraven

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

llvm-svn: 220563

9 years agoFix initializing TypeOfTypeLoc
Olivier Goffart [Fri, 24 Oct 2014 13:52:55 +0000 (13:52 +0000)]
Fix initializing TypeOfTypeLoc

This fixes a crash in the RecursiveASTVisitor on such code
 __typeof__(struct F*) var[invalid];

The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when
created from ASTContext::getTrivialTypeSourceInfo
This lead to a crash in RecursiveASTVisitor when trying to access it.

llvm-svn: 220562

9 years ago[mips] Remove redundant code in RetCC_MipsN. NFC.
Daniel Sanders [Fri, 24 Oct 2014 13:49:54 +0000 (13:49 +0000)]
[mips] Remove redundant code in RetCC_MipsN. NFC.

Summary:
i32 is always promoted to i64 so it no longer makes sense to assign i32 to
registers.

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

llvm-svn: 220561

9 years agoASTMatchers: Peel off a layer of indirection from true matcher. NFC.
Benjamin Kramer [Fri, 24 Oct 2014 13:29:21 +0000 (13:29 +0000)]
ASTMatchers: Peel off a layer of indirection from true matcher. NFC.

llvm-svn: 220560

9 years agoASTMatchers: for-rangify loops. No functionality change.
Benjamin Kramer [Fri, 24 Oct 2014 13:29:15 +0000 (13:29 +0000)]
ASTMatchers: for-rangify loops. No functionality change.

llvm-svn: 220559

9 years agoAdd arguments() to CXXConstructExpr so the same interface as with CallExpr can be...
Benjamin Kramer [Fri, 24 Oct 2014 13:29:07 +0000 (13:29 +0000)]
Add arguments() to CXXConstructExpr so the same interface as with CallExpr can be used.

llvm-svn: 220558

9 years agoReport when a function-try-block does not return a value on all control paths. Fixed...
Aaron Ballman [Fri, 24 Oct 2014 13:19:19 +0000 (13:19 +0000)]
Report when a function-try-block does not return a value on all control paths. Fixed PR14620.

llvm-svn: 220557

9 years ago[mips] For N32/N64, structs must be passed in the upper bits of a register.
Daniel Sanders [Fri, 24 Oct 2014 13:09:19 +0000 (13:09 +0000)]
[mips] For N32/N64, structs must be passed in the upper bits of a register.

Summary:
Most structs were fixed by r218451 but those of between >32-bits and
<64-bits remained broken since they were not marked with [ASZ]ExtUpper.
This patch fixes the remaining cases by using
CCPromoteToUpperBitsInType<i64> on i64's in addition to i32 and smaller.

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

llvm-svn: 220556

9 years ago[Thumb] Clang thinks "char" is signed when using a thumb triple
Oliver Stannard [Fri, 24 Oct 2014 11:28:47 +0000 (11:28 +0000)]
[Thumb] Clang thinks "char" is signed when using a thumb triple

'char' is unsigned on all ARM and Thumb architectures. Clang gets this
right for ARM, and for thumb when using and arm triple and the -mthumb
option, but gets it wrong for thumb triples. This fixes that.

llvm-svn: 220555

9 years ago[Tsan] Do not intercept non-FreeBSD functions on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 10:55:03 +0000 (10:55 +0000)]
[Tsan] Do not intercept non-FreeBSD functions on FreeBSD
Differential Revision: http://reviews.llvm.org/D5858

llvm-svn: 220554

9 years ago[AArch64] Fix fast-isel of cbz of i1, i8, i16
Oliver Stannard [Fri, 24 Oct 2014 09:54:41 +0000 (09:54 +0000)]
[AArch64] Fix fast-isel of cbz of i1, i8, i16

This fixes a miscompilation in the AArch64 fast-isel which was
triggered when a branch is based on an icmp with condition eq or ne,
and type i1, i8 or i16. The cbz instruction compares the whole 32-bit
register, so values with the bottom 1, 8 or 16 bits clear would cause
the wrong branch to be taken.

llvm-svn: 220553

9 years ago[Tsan] Fix the thread_name tests to build on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:27:34 +0000 (09:27 +0000)]
[Tsan] Fix the thread_name tests to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5855

llvm-svn: 220552

9 years ago[Tsan] Intercept pthread_set_name_np on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:23:06 +0000 (09:23 +0000)]
[Tsan] Intercept pthread_set_name_np on FreeBSD
Differential Revision: http://reviews.llvm.org/D5932

llvm-svn: 220551

9 years ago[Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Viktor Kutuzov [Fri, 24 Oct 2014 09:20:20 +0000 (09:20 +0000)]
[Tsan] Fix the signal_recursive.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D5841

llvm-svn: 220550

9 years ago[CMake] clangRewrite: Roll back clangAST in libdeps, due to clang::Stmt::printPretty().
NAKAMURA Takumi [Fri, 24 Oct 2014 08:44:01 +0000 (08:44 +0000)]
[CMake] clangRewrite: Roll back clangAST in libdeps, due to clang::Stmt::printPretty().

llvm-svn: 220549

9 years agoUpdate test/MC/ARM/coff-debugging-secrel.ll expectations to fix breakage caused by...
Timur Iskhodzhanov [Fri, 24 Oct 2014 06:24:07 +0000 (06:24 +0000)]
Update test/MC/ARM/coff-debugging-secrel.ll expectations to fix breakage caused by r220544

llvm-svn: 220548

9 years agoDriver: add missed file from previous commit
Saleem Abdulrasool [Fri, 24 Oct 2014 03:24:33 +0000 (03:24 +0000)]
Driver: add missed file from previous commit

llvm-svn: 220547

9 years agoDriver: add CrossWindowsToolChain
Saleem Abdulrasool [Fri, 24 Oct 2014 03:13:37 +0000 (03:13 +0000)]
Driver: add CrossWindowsToolChain

This is a very basic toolchain.  It supports cross-compiling Windows (primarily
inspired by the WoA target).  It is meant to use clang with the LLVM IAS and a
binutils ld-compatible interface for the linker (eventually to be lld).  It does
not perform any "standard" GCC lookup, nor does it perform any special
adjustments given that it is expected to be used in an environment where the
user is using MSVCRT (and as such Visual Studio headers) and the Windows SDK.
The primary runtime library is expected to be compiler-rt and the C++
implementation to be libc++.

It also expects that a sysroot has been setup given the usual Unix semantics
(standard C headers in /usr/include, all the import libraries available in
/usr/lib).  It also expects that an entry point stub is present in /usr/lib
(crtbegin.obj for executables, crtbeginS.obj for shared libraries).

The entry point stub is responsible for running any GNU constructors.

llvm-svn: 220546

9 years agoAdded reset of LexicalScope in LiveDebugVariables reset function.
Marcello Maggioni [Fri, 24 Oct 2014 02:46:50 +0000 (02:46 +0000)]
Added reset of LexicalScope in LiveDebugVariables reset function.

llvm-svn: 220545

9 years agoFix PR21189 -- Emit symbol subsection required to debug LLVM-built binaries with...
Timur Iskhodzhanov [Fri, 24 Oct 2014 01:27:45 +0000 (01:27 +0000)]
Fix PR21189 -- Emit symbol subsection required to debug LLVM-built binaries with VS2012+

Reviewed at http://reviews.llvm.org/D5772

llvm-svn: 220544

9 years agoAdd a new -fmerge-functions -cc1 flag that enables function merging.
Nick Lewycky [Fri, 24 Oct 2014 00:49:29 +0000 (00:49 +0000)]
Add a new -fmerge-functions -cc1 flag that enables function merging.

llvm-svn: 220543

9 years agoDebugInfo: Remove DwarfDebug::addScopeVariable now that it's just a trivial wrapper
David Blaikie [Fri, 24 Oct 2014 00:43:47 +0000 (00:43 +0000)]
DebugInfo: Remove DwarfDebug::addScopeVariable now that it's just a trivial wrapper

llvm-svn: 220542

9 years agoMake test for r220533 more robust by using GPR pattern.
Ahmed Bougacha [Fri, 24 Oct 2014 00:03:46 +0000 (00:03 +0000)]
Make test for r220533 more robust by using GPR pattern.

llvm-svn: 220541

9 years ago[AVX512] FMA support for the 231 variants
Adam Nemet [Fri, 24 Oct 2014 00:03:00 +0000 (00:03 +0000)]
[AVX512] FMA support for the 231 variants

This is asm/diasm-only support, similar to AVX.

For ISeling the register variant, they are no different from 213 other than
whether the multiplication or the addition operand is destructed.

For ISeling the memory variant, i.e. to fold a load, they are no different
than the 132 variant.  The addition operand (op3) in both cases can come from
memory.  Again the ony difference is which operand is destructed.

There could be a post-RA pass that would convert a 213 or 132 into a 231.

Part of <rdar://problem/17082571>

llvm-svn: 220540

9 years ago[AVX512] Introduce fma3p_forms from AVX
Adam Nemet [Fri, 24 Oct 2014 00:02:55 +0000 (00:02 +0000)]
[AVX512] Introduce fma3p_forms from AVX

This multiclass generates the different forms: 213, 231, 132 in AVX.

132 in AVX512 is a separate class but I am planning to use this same
multiclass to generate 231 relying on the nice the null_frag trick from AVX to
disable codegen pattern for 231.

No functionality change, no change in X86.td.expanded except for the different
instruction definition names.

llvm-svn: 220539

9 years agoIf requested, apply function merging at -O0 too. It's useful there to reduce the...
Nick Lewycky [Thu, 23 Oct 2014 23:49:31 +0000 (23:49 +0000)]
If requested, apply function merging at -O0 too. It's useful there to reduce the time to compile.

llvm-svn: 220537

9 years agoMake getDISubprogram(const Function *F) available in LLVM
Timur Iskhodzhanov [Thu, 23 Oct 2014 23:46:28 +0000 (23:46 +0000)]
Make getDISubprogram(const Function *F) available in LLVM

Reviewed at http://reviews.llvm.org/D5950

llvm-svn: 220536

9 years agoChange uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Eric Fiselier [Thu, 23 Oct 2014 23:05:46 +0000 (23:05 +0000)]
Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')

Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220535

9 years agoChange uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')
Eric Fiselier [Thu, 23 Oct 2014 22:57:56 +0000 (22:57 +0000)]
Change uses of `sys.platform == 'linux2' to `sys.platform.startswith('linux')

Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.

llvm-svn: 220534

9 years ago[SelectionDAG] Teach the vector scalarizer about FP conversions.
Ahmed Bougacha [Thu, 23 Oct 2014 22:49:25 +0000 (22:49 +0000)]
[SelectionDAG] Teach the vector scalarizer about FP conversions.

This adds support for legalization of instructions of the form:

  [fp_conv] <1 x i1> %op to <1 x double>

where fp_conv is one of fpto[us]i, [us]itofp.  This used to assert
because they were simply missing from the vector operand scalarizer.

A similar problem arose in r190830, with trunc instead.

Fixes PR20778.

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

llvm-svn: 220533

9 years agoDon't emit strong vtable definitions for imported classes with key functions (PR21355)
Hans Wennborg [Thu, 23 Oct 2014 22:40:46 +0000 (22:40 +0000)]
Don't emit strong vtable definitions for imported classes with key functions (PR21355)

Clang would previously assert on the following code when targeting MinGW:

  struct __declspec(dllimport) S {
      virtual ~S();
  };
  S::~S() {}

Because ~S is a key function and the class is dllimport, we would try to emit a
strong definition of the vtable, with dllimport - which is a conflict. We
should not emit strong vtable definitions for imported classes.

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

llvm-svn: 220532

9 years agoUpdate comment and fix typos in assert message. (NFC)
Ahmed Bougacha [Thu, 23 Oct 2014 22:40:34 +0000 (22:40 +0000)]
Update comment and fix typos in assert message. (NFC)

llvm-svn: 220531

9 years agoUpdate llvm.donothing documentation.
Juergen Ributzka [Thu, 23 Oct 2014 22:36:13 +0000 (22:36 +0000)]
Update llvm.donothing documentation.

llvm.donothing is no longer the only intrinsic that can be invoked.

llvm-svn: 220530

9 years agoScheduleDAG: record PhysReg dependencies represented by CopyFromReg nodes
Tim Northover [Thu, 23 Oct 2014 22:31:48 +0000 (22:31 +0000)]
ScheduleDAG: record PhysReg dependencies represented by CopyFromReg nodes

x86's CMPXCHG -> EFLAGS consumer wasn't being recorded as a real EFLAGS
dependency because it was represented by a pair of CopyFromReg(EFLAGS) ->
CopyToReg(EFLAGS) nodes. ScheduleDAG was expecting the source to be an
implicit-def on the instruction, where the result numbers in the DAG and the
Uses list in TableGen matched up precisely.

The Copy notation seems much more robust, so this patch extends ScheduleDAG
rather than refactoring x86.

Should fix PR20376.

llvm-svn: 220529

9 years ago[sanitizer] Add a bunch of sanity checks.
Evgeniy Stepanov [Thu, 23 Oct 2014 22:29:51 +0000 (22:29 +0000)]
[sanitizer] Add a bunch of sanity checks.

llvm-svn: 220528

9 years agoDebugInfo: Remove DwarfDebug::CurrentFnArguments since we have to handle argument...
David Blaikie [Thu, 23 Oct 2014 22:27:50 +0000 (22:27 +0000)]
DebugInfo: Remove DwarfDebug::CurrentFnArguments since we have to handle argument ordering of other arguments (abstract arguments) in the same way and already have code for that too.

While refactoring this code I was confused by both the name I had
introduced (addNonArgumentVariable... but it has all this logic to
handle argument numbering and keep things in order?) and by the
redundancy. Seems when I fixed the misordered inlined argument handling,
I didn't realize it was mostly redundant with the argument ordering code
(which I may've also written, I'm not sure). So let's just rely on the
more general case.

The only oddity in output this produces is that it means when we emit
all the variables for the current function, we don't track when we've
finished the argument variables and are about to start the local
variables and insert DW_AT_unspecified_parameters (for varargs
functions) there. Instead it ends up after the local variables, scopes,
etc. But this isn't invalid and doesn't cause DWARF consumers problems
that I know of... so we'll just go with that because it makes the code
nice & simple.

(though, let's see what the buildbots have to say about this - *crosses
fingers*)

There will be some cleanup commits to follow to remove the now trivial
wrappers, etc.

llvm-svn: 220527

9 years agoPR21189: Teach llvm-readobj to dump bits of COFF symbol subsections required to debug...
Timur Iskhodzhanov [Thu, 23 Oct 2014 22:25:31 +0000 (22:25 +0000)]
PR21189: Teach llvm-readobj to dump bits of COFF symbol subsections required to debug using VS2012+

Reviewed at http://reviews.llvm.org/D5755
Thanks to Andrey Guskov for his help investigating this!

llvm-svn: 220526

9 years agoDriver: Include driver diagnostics when we --serialize-diagnostics
Justin Bogner [Thu, 23 Oct 2014 22:20:11 +0000 (22:20 +0000)]
Driver: Include driver diagnostics when we --serialize-diagnostics

Currently, when --serialize-diagnostics is passed this only includes
the diagnostics from clang -cc1, and driver diagnostics are
dropped. This causes issues for tools that use the serialized
diagnostics, since stderr is lost and these diagnostics aren't seen at
all.

We handle this by merging the diagnostics from the CC1 process and the
driver diagnostics into a single file when the driver invokes CC1.

Fixes rdar://problem/10585062

llvm-svn: 220525

9 years ago[modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust against...
Richard Smith [Thu, 23 Oct 2014 22:18:29 +0000 (22:18 +0000)]
[modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust against changes to record order.

llvm-svn: 220524

9 years agoCmake variables are global, which is why we would get crud like /machine:X86 in the...
Aaron Ballman [Thu, 23 Oct 2014 22:13:52 +0000 (22:13 +0000)]
Cmake variables are global, which is why we would get crud like /machine:X86 in the list of compiler options for MSVC. Clear out the variable before attempting to enumerate arguments and set them.

llvm-svn: 220522

9 years agoFactor out common checks from module map deserialization. No functionality change.
Richard Smith [Thu, 23 Oct 2014 22:12:14 +0000 (22:12 +0000)]
Factor out common checks from module map deserialization. No functionality change.

llvm-svn: 220521

9 years agoDebugInfo: Sink DwarfDebug::addNonArgumentScopeVariable into DwarfFile.
David Blaikie [Thu, 23 Oct 2014 22:04:30 +0000 (22:04 +0000)]
DebugInfo: Sink DwarfDebug::addNonArgumentScopeVariable into DwarfFile.

llvm-svn: 220520

9 years agoAppeasing an MSVC compile warning about "and"; NFC.
Aaron Ballman [Thu, 23 Oct 2014 21:59:34 +0000 (21:59 +0000)]
Appeasing an MSVC compile warning about "and"; NFC.

llvm-svn: 220519

9 years agoMachODump.cpp: fix MSVC build
Hans Wennborg [Thu, 23 Oct 2014 21:59:17 +0000 (21:59 +0000)]
MachODump.cpp: fix MSVC build

llvm-svn: 220518

9 years agoDo not set linker flags for MSVC; they are not the same thing as compiler flags....
Aaron Ballman [Thu, 23 Oct 2014 21:58:36 +0000 (21:58 +0000)]
Do not set linker flags for MSVC; they are not the same thing as compiler flags. Note, this is already done in the add_compiler_rt_test test_suite function.

llvm-svn: 220517

9 years ago[X86] Improve mul w/ overflow codegen, to MUL8+SETO.
Ahmed Bougacha [Thu, 23 Oct 2014 21:55:31 +0000 (21:55 +0000)]
[X86] Improve mul w/ overflow codegen, to MUL8+SETO.

Currently, @llvm.smul.with.overflow.i8 expands to 9 instructions, where
3 are really needed.

This adds X86ISD::UMUL8/SMUL8 SD nodes, and custom lowers them to
MUL8/IMUL8 + SETO.

i8 is a special case because there is no two/three operand variants of
(I)MUL8, so the first operand and return value need to go in AL/AX.

Also, we can't write patterns for these instructions: TableGen refuses
patterns where output operands don't match SDNode results. In this case,
instructions where the output operand is an implicitly defined register.

A related special case (and FIXME) exists for MUL8 (X86InstrArith.td):

  // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
  // This probably ought to be moved to a def : Pat<> if the
  // syntax can be accepted.
  [(set AL, (mul AL, GR8:$src)), (implicit EFLAGS)]

Ideally, these go away with UMUL8, but we still need to improve TableGen
support of implicit operands in patterns.

Before this change:
  movsbl  %sil, %eax
  movsbl  %dil, %ecx
  imull   %eax, %ecx
  movb    %cl, %al
  sarb    $7, %al
  movzbl  %al, %eax
  movzbl  %ch, %esi
  cmpl    %eax, %esi
  setne   %al

After:
  movb    %dil, %al
  imulb   %sil
  seto    %al

Also, remove a made-redundant testcase for PR19858, and enable more FastISel
ALU-overflow tests for SelectionDAG too.

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

llvm-svn: 220516

9 years agoDebugInfo: Remove DwarfDebug::addCurrentFnArgument declaration now that it's moved...
David Blaikie [Thu, 23 Oct 2014 21:53:17 +0000 (21:53 +0000)]
DebugInfo: Remove DwarfDebug::addCurrentFnArgument declaration now that it's moved to DwarfFile.

llvm-svn: 220515

9 years agoHandle sqrt() shrinking in SimplifyLibCalls like any other call
Sanjay Patel [Thu, 23 Oct 2014 21:52:45 +0000 (21:52 +0000)]
Handle sqrt() shrinking in SimplifyLibCalls like any other call

This patch removes a chunk of special case logic for folding
(float)sqrt((double)x) -> sqrtf(x)
in InstCombineCasts and handles it in the mainstream path of SimplifyLibCalls.

No functional change intended, but I loosened the restriction on the existing
sqrt testcases to allow for this optimization even without unsafe-fp-math because
that's the existing behavior.

I also added a missing test case for not shrinking the llvm.sqrt.f64 intrinsic
in case the result is used as a double.

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

llvm-svn: 220514

9 years agoThis test case should not rely on stepping behavior because that might chance due...
Enrico Granata [Thu, 23 Oct 2014 21:35:18 +0000 (21:35 +0000)]
This test case should not rely on stepping behavior because that might chance due to inlining. Set breakpoints where you want them instead. Fixes rdar://18724175

llvm-svn: 220513

9 years ago[libcxx] XFAIL all currently failing libc++ tests for linux.
Eric Fiselier [Thu, 23 Oct 2014 21:17:36 +0000 (21:17 +0000)]
[libcxx] XFAIL all currently failing libc++ tests for linux.

Summary:
Pretty please? We now have a significant number of builders that test libc++. I really want those builders to be green.
Most of these failures are due to differences in locale data, including those in regex. I will continue working on fixing the locale and regex tests but there is no consensus on what the correct direction to go.

Since the builders display a list of XFAIL tests they are by no means hidden. It just means they are expected failures. Now unexpected failures won't get mixed in with well known and expected failures.

Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 220512

9 years agoFix a problem where an SBType was advertising its static type class even though a...
Enrico Granata [Thu, 23 Oct 2014 21:15:20 +0000 (21:15 +0000)]
Fix a problem where an SBType was advertising its static type class even though a dynamic type was available. Solves rdar://18744420

llvm-svn: 220511

9 years agoOnly link tests against -ldl on linux
Eric Fiselier [Thu, 23 Oct 2014 20:45:37 +0000 (20:45 +0000)]
Only link tests against -ldl on linux

llvm-svn: 220510

9 years agoOnly link the tests against -ldl on linux
Eric Fiselier [Thu, 23 Oct 2014 20:44:25 +0000 (20:44 +0000)]
Only link the tests against -ldl on linux

llvm-svn: 220509

9 years ago[PECOFF] Fix /nodefaultlib option.
Rui Ueyama [Thu, 23 Oct 2014 20:42:07 +0000 (20:42 +0000)]
[PECOFF] Fix /nodefaultlib option.

/nodefaultlib argument is a path name, so that needs to be compared
case-insensitive way. Also the ".lib" extension should be ignored.

llvm-svn: 220508

9 years agoDisabling some MSVC warnings that are of questionable value. Note, these are disabled...
Aaron Ballman [Thu, 23 Oct 2014 20:39:58 +0000 (20:39 +0000)]
Disabling some MSVC warnings that are of questionable value. Note, these are disabled by default in LLVM as well, so there is precedence.

C4146: 'unary minus operator applied to unsigned type, result still unsigned'
C4291: ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
C4800: ''type' : forcing value to bool 'true' or 'false' (performance warning)'
llvm-svn: 220507

9 years agoChange all of the build flags to switch /MD and /MDd into /MT, instead of just some...
Aaron Ballman [Thu, 23 Oct 2014 20:24:00 +0000 (20:24 +0000)]
Change all of the build flags to switch /MD and /MDd into /MT, instead of just some of the targets. Fixes PR21241.

llvm-svn: 220506

9 years agoclang-format: Fix incorrect space after "<".
Daniel Jasper [Thu, 23 Oct 2014 20:22:22 +0000 (20:22 +0000)]
clang-format: Fix incorrect space after "<".

Before:
  bool a = 2 <::SomeFunction();

After:
  bool a = 2 < ::SomeFunction();

llvm-svn: 220505

9 years agoChange the name of the field BindTable to bindtable to not over lap the type.
Kevin Enderby [Thu, 23 Oct 2014 19:53:12 +0000 (19:53 +0000)]
Change the name of the field BindTable to bindtable to not over lap the type.

Should fix the build bot issues from commit r220500.

llvm-svn: 220504

9 years agoMake llvm-go test dependency optional.
Peter Collingbourne [Thu, 23 Oct 2014 19:51:40 +0000 (19:51 +0000)]
Make llvm-go test dependency optional.

llvm-svn: 220503

9 years agoRemove code duplication and cut dependency from clangRewrite on
Daniel Jasper [Thu, 23 Oct 2014 19:47:36 +0000 (19:47 +0000)]
Remove code duplication and cut dependency from clangRewrite on
clangAST.

llvm-svn: 220502

9 years agoMake llvm-link behave a bit more like LTO.
Rafael Espindola [Thu, 23 Oct 2014 19:40:45 +0000 (19:40 +0000)]
Make llvm-link behave a bit more like LTO.

* Read modules lazily
* Don't treat the first file specially, instead merge all inputs into an empty
  module.

llvm-svn: 220501

9 years agoUpdate llvm-objdump’s Mach-O symbolizer code for Objective-C references.
Kevin Enderby [Thu, 23 Oct 2014 19:37:31 +0000 (19:37 +0000)]
Update llvm-objdump’s Mach-O symbolizer code for Objective-C references.

This prints disassembly comments for Objective-C references to CFStrings,
Selectors, Classes and method calls.

llvm-svn: 220500

9 years agoCleanup this test a bit.
Rafael Espindola [Thu, 23 Oct 2014 19:36:21 +0000 (19:36 +0000)]
Cleanup this test a bit.

Use simpler names and remove unnecessary fields.

llvm-svn: 220499

9 years agoCleanup this test a bit.
Rafael Espindola [Thu, 23 Oct 2014 19:23:42 +0000 (19:23 +0000)]
Cleanup this test a bit.

Use simpler names and remove unnecessary fields.

llvm-svn: 220498

9 years agoDebugInfo: Simplify/tidy/correct global variable decl/def emission handling.
David Blaikie [Thu, 23 Oct 2014 19:12:43 +0000 (19:12 +0000)]
DebugInfo: Simplify/tidy/correct global variable decl/def emission handling.

This fixes a bug (introduced by fixing the IR emitted from Clang where
the definition of a static member would be scoped within the class,
rather than within its lexical decl context) where the definition of a
static variable would be placed inside a class.

It also improves source fidelity by scoping static class member
definitions inside the lexical decl context in which tehy are written
(eg: namespace n { class foo { static int i; } int foo::i; } - the
definition of 'i' will be within the namespace 'n' in the DWARF output
now).

Lastly, and the original goal, this reduces debug info size slightly
(and makes debug info easier to read, etc) by placing the definitions of
non-member global variables within their namespace, rather than using a
separate namespace-scoped declaration along with a definition at global
scope.

Based on patches and discussion with Frédéric.

llvm-svn: 220497

9 years agopatch to issue warning on comparing parameters with
Fariborz Jahanian [Thu, 23 Oct 2014 19:00:10 +0000 (19:00 +0000)]
patch to issue warning on comparing parameters with
nonnull attribute when comparison is always
true/false. Patch by Steven Wu with few fixes and minor
refactoring and adding tests by me. rdar://18712242

llvm-svn: 220496

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 23 Oct 2014 18:52:46 +0000 (18:52 +0000)]
Make this test a bit stricter.

This now:
* Forces the linker to include the internal definition.
* Checks the full output.

llvm-svn: 220495

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 23 Oct 2014 18:44:07 +0000 (18:44 +0000)]
Make this test a bit stricter.

This now:
* Forces the linker to include the internal definition.
* Checks the full output.

llvm-svn: 220494