platform/upstream/llvm.git
9 years agoAdd support for the convergent flag at the MC and MachineInstr levels.
Owen Anderson [Thu, 28 May 2015 18:33:39 +0000 (18:33 +0000)]
Add support for the convergent flag at the MC and MachineInstr levels.

llvm-svn: 238450

9 years agoReuse Loc variable. NFC.
Chad Rosier [Thu, 28 May 2015 18:18:21 +0000 (18:18 +0000)]
Reuse Loc variable. NFC.

llvm-svn: 238448

9 years agoAsmPrinter: Suppress warnings on GCC from r238362, NFC
Duncan P. N. Exon Smith [Thu, 28 May 2015 18:09:13 +0000 (18:09 +0000)]
AsmPrinter: Suppress warnings on GCC from r238362, NFC

GCC seems to have some overzealous warnings about strict aliasing.
Rafael reports that this patch suppresses them on GCC 4.9, and I'm
hoping this will work for GCC 4.7 as well.  I'll watch [1] and iterate
if necessary.

[1]: http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/8597

llvm-svn: 238447

9 years agoUse range loops for accessing file names. NFC.
Rafael Espindola [Thu, 28 May 2015 18:03:20 +0000 (18:03 +0000)]
Use range loops for accessing file names. NFC.

llvm-svn: 238446

9 years agoExpand the Flags field of MCInstrDesc to 64 bits, while simultaneously
Owen Anderson [Thu, 28 May 2015 18:03:07 +0000 (18:03 +0000)]
Expand the Flags field of MCInstrDesc to 64 bits, while simultaneously
shrinking the Size and NumDefs fields to offset the size growth, and
reordering the fields to preserve a good packing.

This is necessary in the short term for adding a convergent flag, and
simultaneously future-proofs us against more flags being added in the
future.

llvm-svn: 238445

9 years agoMerge computeSymbolTable and writeSymbolTable.
Rafael Espindola [Thu, 28 May 2015 17:54:01 +0000 (17:54 +0000)]
Merge computeSymbolTable and writeSymbolTable.

For now this just saves a few loops, but it will allow more simplifications
in the future.

llvm-svn: 238444

9 years agoGet the dll storage class right for structors of classes exported/imported via explic...
Hans Wennborg [Thu, 28 May 2015 17:44:56 +0000 (17:44 +0000)]
Get the dll storage class right for structors of classes exported/imported via explicit instantiation (PR23667)

This is a follow-up to r238266. It turned out structors are codegened through a different path,
and didn't get the storage class set in EmitGlobalFunctionDefinition.

llvm-svn: 238443

9 years agoRefactor AdbClient and make PlatformAndroid::GetFile to use "adb pull".
Oleksiy Vyalov [Thu, 28 May 2015 17:42:48 +0000 (17:42 +0000)]
Refactor AdbClient and make PlatformAndroid::GetFile to use "adb pull".

http://reviews.llvm.org/D10082

llvm-svn: 238442

9 years agoAdd explicit dependency on headers to swig wrapper (cmake build)
Ed Maste [Thu, 28 May 2015 17:25:34 +0000 (17:25 +0000)]
Add explicit dependency on headers to swig wrapper (cmake build)

This should avoid issues like that described in llvm.org/pr23686

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

llvm-svn: 238441

9 years agoMake FileSpec::Dump use FileSpec::GetPath(), not the other way around.
Chaoren Lin [Thu, 28 May 2015 17:02:45 +0000 (17:02 +0000)]
Make FileSpec::Dump use FileSpec::GetPath(), not the other way around.

Summary:
Fix FileSpec::Dump() to output denormalized path.

See D9942 for previous discussions.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 238440

9 years ago[mips] Add new format for dmtc2/dmfc2 for Octeon CPUs.
Kai Nacke [Thu, 28 May 2015 16:23:16 +0000 (16:23 +0000)]
[mips] Add new format for dmtc2/dmfc2 for Octeon CPUs.

Octeon CPUs use dmtc2 rt,imm16 and dmfcp2 rt,imm16 for the crypto coprocessor.
E.g. dmtc2 rt,0x4057 starts calculation of sha-1.

I had to introduce a new deconding namespace to avoid a decoding conflict.

Reviewed By: dsanders

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

llvm-svn: 238439

9 years agoAdd a comment explaining the eCommandRequiresTarget test
Ed Maste [Thu, 28 May 2015 16:06:48 +0000 (16:06 +0000)]
Add a comment explaining the eCommandRequiresTarget test

llvm.org/pr23686

llvm-svn: 238438

9 years agoRevert r238425, it undoes the purpose of the test
Ed Maste [Thu, 28 May 2015 15:58:10 +0000 (15:58 +0000)]
Revert r238425, it undoes the purpose of the test

llvm.org/pr23686

llvm-svn: 238437

9 years ago[ARM] Be less specific about the error message expected.
Ranjeet Singh [Thu, 28 May 2015 15:55:34 +0000 (15:55 +0000)]
[ARM] Be less specific about the error message expected.

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

llvm-svn: 238436

9 years ago[ARMTargetParser] FIXME MachO arch names. NFC
Renato Golin [Thu, 28 May 2015 15:49:28 +0000 (15:49 +0000)]
[ARMTargetParser] FIXME MachO arch names. NFC

llvm-svn: 238435

