platform/upstream/llvm.git
9 years ago[CUDA] Implemented __nvvm_atom_*_gen_* builtins.
Artem Belevich [Thu, 25 Jun 2015 18:29:42 +0000 (18:29 +0000)]
[CUDA] Implemented __nvvm_atom_*_gen_* builtins.

Integer variants are implemented as atomicrmw or cmpxchg instructions.
Atomic add for floating point (__nvvm_atom_add_gen_f()) is implemented
as a call to an overloaded @llvm.nvvm.atomic.load.add.f32.* LVVM
intrinsic.

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

llvm-svn: 240669

9 years ago[sanitizer] Disable signal_segv_handler test.
Evgeniy Stepanov [Thu, 25 Jun 2015 18:23:58 +0000 (18:23 +0000)]
[sanitizer] Disable signal_segv_handler test.

Random failures on the bots.

llvm-svn: 240668

9 years agoCOFF: Simplify. NFC.
Rui Ueyama [Thu, 25 Jun 2015 17:56:36 +0000 (17:56 +0000)]
COFF: Simplify. NFC.

llvm-svn: 240666

9 years agoCOFF: Use std::equal to compare two lists of relocations.
Rui Ueyama [Thu, 25 Jun 2015 17:51:07 +0000 (17:51 +0000)]
COFF: Use std::equal to compare two lists of relocations.

llvm-svn: 240665

9 years agoOmit 'nodebug' methods from the class description.
Paul Robinson [Thu, 25 Jun 2015 17:50:43 +0000 (17:50 +0000)]
Omit 'nodebug' methods from the class description.

llvm-svn: 240664

9 years agoSubmitting patch from Abhishek for:
Greg Clayton [Thu, 25 Jun 2015 17:50:15 +0000 (17:50 +0000)]
Submitting patch from Abhishek for:

http://reviews.llvm.org/D10309

llvm-svn: 240663

9 years agoRename Mangled::GetLanguage to Mangled::GuessLanguage
Dawn Perchik [Thu, 25 Jun 2015 17:45:53 +0000 (17:45 +0000)]
Rename Mangled::GetLanguage to Mangled::GuessLanguage

The language can not be definitively determined from the mangling, so
this new name helps clarify that fact.  This addresses the concerns raised
in http://reviews.llvm.org/rL226962.
Reviewed by: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D10723

llvm-svn: 240662

9 years agoCOFF: Don't use COFFHeader->NumberOfRelocations.
Rui Ueyama [Thu, 25 Jun 2015 17:43:37 +0000 (17:43 +0000)]
COFF: Don't use COFFHeader->NumberOfRelocations.

The size of the field is 16 bit, so it's inaccurate if the
number of relocations in a section is more than 65535.

llvm-svn: 240661

9 years agoAdd const versions of SBFrame::GetFunctionName and SBFrame::IsInlined.
Oleksiy Vyalov [Thu, 25 Jun 2015 17:41:41 +0000 (17:41 +0000)]
Add const versions of SBFrame::GetFunctionName and SBFrame::IsInlined.

http://reviews.llvm.org/D10711

llvm-svn: 240660

9 years ago[NVPTX] Fixed a typo in __nvvm_atom_min_gen_l() type string.
Artem Belevich [Thu, 25 Jun 2015 17:34:23 +0000 (17:34 +0000)]
[NVPTX] Fixed a typo in __nvvm_atom_min_gen_l() type string.

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

llvm-svn: 240659

9 years agoUpdate for llvm change.
Rafael Espindola [Thu, 25 Jun 2015 17:04:12 +0000 (17:04 +0000)]
Update for llvm change.

llvm-svn: 240658

9 years agoFix autotools build
Michael Kruse [Thu, 25 Jun 2015 16:50:13 +0000 (16:50 +0000)]
Fix autotools build

There were two issues:
* ISL's configure generates include/isl/stdint.h, not isl/stdint.h as
  assumed. This is also changed in the CMake build.

* Need to pass --with-int=imath to ISL's configure; the default is gmp.

Polly's configure has been regenerated due to changing configure.ac

llvm-svn: 240657

9 years agoAdd a test for a recent regression.
Rafael Espindola [Thu, 25 Jun 2015 16:16:08 +0000 (16:16 +0000)]
Add a test for a recent regression.

llvm-svn: 240656

9 years agollvm-nm: print 'n' instead of '?'
Rafael Espindola [Thu, 25 Jun 2015 16:01:53 +0000 (16:01 +0000)]
llvm-nm: print 'n' instead of '?'

This matches gnu nm and has the advantage that there is a upper case N.

llvm-svn: 240655

9 years agoFix #pragma redefine_extname when there is a local variable of the same name. The...
Aaron Ballman [Thu, 25 Jun 2015 15:37:16 +0000 (15:37 +0000)]
Fix #pragma redefine_extname when there is a local variable of the same name. The local should not be renamed, only the externally-available declaration should be.

Patch by Andrey Bokhanko!

llvm-svn: 240653

9 years agoUpdate TestPrintStackTraces XFAIL once more
Pavel Labath [Thu, 25 Jun 2015 15:25:30 +0000 (15:25 +0000)]
Update TestPrintStackTraces XFAIL once more

it seems the failure happens also with clang. The main thing which triggers the failure is
architecture.

llvm-svn: 240652

9 years agoFix TestThreadAPI on Linux
Tamas Berghammer [Thu, 25 Jun 2015 15:19:22 +0000 (15:19 +0000)]
Fix TestThreadAPI on Linux

On Linux malloc calls itself in some case. Change the test case to
handle this scenario.

llvm-svn: 240651

9 years ago[PPC] Implement vmrgew and vmrgow instructions
Kit Barton [Thu, 25 Jun 2015 15:17:40 +0000 (15:17 +0000)]
[PPC] Implement vmrgew and vmrgow instructions

This patch adds support for the vector merge even word and vector merge odd word
instructions introduced in POWER8.

Phabricator review: http://reviews.llvm.org/D10704

llvm-svn: 240650

9 years ago[AsmPrinter] Fix crash in handleIndirectSymViaGOTPCRel
Bruno Cardoso Lopes [Thu, 25 Jun 2015 15:17:23 +0000 (15:17 +0000)]
[AsmPrinter] Fix crash in handleIndirectSymViaGOTPCRel

Check for symbols in MCValue before using them. Bail out early in case
they are null. This fixes PR23779.

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

rdar://problem/21532830

llvm-svn: 240649

9 years agoFix unw_getcontext() return value on AArch64.
Logan Chien [Thu, 25 Jun 2015 15:12:46 +0000 (15:12 +0000)]
Fix unw_getcontext() return value on AArch64.

unw_getcontext() should return UNW_ESUCCESS on success.  Therefore, the
assembly for AArch64 is incorrect because "ldr x0, #0" is a PC-relative
load instead of an immediate value load.

llvm-svn: 240648

9 years agoDoxygen-ify a few comments. NFC
Jonathan Roelofs [Thu, 25 Jun 2015 15:06:47 +0000 (15:06 +0000)]
Doxygen-ify a few comments. NFC

llvm-svn: 240647

9 years agoUse computeSymbolSizes in llvm-symbolize.
Rafael Espindola [Thu, 25 Jun 2015 15:06:38 +0000 (15:06 +0000)]
Use computeSymbolSizes in llvm-symbolize.

llvm-svn: 240646

9 years agoUse range loop. NFC.
Rafael Espindola [Thu, 25 Jun 2015 15:00:38 +0000 (15:00 +0000)]
Use range loop. NFC.

llvm-svn: 240645

9 years agoModernize getELFDynamicSymbolIterators.
Rafael Espindola [Thu, 25 Jun 2015 14:39:35 +0000 (14:39 +0000)]
Modernize getELFDynamicSymbolIterators.

* Have it return a iterator_range.
* Remove the global function.
* Rename to getDynamicSymbolIterators.

llvm-svn: 240644

9 years agoFix a crash by division by zero in analyzer
Daniel Marjamaki [Thu, 25 Jun 2015 14:06:02 +0000 (14:06 +0000)]
Fix a crash by division by zero in analyzer

Patch by takeshi-yoshimura!

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

llvm-svn: 240643

9 years agoDon't use std::make_unique.
Benjamin Kramer [Thu, 25 Jun 2015 13:47:36 +0000 (13:47 +0000)]
Don't use std::make_unique.

We still have to support C++11 standard libraries, make_unique is a C++14
feature.

llvm-svn: 240642

9 years ago[PPC] Replace debug value skipping with getLastNonDebugInstr.
Benjamin Kramer [Thu, 25 Jun 2015 13:39:03 +0000 (13:39 +0000)]
[PPC] Replace debug value skipping with getLastNonDebugInstr.

No functionality change intended.

llvm-svn: 240641

9 years ago[ORC] Add ObjectTransformLayer
Joseph Tremoulet [Thu, 25 Jun 2015 13:35:22 +0000 (13:35 +0000)]
[ORC] Add ObjectTransformLayer

Summary:
This is a utility for clients that want to insert a layer that modifies
each ObjectFile and then passes it along to the next layer.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

llvm-svn: 240640

9 years agoReplace copy-pasted debug value skipping with MBB::getLastNonDebugInstr
Benjamin Kramer [Thu, 25 Jun 2015 13:28:24 +0000 (13:28 +0000)]
Replace copy-pasted debug value skipping with MBB::getLastNonDebugInstr

No functional change intended.

llvm-svn: 240639

9 years agoEnable TestInferiorCrashing and TestRecursiveInferior on android
Pavel Labath [Thu, 25 Jun 2015 12:57:35 +0000 (12:57 +0000)]
Enable TestInferiorCrashing and TestRecursiveInferior on android

Summary:
the original bug was fixed (a rogue breakpoint messing up inferior data structures) and the tests
seems to pass now. Since android has a default SEGV handler, I have had to alter the test
expectation in this case.

Test Plan: Tests pass on android arm.

Reviewers: tberghammer

Subscribers: tberghammer, aemerson, lldb-commits

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

llvm-svn: 240638