9 years agoDebugInfo: .debug_line DWARF64 support
Ed Maste [Thu, 28 May 2015 15:38:17 +0000 (15:38 +0000)]
DebugInfo: .debug_line DWARF64 support

This adds support for the 64-bit DWARF format, but is still limited to
less than 4GB of debug data by the DataExtractor class.  Some versions
of the GNU MIPS toolchain generate 64-Bit DWARF even though it isn't
actually necessary.

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

llvm-svn: 238434

9 years agoFix THUMB function detection when function name is not prefixed.
Aidan Dodds [Thu, 28 May 2015 15:37:01 +0000 (15:37 +0000)]
Fix THUMB function detection when function name is not prefixed.

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

llvm-svn: 238433

9 years agoDon't create an unused _GLOBAL_OFFSET_TABLE_.
Rafael Espindola [Thu, 28 May 2015 15:20:00 +0000 (15:20 +0000)]
Don't create an unused _GLOBAL_OFFSET_TABLE_.

This was a bug for bug compatibility with gas that is completely unnecessary.
If a _GLOBAL_OFFSET_TABLE_ symbol is used, it will already be created by
the time we get to the ELF writer.

llvm-svn: 238432

9 years agoFix write register context in EmulateInstructionARM::EmulateMOVRdRm
Tamas Berghammer [Thu, 28 May 2015 15:09:45 +0000 (15:09 +0000)]
Fix write register context in EmulateInstructionARM::EmulateMOVRdRm

llvm-svn: 238431