9 years ago[mips] [IAS] Refactor the emitDirectiveModuleFP() functions. NFC.
Toma Tabacu [Thu, 25 Jun 2015 12:44:38 +0000 (12:44 +0000)]
[mips] [IAS] Refactor the emitDirectiveModuleFP() functions. NFC.

Summary:
Simplify emitDirectiveModuleFP() by having it just print the current information
from MipsABIFlagsSection and doing an updateABIInfo() before such calls.

This prevents us from forgetting to update the STI.FeatureBits,
because updateABIInfo() uses those to update the MipsABIFlagsSection object,
and also makes sure we use the update mechanism from MipsABIFlagsSection.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits, mpf

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

llvm-svn: 240637

9 years agoTake alignment into account in isSafeToLoadUnconditionally
Artur Pilipenko [Thu, 25 Jun 2015 12:18:43 +0000 (12:18 +0000)]
Take alignment into account in isSafeToLoadUnconditionally

Reviewed By: hfinkel

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

llvm-svn: 240636

9 years agoMake XFAIL on TestPrintStackTraces more specific
Pavel Labath [Thu, 25 Jun 2015 12:16:50 +0000 (12:16 +0000)]
Make XFAIL on TestPrintStackTraces more specific

the thread creation failure was fixed, but a backtracing problem remains in some situations.

llvm-svn: 240635

9 years ago[SystemZ] Only attempt RxSBG optimization for integer types
Ulrich Weigand [Thu, 25 Jun 2015 11:52:36 +0000 (11:52 +0000)]
[SystemZ] Only attempt RxSBG optimization for integer types

As pointed out by Justin Bogner (see r240520), SystemZDAGToDAGISel::Select
currently attempts to convert boolean operations into RxSBG even on some
non-integer types (in particular, vector types).  This would not work in
any case, and it happened to trigger undefined behaviour in allOnes.

This patch verifies that we have a (<= 64-bit) integer type before
attempting to perform this optimization.

llvm-svn: 240634

9 years agotsan: merge function definition and declaration
Dmitry Vyukov [Thu, 25 Jun 2015 11:45:45 +0000 (11:45 +0000)]
tsan: merge function definition and declaration

llvm-svn: 240633

9 years agoRemove XFAIL from TestCreateAfterAttach
Pavel Labath [Thu, 25 Jun 2015 11:29:26 +0000 (11:29 +0000)]
Remove XFAIL from TestCreateAfterAttach

The tested functionality is implemented now. The test remains XTIMEOUTed, because it times out
occasionally, probably due to test suite deficiencies.

llvm-svn: 240632

9 years agoExpand result with type char* to string in -data-evaluate-expression
Ilia K [Thu, 25 Jun 2015 11:10:12 +0000 (11:10 +0000)]
Expand result with type char* to string in -data-evaluate-expression

Summary:
Expand result with type char* to string in -data-evaluate-expression.
was:
  ```
    -data-evaluate-expression str
    ^done,value="0x00007fffffffece0"
  ```
now:
  ```
    -data-evaluate-expression str
    ^done,value="0x00007fffffffece0 \"hello\""
  ```

All tests pass on Linux.

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, dawn, abidh

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

llvm-svn: 240631

9 years ago[mips] [IAS] Refactor the emitDirectiveModuleOddSPReg() functions. NFC.
Toma Tabacu [Thu, 25 Jun 2015 10:56:57 +0000 (10:56 +0000)]
[mips] [IAS] Refactor the emitDirectiveModuleOddSPReg() functions. NFC.

Summary:
We can simplify emitDirectiveModuleOddSPReg() by having it print the current OddSPReg information
from MipsABIFlagsSection and doing an updateABIInfo() before such calls.

This prevents us from forgetting to update the STI.FeatureBits, because updateABIInfo() uses those to update the MipsABIFlagsSection object,
and also makes sure we use the update mechanism from MipsABIFlagsSection.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits, mpf

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

llvm-svn: 240630

9 years agoAdd missing <array> include.
Pawel Bylica [Thu, 25 Jun 2015 10:47:08 +0000 (10:47 +0000)]
Add missing <array> include.

llvm-svn: 240629

9 years agoTeach Clang about the PPC64 memory sanitizer implementation.
Jay Foad [Thu, 25 Jun 2015 10:35:19 +0000 (10:35 +0000)]
Teach Clang about the PPC64 memory sanitizer implementation.

Summary:
This is the Clang part of the PPC64 memory sanitizer implementation in
D10648.

Reviewers: kcc, eugenis, willschm, wschmidt, samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 240628

9 years agoTeach LLVM about the PPC64 memory sanitizer implementation.
Jay Foad [Thu, 25 Jun 2015 10:34:29 +0000 (10:34 +0000)]
Teach LLVM about the PPC64 memory sanitizer implementation.

Summary:
This is the LLVM part of the PPC memory sanitizer implementation in
D10648.

Reviewers: kcc, samsonov, willschm, wschmidt, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 240627

9 years agoExpress APInt::{s,u}{l,g}e(uint64_t) in terms of APInt::{s,u}{l,g}t(uint64_t). NFC.
Pawel Bylica [Thu, 25 Jun 2015 10:23:52 +0000 (10:23 +0000)]
Express APInt::{s,u}{l,g}e(uint64_t) in terms of APInt::{s,u}{l,g}t(uint64_t). NFC.

This is preparation for http://reviews.llvm.org/D10655: Change APInt comparison with uint64_t.
Some unit tests added also.

llvm-svn: 240626

9 years ago[mips] [IAS] Fix parsing of memory offset expressions with parenthesis depth >1.
Toma Tabacu [Thu, 25 Jun 2015 09:52:02 +0000 (09:52 +0000)]
[mips] [IAS] Fix parsing of memory offset expressions with parenthesis depth >1.

Summary:
In an expression such as "(((a+b)+c)+d)", parseParenExpression() would only parse the "a+b)+c", which would result in an error later on in the parser.
This means that we can only parse one level of inner parentheses.

In order to fix this, I added a new function called parseParenExprOfDepth(), which parses a specified number of trailing parenthesis expressions
(except for the outermost parenthesis), and changed MipsAsmParser to use it in parseMemOffset instead of parseParenExpression().

Reviewers: dsanders, rafael

Reviewed By: dsanders, rafael

Subscribers: llvm-commits

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

llvm-svn: 240625

9 years agoclang-format: [Proto] Don't treat "operator" as keyword.
Daniel Jasper [Thu, 25 Jun 2015 08:38:46 +0000 (08:38 +0000)]
clang-format: [Proto] Don't treat "operator" as keyword.

Before:
  optional string operator= 1;

After:
  optional string operator = 1;

llvm-svn: 240624

9 years agoEnable memory sanitizer for PPC64
Jay Foad [Thu, 25 Jun 2015 06:22:31 +0000 (06:22 +0000)]
Enable memory sanitizer for PPC64

Summary:
This patch adds basic memory sanitizer support for PPC64. PR23219.

I have further patches ready to enable it in LLVM and Clang, and to fix
most of the many failing tests in check-msan.

Reviewers: kcc, willschm, samsonov, wschmidt, eugenis

Reviewed By: eugenis

Subscribers: wschmidt, llvm-commits

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

llvm-svn: 240623

9 years agoCOFF: Fix a bug of __imp_ symbol.
Rui Ueyama [Thu, 25 Jun 2015 03:31:47 +0000 (03:31 +0000)]
COFF: Fix a bug of __imp_ symbol.

The change I made in r240620 was not correct. If a symbol foo is
defined, and if you use __imp_foo, __imp_foo symbol is automatically
defined as a pointer (not just an alias) to foo.

Now that we need to create a chunk for automatically-created symbols.
I defined LocalImportChunk class for them.

llvm-svn: 240622

9 years agoxcode project file updates for the movement of the POSIX files into the FreeBSD proce...
Jason Molenda [Thu, 25 Jun 2015 03:03:47 +0000 (03:03 +0000)]
xcode project file updates for the movement of the POSIX files into the FreeBSD process subdir.

llvm-svn: 240621

9 years agoCOFF: Handle undefined symbols starting with __imp_ in a special way.
Rui Ueyama [Thu, 25 Jun 2015 02:21:44 +0000 (02:21 +0000)]
COFF: Handle undefined symbols starting with __imp_ in a special way.

MSVC linker is able to link an object file created from the following code.
Note that __imp_hello is not defined anywhere.

  void hello() { printf("Hello\n"); }
  extern void (*__imp_hello)();
  int main() { __imp_hello(); }

Function symbols exported from DLLs are automatically mangled by appending
__imp_ prefix, so they have two names (original one and with the prefix).
This "feature" seems to simulate that behavior even for non-DLL symbols.

This is in my opnion very odd feature. Even MSVC linker warns if you use this.
I'm adding that anyway for the sake of compatibiltiy.

llvm-svn: 240620

9 years agoUpdate darwin SDK version parsing to support OSX and simulator
Steven Wu [Thu, 25 Jun 2015 01:59:35 +0000 (01:59 +0000)]
Update darwin SDK version parsing to support OSX and simulator

This re-commits r226005 with a tweak. The origin attempt failed because
Darwin bot sets up SDKROOT and clang can deduce SDK version from them
after this patch. That broke many driver tests due to the change of
deployment target version. Now the tests should not complain after
r240574.

llvm-svn: 240619

9 years ago[UBSan] Allow to use -fsanitize=vptr only on Mac OS 10.9+
Alexey Samsonov [Thu, 25 Jun 2015 00:58:02 +0000 (00:58 +0000)]
[UBSan] Allow to use -fsanitize=vptr only on Mac OS 10.9+

See https://llvm.org/bugs/show_bug.cgi?id=23539 for why this
is necessary.

llvm-svn: 240618