9 years ago[ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFC
Renato Golin [Thu, 28 May 2015 15:05:53 +0000 (15:05 +0000)]
[ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFC

llvm-svn: 238430

9 years ago[ARMTargetParser] Adding sub-arch information for Clang. NFC
Renato Golin [Thu, 28 May 2015 15:05:18 +0000 (15:05 +0000)]
[ARMTargetParser] Adding sub-arch information for Clang. NFC

llvm-svn: 238429

9 years agoUse /usr/bin/env to find python
Ed Maste [Thu, 28 May 2015 14:53:14 +0000 (14:53 +0000)]
Use /usr/bin/env to find python

Python may not be /usr/bin/python on some systems. For example, on
FreeBSD it will be /usr/local/bin/python.

Reviewers: samsonov
Differential Revision: http://reviews.llvm.org/D9914

llvm-svn: 238428

9 years ago[mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.
Daniel Sanders [Thu, 28 May 2015 14:52:15 +0000 (14:52 +0000)]
[mips] Make TTypeEncoding indirect to allow .eh_frame to be read-only.

Summary:
Following on from r209907 which made personality encodings indirect, do the
same for TType encodings. This fixes the case where a try/catch block needs
to generate references to, for example, std::exception in the
.gcc_except_table.

Reviewers: petarj

Reviewed By: petarj

Subscribers: srhines, joerg, tberghammer, llvm-commits

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

llvm-svn: 238427

9 years ago[ASan] Disable alloca tests on ARM targets due to flakiness.
Yury Gribov [Thu, 28 May 2015 14:29:12 +0000 (14:29 +0000)]
[ASan] Disable alloca tests on ARM targets due to flakiness.

llvm-svn: 238426

9 years agoFix TestCommandScript: return an error if target executable is not set
Ed Maste [Thu, 28 May 2015 14:22:57 +0000 (14:22 +0000)]
Fix TestCommandScript: return an error if target executable is not set

The test invokes the 'targetname' test command before setting a
target executable, which caused Python to raise TypeError: cannot
concatenate 'str' and 'NoneType' objects.

llvm.org/pr23686

llvm-svn: 238425

9 years ago[Mips64] Add support for MCJIT for MIPS64r2 and MIPS64r6
Petar Jovanovic [Thu, 28 May 2015 13:48:41 +0000 (13:48 +0000)]
[Mips64] Add support for MCJIT for MIPS64r2 and MIPS64r6

Add support for resolving MIPS64r2 and MIPS64r6 relocations in MCJIT.

Patch by Vladimir Radosavljevic.

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

llvm-svn: 238424

9 years agoFix race in IOHandlerProcessSTDIO
Pavel Labath [Thu, 28 May 2015 13:41:08 +0000 (13:41 +0000)]
Fix race in IOHandlerProcessSTDIO

Summary:
IOHandlerProcessSTDIO::Run() was opening the pipe for interrupt requests lazily. This was racing
with another thread executing IOHandlerProcessSTDIO::Cancel() simultaneously. I fix this by
opening the pipe in the object constructor. The pipe will be automatically closed when the object
is destroyed.

Test Plan: Tests pass on linux.

Reviewers: clayborg, ribrdb

Subscribers: lldb-commits

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

llvm-svn: 238423

9 years agoUpdate isl to 93b8e43d
Tobias Grosser [Thu, 28 May 2015 13:32:11 +0000 (13:32 +0000)]
Update isl to 93b8e43d

This update brings mostly interface cleanups, but also fixes two bugs in
imath (a memory leak, some undefined behavior).

llvm-svn: 238422

9 years agoCleanup the forked child in TestChangeProcessGroup
Pavel Labath [Thu, 28 May 2015 13:12:48 +0000 (13:12 +0000)]
Cleanup the forked child in TestChangeProcessGroup

if the test fails for some reason, we can end up leaking a process. This has a tendency to
confuse the buildbots. I have added a cleanup hook to make sure we cleanup the child.

llvm-svn: 238421

9 years agoAdd thumb breakpoint for FreeBSD (currently disabled)
Ed Maste [Thu, 28 May 2015 13:06:09 +0000 (13:06 +0000)]
Add thumb breakpoint for FreeBSD (currently disabled)

Patch by Tom Rix, with additional changes to sync whitespace/style with
PlatformLinux.cpp.

It is currently disabled pending kernel support.

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

llvm-svn: 238420

9 years agoSilencing two signed/unsigned mismatch warnings; NFC.
Aaron Ballman [Thu, 28 May 2015 12:55:59 +0000 (12:55 +0000)]
Silencing two signed/unsigned mismatch warnings; NFC.

llvm-svn: 238419

9 years ago[AsmPrinter] Destroy allocated DIEAbbrevs on teardown.
Benjamin Kramer [Thu, 28 May 2015 12:55:43 +0000 (12:55 +0000)]
[AsmPrinter] Destroy allocated DIEAbbrevs on teardown.

DIEAbbrev contains a SmallVector that can leak for overly large abbrevs. They
used to be owned by the DIE, but after the recent refactoring DWARFFile
allocates its own abbrevs.

Leak found by asan.

llvm-svn: 238418

9 years agoDon't check breakpoint location count in TestChangeProcessGroup
Pavel Labath [Thu, 28 May 2015 12:46:13 +0000 (12:46 +0000)]
Don't check breakpoint location count in TestChangeProcessGroup

apparently, we get two locations for the breakpoint on android.

llvm-svn: 238417

9 years ago[ARMTargetParser] Removing string parsing from getCPUDefineSuffix. NFC.
Renato Golin [Thu, 28 May 2015 12:11:11 +0000 (12:11 +0000)]
[ARMTargetParser] Removing string parsing from getCPUDefineSuffix. NFC.

Yet another FIXME from ARMTargetParser.

llvm-svn: 238416

9 years ago[ARMTargetParser] Adding a few more CPUs for Clang CPU detection. NFC.
Renato Golin [Thu, 28 May 2015 12:10:37 +0000 (12:10 +0000)]
[ARMTargetParser] Adding a few more CPUs for Clang CPU detection. NFC.

llvm-svn: 238415

9 years ago[MC] Replace custom string join function with the one from StringExtras.
Benjamin Kramer [Thu, 28 May 2015 11:45:32 +0000 (11:45 +0000)]
[MC] Replace custom string join function with the one from StringExtras.

NFC.

llvm-svn: 238414

9 years agoFix PPC failure. Adjust CHECK pattern.
Diego Novillo [Thu, 28 May 2015 11:25:52 +0000 (11:25 +0000)]
Fix PPC failure. Adjust CHECK pattern.

llvm-svn: 238413

9 years agoDon't call utostr in Twine/raw_ostream contexts.
Benjamin Kramer [Thu, 28 May 2015 11:24:24 +0000 (11:24 +0000)]
Don't call utostr in Twine/raw_ostream contexts.

Creating temporary std::strings there is unnecessary.

llvm-svn: 238412

9 years agoFix breakpoint setting in gdb remote test cases on arm
Tamas Berghammer [Thu, 28 May 2015 10:55:01 +0000 (10:55 +0000)]
Fix breakpoint setting in gdb remote test cases on arm

llvm-svn: 238411

9 years agoFix write register context in EmulateInstructionARM::EmulateADDRdSPImm
Tamas Berghammer [Thu, 28 May 2015 10:38:32 +0000 (10:38 +0000)]
Fix write register context in EmulateInstructionARM::EmulateADDRdSPImm

llvm-svn: 238410

9 years ago[ASan] XFAIL VLA tests on ARM and PowerPC. Patch by Max Ostapenko!
Yury Gribov [Thu, 28 May 2015 10:30:46 +0000 (10:30 +0000)]
[ASan] XFAIL VLA tests on ARM and PowerPC. Patch by Max Ostapenko!

llvm-svn: 238409

9 years agoMove prctl call in TestChangeProcessGroup to the child
Pavel Labath [Thu, 28 May 2015 10:28:34 +0000 (10:28 +0000)]
Move prctl call in TestChangeProcessGroup to the child

I was hoping the enable-tracing flag will be inherited from the parent. It is not.

llvm-svn: 238408

9 years ago[ASan] Add new interceptors to asan_win_dll_thunk.cc to fix build errors on Windows.
Yury Gribov [Thu, 28 May 2015 10:21:59 +0000 (10:21 +0000)]
[ASan] Add new interceptors to asan_win_dll_thunk.cc to fix build errors on Windows.
Patch by Maria Guseva!

llvm-svn: 238407

9 years ago[sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, strpbrk.
Yury Gribov [Thu, 28 May 2015 09:24:33 +0000 (09:24 +0000)]
[sanitizer] More string interceptors: strstr, strcasestr, strspn, strcspn, strpbrk.
Patch by Maria Guseva.

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

llvm-svn: 238406

9 years ago[NativeProcessLinux] Support inferiors which change their process group
Pavel Labath [Thu, 28 May 2015 08:59:21 +0000 (08:59 +0000)]
[NativeProcessLinux] Support inferiors which change their process group

Summary:
Previously, we wait()ed for events from the inferiors process group. This is resulted in a
failure if the inferior changed its process group in the middle of execution. To avoid this, I
pass -1 to the wait() call. The flag __WNOTHREAD makes sure we don't actually wait for events
from any process, but only the processes(threads) which are our children (or traced by us). Since
this happens on the monitor thread, which is dedicated to monitoring a single inferior, we will
be getting events only from this inferior.

Test Plan: All tests pass on linux. I have added a test to check the new functionality.

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 238405

9 years agoFix comments in ARMTargetParser. NFC.
Renato Golin [Thu, 28 May 2015 08:59:03 +0000 (08:59 +0000)]
Fix comments in ARMTargetParser. NFC.

llvm-svn: 238404

9 years ago[ASan] Fix previous commit. Patch by Max Ostapenko!
Yury Gribov [Thu, 28 May 2015 08:03:28 +0000 (08:03 +0000)]
[ASan] Fix previous commit. Patch by Max Ostapenko!

llvm-svn: 238403

9 years ago[ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!
Yury Gribov [Thu, 28 May 2015 07:51:49 +0000 (07:51 +0000)]
[ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!

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

llvm-svn: 238402

9 years ago[ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!
Yury Gribov [Thu, 28 May 2015 07:49:05 +0000 (07:49 +0000)]
[ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!

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

llvm-svn: 238401

9 years agoclang-format: Lower binding strengths created by the [] created by ObjC
Daniel Jasper [Thu, 28 May 2015 07:21:50 +0000 (07:21 +0000)]
clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.

Specific test case in JavaScript:
Before:
  var aaaaa: List<
      SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

After:
  var aaaaa: List<SomeThing> = [
    new SomeThingAAAAAAAAAAAA(),
    new SomeThingBBBBBBBBB()
  ];

llvm-svn: 238400

9 years ago[TableGen] Use DefInit::getAsString instead of getDef()->getName(). NFC
Craig Topper [Thu, 28 May 2015 06:38:32 +0000 (06:38 +0000)]
[TableGen] Use DefInit::getAsString instead of getDef()->getName(). NFC

llvm-svn: 238399

9 years ago[TableGen] Don't convert types to strings to query what they are. Just use 'isa'
Craig Topper [Thu, 28 May 2015 06:38:28 +0000 (06:38 +0000)]
[TableGen] Don't convert types to strings to query what they are. Just use 'isa'

llvm-svn: 238398

9 years ago[Reassociate] Canonicalizing 'x [+-] (-Constant * y)' isn't always a win
David Majnemer [Thu, 28 May 2015 06:16:39 +0000 (06:16 +0000)]
[Reassociate] Canonicalizing 'x [+-] (-Constant * y)' isn't always a win

Canonicalizing 'x [+-] (-Constant * y)' is not a win if we don't *know*
we will open up CSE opportunities.

If the multiply was 'nsw', then negating 'y' requires us to clear the
'nsw' flag.  If this is actually worth pursuing, it is probably more
appropriate to do so in GVN or EarlyCSE.

This fixes PR23675.

llvm-svn: 238397

9 years ago[NaryReassociate] Run EarlyCSE after NaryReassociate
Jingyue Wu [Thu, 28 May 2015 04:56:52 +0000 (04:56 +0000)]
[NaryReassociate] Run EarlyCSE after NaryReassociate

Summary:
This patch made two improvements to NaryReassociate and the NVPTX pipeline

1. Run EarlyCSE/GVN after NaryReassociate to get rid of redundant common
expressions.

2. When adding an instruction to SeenExprs, maps both the SCEV before and after
reassociation to that instruction.

Test Plan: updated @reassociate_gep_nsw in nary-gep.ll

Reviewers: meheff, broune

Reviewed By: broune

Subscribers: dberlin, jholewinski, llvm-commits

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

llvm-svn: 238396

9 years agoAdd quick bit of doc about SBFrame::GetCFA().
Jason Molenda [Thu, 28 May 2015 04:55:53 +0000 (04:55 +0000)]
Add quick bit of doc about SBFrame::GetCFA().

llvm-svn: 238395

9 years ago[Basic] Define __declspec for cygwin
David Majnemer [Thu, 28 May 2015 04:36:18 +0000 (04:36 +0000)]
[Basic] Define __declspec for cygwin

Cygwin (and MinGW) targets define __declspec to __attribute__ unless
-fms-extensions is specified.  It turns out that cygwin headers rely on
the existence of this macro.

llvm-svn: 238394

9 years agoAdded a new API to SBFrame:
Greg Clayton [Thu, 28 May 2015 03:27:22 +0000 (03:27 +0000)]
Added a new API to SBFrame:

lldb::addr_t SBFrame::GetCFA();

This gets the CFA (call frame address) of the frame so it allows us to take an address that is on the stack and figure out which thread it comes from.

Also modified the heap.py module to be able to find out which variable in a frame's stack frame contains an address. This way when ptr_refs finds a match on the stack, it get then report which variable contains the pointer.

llvm-svn: 238393

9 years agoI finally found the strong reference that was keeping all lldb_private::Process insta...
Greg Clayton [Thu, 28 May 2015 03:24:30 +0000 (03:24 +0000)]
I finally found the strong reference that was keeping all lldb_private::Process instances from ever destroying themselves: ProcessModID.m_mod_id was holding onto the last stop event with ProcessModID::SetStopEventForLastNaturalStopID(EventSP). This is a bad idea because ProcessEventData contains a strong refereence to the process. This is now fixed by calling ProcessModID::SetStopEventForLastNaturalStopID(EventSP()) to clear this event in Process::SetExitStatus() and in Process::Finalize().

This was the original cause of the file descriptor leaks that would cause the test suite to die after running a few hundred processes since no process would ever get destroyed and the communication channel in ProcessGDBRemote and the ProcessIOHandler would never close their pipes.

This process leak was previously worked around by closing the pipes when the communication channel was disconnected.

This was found by using "ptr_refs" from the heap.py in the lldb.macosx.heap module. It was able to find all strong references to the Process and helped me to figure out who was holding this extra reference.

llvm-svn: 238392

9 years ago[x86] Refactor the tests for popcnt.
Chandler Carruth [Thu, 28 May 2015 02:40:15 +0000 (02:40 +0000)]
[x86] Refactor the tests for popcnt.

Extracted from the D6531 patch by Bruno Cardoso Lopes, and re-generated
to reflect the current state of the world. This should let Bruno's D6531
actually show the delta between the approaches by running the x86 test
case update script after re-building.

llvm-svn: 238391

9 years ago[omp] Actually provide a default OpenMP runtime -- libgomp for now.
Chandler Carruth [Thu, 28 May 2015 02:17:15 +0000 (02:17 +0000)]
[omp] Actually provide a default OpenMP runtime -- libgomp for now.

llvm-svn: 238390

9 years ago[omp] Re-work Clang's handling of -fopenmp and undo r237769.
Chandler Carruth [Thu, 28 May 2015 01:52:38 +0000 (01:52 +0000)]
[omp] Re-work Clang's handling of -fopenmp and undo r237769.

This isn't an actual revert of r237769, it just restores the behavior of
the Clang driver prior to it while completely re-implementing how that
behavior works.

This also re-does the work of making the default OpenMP runtime
selectable at CMake (or configure) time to work in the way all of our
other such hooks do (config.h, configure and cmake hooks, etc.).

I've re-implemented how we manage the '-fopenmp' flagset in an important
way. Now, the "default" hook just makes '-fopenmp' equivalent to
'-fopenmp=<default>' rather than a separate special beast. Also, there
is an '-fno-openmp' flag which does the obvious thing. Also, the code is
shared between all the places to select a known OpenMP runtime and act
on it.

Finally, and most significantly, I've taught the driver to inspect the
selected runtime when choosing whether to propagate the '-fopenmp' flag
to the frontend in the CC1 commandline. Without this, it isn't possible
to use Clang with libgomp, even if you were happy with the serial,
boring way in which it worked previously (ignoring all #pragmas but
linking in the library to satisfy direct calls into the runtime).

While I'm here, I've gone ahead and sketched out a path for the future
name of LLVM's OpenMP runtime (libomp) and the legacy support for its
current name (libiomp5) in what seems a more reasonable way.

To re-enable LLVM's OpenMP runtime (which I think should wait until the
normal getting started instructions are a reasonable way for falks to
check out, build, and install Clang with the runtime) all that needs to
change is the default string in the CMakeLists.txt and configure.ac
file. No code changes necessary.

I also added a test for the driver's behavior around OpenMP since it was
*completely missing* previously. Makes it unsurprising that we got it
wrong.

llvm-svn: 238389

9 years ago[omp] Add a configuration variable for the default OpenMP runtime.
Chandler Carruth [Thu, 28 May 2015 01:47:22 +0000 (01:47 +0000)]
[omp] Add a configuration variable for the default OpenMP runtime.

This will be used in my next commit to Clang.

llvm-svn: 238388

9 years agoAdded doxygen comments for the intrinsics.
Ekaterina Romanova [Thu, 28 May 2015 01:25:25 +0000 (01:25 +0000)]
Added doxygen comments for the intrinsics.

llvm-svn: 238386

9 years ago[TestDataFormatterUnordered] Use patterns to match unordered_<multi>set elements
Siva Chandra [Thu, 28 May 2015 01:18:11 +0000 (01:18 +0000)]
[TestDataFormatterUnordered] Use patterns to match unordered_<multi>set elements

Summary: This fixes the test for i386 targets.

Test Plan: dotest.py -C clang --arch i386 TestDataFormatterUnordered

Reviewers: chying, chaoren, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 238385

9 years agoFix unused variable warnings.
Michael J. Spencer [Thu, 28 May 2015 00:29:56 +0000 (00:29 +0000)]
Fix unused variable warnings.

llvm-svn: 238384

9 years agoAdd PHDR and FILL parsing.
Michael J. Spencer [Thu, 28 May 2015 00:14:58 +0000 (00:14 +0000)]
Add PHDR and FILL parsing.

llvm-svn: 238383

9 years agoUpdate -Winvalid-noreturn to handle destructors better.
Richard Trieu [Thu, 28 May 2015 00:14:02 +0000 (00:14 +0000)]
Update -Winvalid-noreturn to handle destructors better.

When checking if a function is noreturn, consider a codepath to be noreturn if
the path destroys a class and the class destructor, base class destructors, or
member field destructors are marked noreturn.

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

llvm-svn: 238382

9 years agoFix comment about balanced affinity
Jonathan Peyton [Wed, 27 May 2015 23:27:33 +0000 (23:27 +0000)]
Fix comment about balanced affinity

A while back, Hal mentioned fixing a comment concerning balanced affinity.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2014-December/000358.html
I forgot about fixing it until now, but now is better than never.

llvm-svn: 238378

9 years agoAsmPrinter: Avoid a warning in NDEBUG, NFC
Duncan P. N. Exon Smith [Wed, 27 May 2015 23:02:36 +0000 (23:02 +0000)]
AsmPrinter: Avoid a warning in NDEBUG, NFC

Should fix the -Werror release build:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/11113

llvm-svn: 238375

9 years agoAsmPrinter: Return added DIE from DIE::addChild()
Duncan P. N. Exon Smith [Wed, 27 May 2015 22:59:03 +0000 (22:59 +0000)]
AsmPrinter: Return added DIE from DIE::addChild()

Change `DIE::addChild()` to return a reference to the just-added node,
and update consumers to use it directly.  An upcoming commit will
abstract away (and eventually change) the underlying storage of
`DIE::Children`.

llvm-svn: 238372

9 years agoRegisterPressure: fix debug prints in case of physical registers
Fiona Glaser [Wed, 27 May 2015 22:51:47 +0000 (22:51 +0000)]
RegisterPressure: fix debug prints in case of physical registers

llvm-svn: 238371

9 years agoFix PR#23647 - make_shared<volatile bool> - second try
Marshall Clow [Wed, 27 May 2015 22:44:47 +0000 (22:44 +0000)]
Fix PR#23647 - make_shared<volatile bool> - second try

llvm-svn: 238370

9 years agoAsmPrinter: Stop exposing underlying DIEValue list, NFC
Duncan P. N. Exon Smith [Wed, 27 May 2015 22:44:06 +0000 (22:44 +0000)]
AsmPrinter: Stop exposing underlying DIEValue list, NFC

Change the `DIE` API to hide the implementation of the list of
`DIEValue`s.

llvm-svn: 238369

9 years ago[TestNamespace] Fix an accidentally committed local change.
Siva Chandra [Wed, 27 May 2015 22:39:21 +0000 (22:39 +0000)]
[TestNamespace] Fix an accidentally committed local change.

Test Plan: dotest.py -p TestNamespace

Reviewers: sivachandra

Subscribers: lldb-commits

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

llvm-svn: 238368

9 years ago[asan] Fix build dependency issues with ASan version list file.
Evgeniy Stepanov [Wed, 27 May 2015 22:38:01 +0000 (22:38 +0000)]
[asan] Fix build dependency issues with ASan version list file.

CMake pre-3.1 has a bug where a shared library depending on a custom_target
does not really depend on it.

This commit implements a hilariously ugly workaround for this problem, see
code comments for more details.

llvm-svn: 238367

9 years agoAsmPrinter: Remove DIEHash::AttrEntry, NFC
Duncan P. N. Exon Smith [Wed, 27 May 2015 22:36:37 +0000 (22:36 +0000)]
AsmPrinter: Remove DIEHash::AttrEntry, NFC

Remove "the most boring struct ever" (thanks to review by Eric).

llvm-svn: 238366

9 years agoAllow expresions to have unique expression prefixes:
Greg Clayton [Wed, 27 May 2015 22:32:39 +0000 (22:32 +0000)]
Allow expresions to have unique expression prefixes:

expr_options = lldb.SBExpressionOptions()
expr_options.SetPrefix('''
struct Foo {
   int a;
   int b;
   int c;
}
'''
expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options)

This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful.

<rdar://problem/21130675>

llvm-svn: 238365

9 years agoAsmPrinter: Store abbreviation data directly in DIE and DIEValue
Duncan P. N. Exon Smith [Wed, 27 May 2015 22:31:41 +0000 (22:31 +0000)]
AsmPrinter: Store abbreviation data directly in DIE and DIEValue

Stop storing a `DIEAbbrev` in `DIE`, since the data fits neatly inside
the `DIEValue` list.  Besides being a cleaner data structure (avoiding
the parallel arrays), this gives us more freedom to rearrange the
`DIEValue` list.

This fixes the temporary memory regression from 845 MB up to 879 MB, and
drops it further to 829 MB for a net memory decrease of around 1.9%
(incremental decrease around 5.7%).

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 238364

9 years ago[TestBase.runCmd] Better error message when runCmd fails.
Siva Chandra [Wed, 27 May 2015 22:27:41 +0000 (22:27 +0000)]
[TestBase.runCmd] Better error message when runCmd fails.

Summary:
Before:
    AssertionError: False is not True : Process is launched successfully

After:
    AssertionError: False is not True : Command 'run a.out' failed.
    >>> error: invalid target, create a target using the 'target create' command
    >>> Process could not be launched successfully

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, vharron

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

llvm-svn: 238363

9 years agoReapply "AsmPrinter: Change DIEValue to be stored by value"
Duncan P. N. Exon Smith [Wed, 27 May 2015 22:14:58 +0000 (22:14 +0000)]
Reapply "AsmPrinter: Change DIEValue to be stored by value"

This reverts commit r238350, effectively reapplying r238349 after fixing
(all?) the problems, all somehow related to how I was using
`AlignedArrayCharUnion<>` inside `DIEValue`:

  - MSVC can only handle `sizeof()` on types, not values.  Change the
    assert.
  - GCC doesn't know the `is_trivially_copyable` type trait.  Instead of
    asserting it, add destructors.
  - Call placement new even when constructing POD (i.e., the pointers).
  - Instead of copying the char buffer, copy the casted classes.

I've left in a couple of `static_assert`s that I think both MSVC and GCC
know how to handle.  If the bots disagree with me, I'll remove them.

  - Check that the constructed type is either standard layout or a
    pointer.  This protects against a programming error: we really want
    the "small" `DIEValue`s to be small and simple, so don't
    accidentally change them not to be.
  - Similarly, check that the size of the buffer is no bigger than a
    `uint64_t` or a pointer.  (I thought checking against
    `sizeof(uint64_t)` would be good enough, but Chandler suggested that
    pointers might sometimes be bigger than that in the context of
    sanitizers.)

I've also committed r238359 in the meantime, which introduces a
DIEValue.def to simplify dispatching between the various types (thanks
to a review comment by David Blaikie).  Without that, this commit would
be almost unintelligible.

Here's the original commit message:
--
Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)
--

llvm-svn: 238362

9 years ago[TestDataFormatterUnordered] Fix a few typos in the test.
Siva Chandra [Wed, 27 May 2015 22:03:09 +0000 (22:03 +0000)]
[TestDataFormatterUnordered] Fix a few typos in the test.

Summary: The typos were exposed by http://reviews.llvm.org/D9948.

Test Plan: dotest.py -p TestDataFormatterUnordered

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 238361

9 years agoSet function entry counts with -fprofile-instr-use.
Diego Novillo [Wed, 27 May 2015 21:58:42 +0000 (21:58 +0000)]
Set function entry counts with -fprofile-instr-use.

This generates function entry counts from instrumentation profiles.

llvm-svn: 238360

9 years agoAsmPrinter: Introduce DIEValue.def, NFC
Duncan P. N. Exon Smith [Wed, 27 May 2015 21:15:43 +0000 (21:15 +0000)]
AsmPrinter: Introduce DIEValue.def, NFC

Use a .def macro file to iterate through the various subclasses of
`DIEValue`.

llvm-svn: 238359

9 years agoRename and move getCurrentSectionData.
Rafael Espindola [Wed, 27 May 2015 21:04:14 +0000 (21:04 +0000)]
Rename and move getCurrentSectionData.

I think this concludes the merge of MCSectionData and MCSection.

llvm-svn: 238358

9 years agoThere is only one current section.
Rafael Espindola [Wed, 27 May 2015 20:52:32 +0000 (20:52 +0000)]
There is only one current section.

Both MCStreamer and MCObjectStreamer were maintaining a current section
variable and they were slightly out of sync. I don't think this was observable,
but was inefficient and error prone.

Changing this requires a few cascading changes:

* SwitchSection has to call ChangeSection earlier for ChangeSection to see
  the old section.
* With that change, ChangeSection cannot call EmitLabel, since during
  ChangeSection we are still in the old section.
* When the object streamer requires a begin label, just reused the existing
  generic support for begin labels instead of calling EmitLabel directly.

llvm-svn: 238357

9 years ago[RuntimeDyld] Fix MachO i386 SECTDIFF relocation to support non-zero addends.
Lang Hames [Wed, 27 May 2015 20:50:01 +0000 (20:50 +0000)]
[RuntimeDyld] Fix MachO i386 SECTDIFF relocation to support non-zero addends.

Previously, relocations of the form 'A - B + C' would fail on i386 when C was
non-zero.

llvm-svn: 238356

9 years agoRevert 238354 while I figure out what broke in weak_ptr
Marshall Clow [Wed, 27 May 2015 20:36:14 +0000 (20:36 +0000)]
Revert 238354 while I figure out what broke in weak_ptr

llvm-svn: 238355

9 years agoFix PR#23647 - make_shared<volatile bool>
Marshall Clow [Wed, 27 May 2015 20:15:33 +0000 (20:15 +0000)]
Fix PR#23647 - make_shared<volatile bool>

llvm-svn: 238354

9 years agoARMTargetParser: Make BSD Thumb/BE armv6 work
Renato Golin [Wed, 27 May 2015 19:49:53 +0000 (19:49 +0000)]
ARMTargetParser: Make BSD Thumb/BE armv6 work

Simple change to make arch like "thumbv6" and "armbev6" to return the
correct CPU for FreeBSD and NetBSD.

llvm-svn: 238353

9 years agoMIR: Remove 2 empty non-reverted directories form SVN.
Alex Lorenz [Wed, 27 May 2015 19:39:44 +0000 (19:39 +0000)]
MIR: Remove 2 empty non-reverted directories form SVN.

The revert commit r238007 didn't delete the old 'MIR' directories
in 'include/llvm/CodeGen' and 'lib/CodeGen'. Since the resubmitted
commit r238341 uses the 'MIRParser' directories instead of 'MIR'
this commit deletes the unused directories.

llvm-svn: 238352

9 years agoFinal fix for PR 23499 and IR test case.
Diego Novillo [Wed, 27 May 2015 19:34:01 +0000 (19:34 +0000)]
Final fix for PR 23499 and IR test case.

This fixes a bit I forgot in r238335. In addition to the data record and
the counter, we can also move the name of the counter to the comdat for
the associated function.

I'm also adding an IR test case to check that these three elements are
placed in the proper comdat.

llvm-svn: 238351

9 years agoRevert "AsmPrinter: Change DIEValue to be stored by value"
Duncan P. N. Exon Smith [Wed, 27 May 2015 19:30:27 +0000 (19:30 +0000)]
Revert "AsmPrinter: Change DIEValue to be stored by value"

This reverts commit r238349, since it caused some errors on bots:
  - std::is_trivially_copyable isn't available until GCC 5.0.
  - It was complaining about strict aliasing with my use of
    ArrayCharUnion.

llvm-svn: 238350

9 years agoAsmPrinter: Change DIEValue to be stored by value
Duncan P. N. Exon Smith [Wed, 27 May 2015 19:22:50 +0000 (19:22 +0000)]
AsmPrinter: Change DIEValue to be stored by value

Change `DIEValue` to be stored/passed/etc. by value, instead of
reference.  It's now a discriminated union, with a `Val` field storing
the actual type.  The classes that used to inherit from `DIEValue` no
longer do.  There are two categories of these:

  - Small values fit in a single pointer and are stored by value.
  - Large values require auxiliary storage, and are stored by reference.

The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It
was relying on `DIEInteger`s being passed around by reference, so I
replaced that assumption with a `PatchLocation` type that stores a safe
reference to where the `DIEInteger` lives instead.

This commit causes a temporary regression in memory usage, since I've
left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I
measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up
drops it lower than the starting point, and I've only recently brought
the memory this low anyway, so I'm committing these changes separately
to keep them incremental.  (I also considered swapping the commits, but
the other one first would cause a lot more code churn.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 238349

9 years agoXTIMEOUT another test timing out on the FreeBSD buildbot
Ed Maste [Wed, 27 May 2015 19:11:29 +0000 (19:11 +0000)]
XTIMEOUT another test timing out on the FreeBSD buildbot

llvm-svn: 238348

9 years agoAllow gcc 5.x to compile library.
Jonathan Peyton [Wed, 27 May 2015 18:57:33 +0000 (18:57 +0000)]
Allow gcc 5.x to compile library.

Change check of __GNUC__ macro from:
__GNUC__ == 4 to __GNUC__ >= 4

llvm-svn: 238347

9 years agoAsmPrinter: Reorganize DIE.h, NFC
Duncan P. N. Exon Smith [Wed, 27 May 2015 18:49:38 +0000 (18:49 +0000)]
AsmPrinter: Reorganize DIE.h, NFC

An upcoming commit will switch to storing `DIEValue`s by value in a
`DIE`, so move the `DIE` down below all the subclasses it can.  Two
subclasses inherit from `DIE`, so drop those down below `DIE`.

`DIEValue` will become a discriminated union, which contains an instance
of one of the classes that are currently subclasses.  "Big" ones, such
as those that inherit from `DIE`, will continue to be stored by pointer.
This commit does as much of the code motion ahead of time as possible.

llvm-svn: 238346

9 years agoIt appears these exports are needed, as wmmintrin.h includes them.
John Thompson [Wed, 27 May 2015 18:26:41 +0000 (18:26 +0000)]
It appears these exports are needed, as wmmintrin.h includes them.

llvm-svn: 238345

9 years agoARMTargetParser: Normalising build attributes
Renato Golin [Wed, 27 May 2015 18:15:37 +0000 (18:15 +0000)]
ARMTargetParser: Normalising build attributes

Now that most of the methods in Clang and LLVM that were parsing arch/cpu/fpu
strings are using ARMTargetParser, it's time to make it a bit more conforming
with what the ABI says.

This commit adds some clarification on what build attributes are accepted and
which are "non-standard". It also makes clear that the "defaultCPU" and
"defaultArch" methods were really just build attribute getters.

It also diverges from GCC's behaviour to say that armv2/armv3 are really an
ARMv4 in the build attributes, when the ABI has a clear state for that: Pre-v4.

llvm-svn: 238344

9 years agoAvoid creating and destroying a std::string on every iteration.
Yaron Keren [Wed, 27 May 2015 18:11:07 +0000 (18:11 +0000)]
Avoid creating and destroying a std::string on every iteration.

llvm-svn: 238343

9 years agoResubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format).
Alex Lorenz [Wed, 27 May 2015 18:02:19 +0000 (18:02 +0000)]
Resubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format).

This commit a 3rd attempt at comitting the initial MIR serialization patch.
The first commit (r237708) was reverted in 237730. Then the second commit
(r237954) was reverted in r238007, as the MIR library under CodeGen caused
a circular dependency where the CodeGen library depended on MIR and MIR
library depended on CodeGen.

This commit has fixed the dependencies between CodeGen and MIR by
reorganizing the MIR serialization code - the code that prints out
MIR has been moved to CodeGen, and the MIR library has been renamed
to MIRParser. Now the CodeGen library doesn't depend on the
MIRParser library, thus the circular dependency no longer exists.

--Original Commit Message--

MIR Serialization: print and parse LLVM IR using MIR format.

This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR
using the MIR format. This pass is then added as a last pass when a
'stop-after' option is used in llc. The new library adds the initial
functionality for parsing of MIR files as well. This commit also
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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

llvm-svn: 238341