9 years ago[CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.
Alexey Samsonov [Thu, 25 Jun 2015 00:57:42 +0000 (00:57 +0000)]
[CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.

Summary:
This patch implements step 1 from
https://llvm.org/bugs/show_bug.cgi?id=23539#c10

I'd appreciate if you could test it on Mac OS and verify that parts of UBSan
runtime that reference C++ ABI symbols are properly excluded, and fix ASan/UBSan
builds.

Test Plan: regression test suite

Reviewers: thakis, hans

Subscribers: llvm-commits, zaks.anna, kubabrecka

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

llvm-svn: 240617

9 years ago[X86] Accept hasAVX512() as well as hasFMA() when generating FMA.
Ahmed Bougacha [Thu, 25 Jun 2015 00:44:46 +0000 (00:44 +0000)]
[X86] Accept hasAVX512() as well as hasFMA() when generating FMA.

We don't always have FMA, for example when using 'clang -mavx512f'
without an explicit CPU.

Also check for an explicit +avx512f instead of CPUs in a couple
related tests.

llvm-svn: 240616

9 years ago[X86] Cleanup fma tests a little bit. NFC.
Ahmed Bougacha [Thu, 25 Jun 2015 00:40:25 +0000 (00:40 +0000)]
[X86] Cleanup fma tests a little bit. NFC.

Reformat, isolate 213->231 xform, actually --check-prefix CHECK,
and deduplicate the FMA intrinsic tests (FMA3 in AMD-land).

llvm-svn: 240615

9 years agoCOFF: Use COFFObjectFile::getRelocations(). NFC.
Rui Ueyama [Thu, 25 Jun 2015 00:33:38 +0000 (00:33 +0000)]
COFF: Use COFFObjectFile::getRelocations(). NFC.

llvm-svn: 240614

9 years agoEnable StackMap Serialization for COFF
Swaroop Sridhar [Thu, 25 Jun 2015 00:28:42 +0000 (00:28 +0000)]
Enable StackMap Serialization for COFF

Summary

This change turns on the emission of
__LLVM_Stackmaps section when generating COFF binaries.

Test Plan

Added a scenario to the test case:
test\CodeGen\X86\statepoint-stackmap-format.ll.

Code Review:

http://reviews.llvm.org/D10680

llvm-svn: 240613

9 years agoConsolidate and unify initializer list deduction
Hubert Tong [Thu, 25 Jun 2015 00:25:49 +0000 (00:25 +0000)]
Consolidate and unify initializer list deduction

Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. This
extends the fix for PR12119 to also apply to the case where the
corresponding parameter is a trailing parameter pack.

Test Plan:
A test for deduction from nested initializer lists where the
corresponding parameter is a trailing parameter pack is added in
`clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp`.

Reviewers: fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 240612

9 years ago[Concepts] Parsing of requires-clause in template-declaration
Hubert Tong [Thu, 25 Jun 2015 00:23:39 +0000 (00:23 +0000)]
[Concepts] Parsing of requires-clause in template-declaration

Summary:
This change implements parse-only acceptance of the optional
requires-clause in a template-declaration. Diagnostic testing is added
for cases where the grammar is ambiguous with the expectation that the
longest token sequence which matches the syntax of a
constraint-expression is consumed without backtracking.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 240611

9 years agolibObject/COFF: Add a function to get pointers to relocation entries.
Rui Ueyama [Thu, 25 Jun 2015 00:07:39 +0000 (00:07 +0000)]
libObject/COFF: Add a function to get pointers to relocation entries.

llvm-svn: 240610

9 years agoAvoid C99 for-declaration statement in C files. (NFC)
Logan Chien [Thu, 25 Jun 2015 00:05:24 +0000 (00:05 +0000)]
Avoid C99 for-declaration statement in C files. (NFC)

To compile libunwind with gcc/g++ 4.9, it is required to avoid the
for-declaration statement from C99.

llvm-svn: 240609

9 years ago[ARM] The bits set in the variable HW_FP could get unset
Ranjeet Singh [Wed, 24 Jun 2015 23:39:25 +0000 (23:39 +0000)]
[ARM] The bits set in the variable HW_FP could get unset
when iterating through the Features vector if we don't
keep track of what's already been set. This could lead to
the macro __ARM_FP getting the wrong value. This patch
fixes this issue by keeping track of the bits that have
already been set in the loop.

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

llvm-svn: 240607

9 years agoHandle (or at least don't crash) trying to get the encoding for a bunch of new builti...
Enrico Granata [Wed, 24 Jun 2015 23:13:23 +0000 (23:13 +0000)]
Handle (or at least don't crash) trying to get the encoding for a bunch of new builtin types in clang trunk

llvm-svn: 240606

9 years agoCOFF: Cache raw pointers to relocation tables.
Rui Ueyama [Wed, 24 Jun 2015 23:03:17 +0000 (23:03 +0000)]
COFF: Cache raw pointers to relocation tables.

Getting an iterator to the relocation table is very hot operation
in the linker. We do that not only to apply relocations but also
to mark live sections and to do ICF.

libObject's interface is slow. By caching pointers to the first
relocation table entries makes the linker 6% faster to self-link.

We probably need to fix libObject as well.

llvm-svn: 240603

9 years agoupdate comment
Derek Schuff [Wed, 24 Jun 2015 22:36:38 +0000 (22:36 +0000)]
update comment

llvm-svn: 240601

9 years agoRelax assertion in x86_64 byval argument handling for 32-bit pointers
Derek Schuff [Wed, 24 Jun 2015 22:36:36 +0000 (22:36 +0000)]
Relax assertion in x86_64 byval argument handling for 32-bit pointers

Summary:
Byval argument pair formation assumes that if a type is less than 8 bytes
it must be an integer and not a pointer, which is not true for x32 and NaCl.

Relax the assertion and add a test for a codegen case that triggered it.

Reviewers: jvoung

Subscribers: jfb, cfe-commits

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

llvm-svn: 240600

9 years agoAdd simplify_type<const WeakVH>; simplify IndVarSimplify
Duncan P. N. Exon Smith [Wed, 24 Jun 2015 22:23:21 +0000 (22:23 +0000)]
Add simplify_type<const WeakVH>; simplify IndVarSimplify

r240214 fixed some UB in IndVarSimplify, and it needed a temporary
`WeakVH` to do it.  Add `simplify_type<const WeakVH>` so that this
temporary isn't necessary.

llvm-svn: 240599

9 years ago[X86] Simplify some stuff in X86DisassemblerDecoder. NFC
Douglas Katzman [Wed, 24 Jun 2015 22:04:55 +0000 (22:04 +0000)]
[X86] Simplify some stuff in X86DisassemblerDecoder. NFC

- Deciding that insn->sibIndex is SIB_INDEX_NONE does not require another
check beyond the fully decoded bits being equal to 0x4.
The expression insn->sibIndex == SIB_INDEX_sib could not have been true unless
index were 0x4, because SIB_INDEX_sib is merely the range base (SIB_INDEX_EAX)
plus 4. Respectively SIB_INDEX_sib64.

- Don't use a switch statement to perform left-shift.

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

llvm-svn: 240598

9 years agoAdd __nonnull/__nullable/__null_unspecified predefines for Darwin.
Douglas Gregor [Wed, 24 Jun 2015 22:02:16 +0000 (22:02 +0000)]
Add __nonnull/__nullable/__null_unspecified predefines for Darwin.

Addresses the rest of rdar://problem/21530726.

llvm-svn: 240597

9 years agoReplace __double_underscored type nullability qualifiers with _Uppercase_underscored
Douglas Gregor [Wed, 24 Jun 2015 22:02:08 +0000 (22:02 +0000)]
Replace __double_underscored type nullability qualifiers with _Uppercase_underscored

Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:

  __nonnull -> _Nonnull
  __nullable -> _Nullable
  __null_unspecified -> _Null_unspecified

This is the major part of rdar://problem/21530726, but does not yet
provide the Darwin-specific behavior for the old names.

llvm-svn: 240596

9 years ago[GVN] Intersect the IR flags when CSE'ing two instructions
David Majnemer [Wed, 24 Jun 2015 21:52:25 +0000 (21:52 +0000)]
[GVN] Intersect the IR flags when CSE'ing two instructions

We performed a simple, but incomplete, intersection when it came time to
CSE instructions.  It didn't handle, for example, the 'exact' flag.

This fixes PR23922.

llvm-svn: 240595

9 years agoSpelling fixes in comments.
Douglas Katzman [Wed, 24 Jun 2015 21:46:53 +0000 (21:46 +0000)]
Spelling fixes in comments.

llvm-svn: 240594

9 years ago[Reassociate] Don't propogate flags when creating negations
David Majnemer [Wed, 24 Jun 2015 21:27:36 +0000 (21:27 +0000)]
[Reassociate] Don't propogate flags when creating negations

Reassociate mutated existing instructions in order to form negations
which would create additional reassociate opportunities.

This fixes PR23926.

llvm-svn: 240593

9 years agofix typos; NFC
Sanjay Patel [Wed, 24 Jun 2015 20:42:33 +0000 (20:42 +0000)]
fix typos; NFC

llvm-svn: 240592

9 years agodon't repeat function names in comments; NFC
Sanjay Patel [Wed, 24 Jun 2015 20:40:57 +0000 (20:40 +0000)]
don't repeat function names in comments; NFC

llvm-svn: 240591

9 years agoCOFF: Move code for ICF from Writer.cpp to ICF.cpp.
Rui Ueyama [Wed, 24 Jun 2015 20:40:03 +0000 (20:40 +0000)]
COFF: Move code for ICF from Writer.cpp to ICF.cpp.

llvm-svn: 240590

9 years ago[If Converter] Convert recursion to iteration.
Akira Hatanaka [Wed, 24 Jun 2015 20:34:35 +0000 (20:34 +0000)]
[If Converter] Convert recursion to iteration.

This commit makes changes to IfConverter::AnalyzeBlock to use iteration instead
of recursion. Previously, this function would get called recursively a large
number of times and eventually segfault when a function with the following CFG
was compiled:

BB0:
 if (condition0)
  goto BB1
 goto BB2
BB1:
 goto BB2
BB2:
 if (condition1)
  goto BB3
 goto BB4
BB3:
...
(repeat until BB7488)

rdar://problem/21386145

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

llvm-svn: 240589

9 years agoDevirtualize Instruction::clone_impl
Pete Cooper [Wed, 24 Jun 2015 20:22:23 +0000 (20:22 +0000)]
Devirtualize Instruction::clone_impl

llvm-svn: 240588

9 years agoAdd NVPTXPeephole pass to reduce unnecessary address cast
Jingyue Wu [Wed, 24 Jun 2015 20:20:16 +0000 (20:20 +0000)]
Add NVPTXPeephole pass to reduce unnecessary address cast

Summary:
This patch first change the register that holds local address for stack
frame to %SPL. Then the new NVPTXPeephole pass will try to scan the
following pattern

   %vreg0<def> = LEA_ADDRi64 <fi#0>, 4
   %vreg1<def> = cvta_to_local %vreg0

and transform it into

   %vreg1<def> = LEA_ADDRi64 %VRFrameLocal, 4

Patched by Xuetian Weng

Test Plan: test/CodeGen/NVPTX/local-stack-frame.ll

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: eliben, jholewinski, llvm-commits

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

llvm-svn: 240587

9 years agoOne more change required to build the sanitizers for iOS.
Chris Bieneman [Wed, 24 Jun 2015 20:13:44 +0000 (20:13 +0000)]
One more change required to build the sanitizers for iOS.

Summary: _Unwind_Backtrace is not available on iOS, so we should ifdef out the posix implementations of BufferedStackTrace::SlowUnwindStack and BufferedStackTrace::SlowUnwindStackWithContext on iOS.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 240586

9 years agofix typos; NFC
Sanjay Patel [Wed, 24 Jun 2015 20:07:50 +0000 (20:07 +0000)]
fix typos; NFC

llvm-svn: 240585

9 years agoRevert "(HEAD -> master, origin/master, origin/HEAD) opt: Add option to strip or...
Matthias Braun [Wed, 24 Jun 2015 20:04:26 +0000 (20:04 +0000)]
Revert "(HEAD -> master, origin/master, origin/HEAD) opt: Add option to strip or add llvm value names"

Accidental commit

This reverts commit r240583.

llvm-svn: 240584

9 years agoopt: Add option to strip or add llvm value names
Matthias Braun [Wed, 24 Jun 2015 20:03:33 +0000 (20:03 +0000)]
opt: Add option to strip or add llvm value names

llvm-svn: 240583

9 years agoARMLoadStoreOptimizer: Fix errata 602117 handling and make testcase actually test...
Matthias Braun [Wed, 24 Jun 2015 20:03:27 +0000 (20:03 +0000)]
ARMLoadStoreOptimizer: Fix errata 602117 handling and make testcase actually test for it

This fixes PR23912

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

llvm-svn: 240582

9 years agoReduce FreeBSD log spam
Ed Maste [Wed, 24 Jun 2015 20:02:56 +0000 (20:02 +0000)]
Reduce FreeBSD log spam

The values of four important registers are included in logs for ptrace
PT_GETREGS. Put all four on the same line for a more compact log. Also
use the proper 64-bit register names.

llvm-svn: 240581

9 years agoMake computeSymbolSizes never fail.
Rafael Espindola [Wed, 24 Jun 2015 19:57:32 +0000 (19:57 +0000)]
Make computeSymbolSizes never fail.

On ELF that was already the case since getting the size of a symbol
never fails.

On MachO and COFF we could fail trying to get the section of a symbol. But
we don't really need the section, just the section number to know if two
symbols are in the same section or not.

llvm-svn: 240580

9 years agoMIR Serialization: Serialize simple MachineRegisterInfo attributes.
Alex Lorenz [Wed, 24 Jun 2015 19:56:10 +0000 (19:56 +0000)]
MIR Serialization: Serialize simple MachineRegisterInfo attributes.

This commit serializes the 3 scalar boolean attributes from the
MachineRegisterInfo class: IsSSA, TracksRegLiveness, and
TracksSubRegLiveness. These attributes are serialized as part
of the machine function YAML mapping.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 240579

9 years agoFix an issue where an SBValue could end up capturing a synthetic value and would...
Enrico Granata [Wed, 24 Jun 2015 19:53:22 +0000 (19:53 +0000)]
Fix an issue where an SBValue could end up capturing a synthetic value and would then be unable to return the non-synthetic version thereof

This patch makes the backing ValueImpl always store the root-most value no matter the "flavor" that is initially passed into it

llvm-svn: 240578

9 years agotsan: fix false positive between dlopen and dl_iterate_phdr
Dmitry Vyukov [Wed, 24 Jun 2015 19:49:32 +0000 (19:49 +0000)]
tsan: fix false positive between dlopen and dl_iterate_phdr

We see false reports between dlopen and dl_iterate_phdr.
This happens because tsan does not see dynamic linker
internal synchronization. Unpoison module names
in dl_iterate_phdr callback.

llvm-svn: 240576

9 years agoUse Symbol::getValue to simplify object::computeSymbolSizes. NFC.
Rafael Espindola [Wed, 24 Jun 2015 19:32:52 +0000 (19:32 +0000)]
Use Symbol::getValue to simplify object::computeSymbolSizes. NFC.

llvm-svn: 240575

9 years agoRemove environment variables from driver tests
Steven Wu [Wed, 24 Jun 2015 19:30:36 +0000 (19:30 +0000)]
Remove environment variables from driver tests

Summary:
Remove some of dangerous environmental variables from clang/Driver tests.
Driver tests should not rely on preset value of these variables and may
actually fail because of them.
They cannot be removed in test/lit.cfg because we still need to support
relocatable SDKs and other overwrite for other clang tests.

Reviewers: bogner

Subscribers: rnk, cfe-commits

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

llvm-svn: 240574

9 years ago[LSR] canonicalize Prod*(1<<C) to Prod<<C
Jingyue Wu [Wed, 24 Jun 2015 19:28:40 +0000 (19:28 +0000)]
[LSR] canonicalize Prod*(1<<C) to Prod<<C

Summary:
Because LSR happens at a late stage where mul of a power of 2 is
typically canonicalized to shl, this canonicalization emits code that
can be better CSE'ed.

Test Plan:
Transforms/LoopStrengthReduce/shl.ll shows how this change makes GVN more
powerful. Fixes some existing tests due to this change.

Reviewers: sanjoy, majnemer, atrick

Reviewed By: majnemer, atrick

Subscribers: majnemer, llvm-commits

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

llvm-svn: 240573

9 years agoUse Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.
Rafael Espindola [Wed, 24 Jun 2015 19:27:53 +0000 (19:27 +0000)]
Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.

llvm-svn: 240572

9 years ago[Preprocessor] Iterating over all macros should include those from modules.
Jordan Rose [Wed, 24 Jun 2015 19:27:02 +0000 (19:27 +0000)]
[Preprocessor] Iterating over all macros should include those from modules.

So, iterate over the list of macros mentioned in modules, and make sure those
are in the master table.

This isn't particularly efficient, but hopefully it's something that isn't
done too often.

PR23929 and rdar://problem/21480635

llvm-svn: 240571

9 years ago[ELF] Fix .init_array initialization
Adhemerval Zanella [Wed, 24 Jun 2015 19:26:00 +0000 (19:26 +0000)]
[ELF] Fix .init_array initialization

Some compilers may not add the section symbol in '.symtab' for the
.init_array and 'ldd' just ignore it.  It results in global constructor
not being called in final executable.

This patch add both '.init_array' and '.fini_array' to be added in
Atom graph generation even when the section contains no symbol.  An
already existing testcase is modified to check for such scenario.

The issue fixes the llvm test-suite regressions for both Single
and MultiSource files.

llvm-svn: 240570

9 years agoAdd a SymbolRef::getValue.
Rafael Espindola [Wed, 24 Jun 2015 19:11:10 +0000 (19:11 +0000)]
Add a SymbolRef::getValue.

This returns either the symbol offset or address. Since it is not defined which
one, it never has to lookup the section and so never fails.

I will add users in the next commit.

llvm-svn: 240569

9 years agoDevirtualize Constant::replaceUsesOfWithOnConstant.
Pete Cooper [Wed, 24 Jun 2015 18:55:24 +0000 (18:55 +0000)]
Devirtualize Constant::replaceUsesOfWithOnConstant.

This is part of the work to devirtualize Value.

The old pattern was to call replaceUsesOfWithOnConstant which was overridden by
subclasses.  Those could then call replaceUsesOfWithOnConstantImpl on Constant
to handle deleting the current value.

To be consistent with other parts of the code, this has been changed so that we
call the method on Constant, and that dispatches to an Impl on subclasses.

As part of this, it made sense to rename the methods to be more descriptive.  The
new name is Constant::handleOperandChange, and it requires that all subclasses of
Constant implement handleOperandChangeImpl, even if they just throw an error if
they shouldn't be called.

Reviewed by Duncan Exon Smith.

llvm-svn: 240567

9 years agoAsmPrinter: Cleanup DIEValue::EmitValue() API, NFC
Duncan P. N. Exon Smith [Wed, 24 Jun 2015 18:48:11 +0000 (18:48 +0000)]
AsmPrinter: Cleanup DIEValue::EmitValue() API, NFC

Stop taking a `dwarf::Form` in `DIEValue::EmitValue()` and
`DIEValue::SizeOf()`, since they're always passed `DIEValue::getForm()`
anyway.  This is just left over from when `DIEValue` didn't know its own
form.

llvm-svn: 240566

9 years agoRevert rL240435: "Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.".
Oleksiy Vyalov [Wed, 24 Jun 2015 18:35:36 +0000 (18:35 +0000)]
Revert rL240435: "Mark SBFrame::GetFunctionName and SBFrame::IsInlined as const.".

llvm-svn: 240565

9 years agoSafeStack: Add another missing header to try to fix FreeBSD build.
Peter Collingbourne [Wed, 24 Jun 2015 18:16:05 +0000 (18:16 +0000)]
SafeStack: Add another missing header to try to fix FreeBSD build.

llvm-svn: 240564

9 years agoRefactor duplicated code. NFC.
Rafael Espindola [Wed, 24 Jun 2015 18:14:41 +0000 (18:14 +0000)]
Refactor duplicated code. NFC.

llvm-svn: 240563

9 years agoObject: Add XFAILed test case for r239560.
Peter Collingbourne [Wed, 24 Jun 2015 18:03:39 +0000 (18:03 +0000)]
Object: Add XFAILed test case for r239560.

We ought to also emit unmangled references to dllimported functions,
but no existing linker needs this.

llvm-svn: 240562