platform/upstream/llvm.git
9 years agoclang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.
Daniel Jasper [Fri, 5 Dec 2014 10:42:21 +0000 (10:42 +0000)]
clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.

This fixes llvm.org/PR21756.

llvm-svn: 223458

9 years agotsan: protect trace memory range on startup
Dmitry Vyukov [Fri, 5 Dec 2014 10:06:06 +0000 (10:06 +0000)]
tsan: protect trace memory range on startup

so that user does not map something there ahead of us

llvm-svn: 223456

9 years agoDriver: Objective-C should respect -fno-exceptions
David Majnemer [Fri, 5 Dec 2014 08:56:55 +0000 (08:56 +0000)]
Driver: Objective-C should respect -fno-exceptions

Clang attempted to replicate a GCC bug: -fobjc-exceptions forces
-fexceptions to be enabled.  However, this has unintended effects and
other awkard side effects that Clang doesn't "correctly" ape (e.g. it's
impossible to turn off C++ exceptions in ObjC++ mode).

Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an
identical relationship with -f[no]exceptions.

llvm-svn: 223455

9 years agoAdd missing FP build attribute tests.
Charlie Turner [Fri, 5 Dec 2014 08:22:47 +0000 (08:22 +0000)]
Add missing FP build attribute tests.

The test file test/CodeGen/ARM/build-attributes.ll was missing several
floating-point build attribute tests. The intention of this commit is that for
each CPU / architecture currently tested, there are now tests that make sure
the following attributes are sufficiently checked,

  * Tag_ABI_FP_rounding
  * Tag_ABI_FP_denormal
  * Tag_ABI_FP_exceptions
  * Tag_ABI_FP_user_exceptions
  * Tag_ABI_FP_number_model

Also in this commit, the -unsafe-fp-math flag has been augmented with the full
suite of flags Clang sends to LLVM when you pass -ffast-math to Clang. That is,
`-unsafe-fp-math' has been changed to `-enable-unsafe-fp-math -disable-fp-elim
-enable-no-infs-fp-math -enable-no-nans-fp-math -fp-contract=fast'

Change-Id: I35d766076bcbbf09021021c0a534bf8bf9a32dfc
llvm-svn: 223454

9 years agoDriver: Cleanup -fexceptions behavior
David Majnemer [Fri, 5 Dec 2014 08:11:58 +0000 (08:11 +0000)]
Driver: Cleanup -fexceptions behavior

No functionality change is intended, just a cleanup of the logic clang
uses to determine what -fexceptions/-fno-exceptions ends up doing.

llvm-svn: 223453

9 years agoFix a crash in dotest.py when the lldb executable is not built.
Stephane Sezer [Fri, 5 Dec 2014 05:02:41 +0000 (05:02 +0000)]
Fix a crash in dotest.py when the lldb executable is not built.

Summary: If lldb is not built, dotest.py throws an exception because we are using an unset variable.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 223446

9 years ago[OPENMP] Test for 'omp barrier' directive
Alexey Bataev [Fri, 5 Dec 2014 04:10:27 +0000 (04:10 +0000)]
[OPENMP] Test for 'omp barrier' directive

llvm-svn: 223445

9 years ago[OPENMP] Codegen for 'omp barrier' directive.
Alexey Bataev [Fri, 5 Dec 2014 04:09:23 +0000 (04:09 +0000)]
[OPENMP] Codegen for 'omp barrier' directive.
Adds generation of call to "i32 kmpc_cancel_barrier(ident_t *, i32)" libcall for explicitly specified barriers (OMP_IDENT_BARRIER_EXPL flag is added to "flags" field of "ident_t" structure).
Also this patch replaces all calls to "kmpc_barrier" function by calls of "__kmpc_cancel_barrier" function which provides additional functionality for OpenMP 4.0.
Also, library specific enum OpenMPLocationFlags moved to private section of CGOpenMPRuntime class to make it more independent from library implementation.
Differential Revision: http://reviews.llvm.org/D6447

llvm-svn: 223444

9 years ago[modules] Instead of storing absolute paths in a .pcm file, store the path to
Richard Smith [Fri, 5 Dec 2014 02:33:27 +0000 (02:33 +0000)]
[modules] Instead of storing absolute paths in a .pcm file, store the path to
the root of the module and use paths relative to that directory wherever
possible. This is a step towards allowing explicit modules to be relocated
without being rebuilt, which is important for some kinds of distributed builds,
for good paths in diagnostics, and for appropriate .d output.

llvm-svn: 223443

9 years agoRevert "r223440 - Consider subregs when calling MI::registerDefIsDead for phys deps"
Hal Finkel [Fri, 5 Dec 2014 02:07:35 +0000 (02:07 +0000)]
Revert "r223440 - Consider subregs when calling MI::registerDefIsDead for phys deps"

Reverting this because, while it fixes the problem in the reduced test case, it
does not fix the problem in the full test case from the bug report.

llvm-svn: 223442

9 years agoReverting r223423, test timeout
Vince Harron [Fri, 5 Dec 2014 02:06:03 +0000 (02:06 +0000)]
Reverting r223423, test timeout

Was causing dosep to hang in some cases.

llvm-svn: 223441

9 years agoConsider subregs when calling MI::registerDefIsDead for phys deps
Hal Finkel [Fri, 5 Dec 2014 01:57:22 +0000 (01:57 +0000)]
Consider subregs when calling MI::registerDefIsDead for phys deps

The scheduling dependency graph is built bottom-up within each scheduling
region, and ScheduleDAGInstrs::addPhysRegDeps is called to add output/anti
dependencies, based on physical registers, to the SUs for instructions
based on those that come before them.

In the test case, we start before post-RA scheduling with a block that looks
like this:

...
INLINEASM <...
andc $0,$0,$2
stdcx. $0,0,$3
bne- 1b
> [sideeffect] [mayload] [maystore] [attdialect], $0:[regdef-ec:G8RC], %X6<earlyclobber,def,dead>, $1:[mem], %X3<kill>, $2:[reguse:G8RC], %X5<kill>, $3:[reguse:G8RC], %X3, $4:[mem], %X3, $5:[clobber], %CC<earlyclobber,imp-def,dead>, <<badref>>
...
%X4<def,dead> = ANDIo8 %X4<kill>, 1, %CR0<imp-def,dead>, %CR0GT<imp-def>
...
%R29<def> = ISEL %R3<undef>, %R4<kill>, %CR0GT<kill>

where it is relevant that %CC is an alias to %CR0, and that %CR0GT is a
subregister of %CR0. However, for post-RA scheduling, no dependency was added
to prevent the INLINEASM from being scheduled in between the ANDIo8 and the
ISEL (which communicate via the %CR0GT register).

In ScheduleDAGInstrs::addPhysRegDeps, when called for the %CC operand, we'd
iterate over all of its aliases (which include %CC itself and also %CR0), and
look for previously-encountered defs of those registers. We'd find the ANDIo8,
but decide not to add a dependency between the INLINEASM and the ANDIo8 because
both the INLINEASM's def of %CC is dead, and also the ANDIo8 def of %CR0 is
dead. This ignores, however, that ANDIo8 has a non-dead def of %CR0GT, a
subregister of %CR0, and thus a dependency still must exist.

To fix this problem, when calling registerDefIsDead on the SU with the def, we
also check all subregisters for possible non-dead defs, and add the dependency
if any are found.

Fixes PR21742.

llvm-svn: 223440

9 years agoADT: Remove GetStringMapEntryFromValue()
Duncan P. N. Exon Smith [Fri, 5 Dec 2014 01:41:36 +0000 (01:41 +0000)]
ADT: Remove GetStringMapEntryFromValue()

It relies on undefined behaviour, since `StringMapEntry<>` is not
a standard layout type.  There are no users anyway.

llvm-svn: 223439

9 years agoIR: Stop relying on GetStringMapEntryFromValue()
Duncan P. N. Exon Smith [Fri, 5 Dec 2014 01:41:34 +0000 (01:41 +0000)]
IR: Stop relying on GetStringMapEntryFromValue()

It relies on undefined behaviour.

llvm-svn: 223438

9 years agoAdded CMake support so all the Clang modules code
Sean Callanan [Fri, 5 Dec 2014 01:31:55 +0000 (01:31 +0000)]
Added CMake support so all the Clang modules code
will at least be built by non-OS X builders. This
should head off some build breakage at the pass.

llvm-svn: 223437

9 years agoChanges to the expression parser to actually use
Sean Callanan [Fri, 5 Dec 2014 01:27:35 +0000 (01:27 +0000)]
Changes to the expression parser to actually use
the types that we find in Clang modules.

llvm-svn: 223436

9 years agoAdditional changes required by r223433.
Sean Callanan [Fri, 5 Dec 2014 01:26:42 +0000 (01:26 +0000)]
Additional changes required by r223433.

llvm-svn: 223435

9 years agoRemoved a stray directory.
Sean Callanan [Fri, 5 Dec 2014 01:22:25 +0000 (01:22 +0000)]
Removed a stray directory.

llvm-svn: 223434

9 years agoThis is the meat of the code to add Clang modules
Sean Callanan [Fri, 5 Dec 2014 01:21:59 +0000 (01:21 +0000)]
This is the meat of the code to add Clang modules
support to LLDB.  It includes the following:

- Changed DeclVendor to TypeVendor.
- Made the ObjCLanguageRuntime provide a DeclVendor
  rather than a TypeVendor.
- Changed the consumers of TypeVendors to use
  DeclVendors instead.
- Provided a few convenience functions on
  ClangASTContext to make that easier.

llvm-svn: 223433

9 years agoAdded the LLDB enumeration necessary to find the
Sean Callanan [Fri, 5 Dec 2014 01:17:47 +0000 (01:17 +0000)]
Added the LLDB enumeration necessary to find the
Clang headers directory.  Needed by r223430.

llvm-svn: 223432

9 years agoAdded support to Platform to indicate (1) whether the
Sean Callanan [Fri, 5 Dec 2014 01:16:31 +0000 (01:16 +0000)]
Added support to Platform to indicate (1) whether the
current platform supports Clang modules, and (2) what
options to pass to Clang so it can load those Clang
modules.

llvm-svn: 223431

9 years agoAdd support for embedding Clang compiler headers
Sean Callanan [Fri, 5 Dec 2014 01:15:04 +0000 (01:15 +0000)]
Add support for embedding Clang compiler headers
like tgmath.h and stdarg.h into the LLDB installation,
and then finding them through the Host infrastructure.

Also add a script to actually do this on Mac OS X.

llvm-svn: 223430

9 years agoHave the driver and the target code agree on what the default ABI
Eric Christopher [Fri, 5 Dec 2014 01:06:59 +0000 (01:06 +0000)]
Have the driver and the target code agree on what the default ABI
is for each machine. Fix up darwin tests that were testing for
aapcs on armv7-ios when the actual ABI is apcs.

Should be no user visible change without -cc1.

llvm-svn: 223429

9 years agoCleanup: Calls to getDwarfRegNum() may actually fail, if there is
Adrian Prantl [Fri, 5 Dec 2014 01:02:46 +0000 (01:02 +0000)]
Cleanup: Calls to getDwarfRegNum() may actually fail, if there is
no DWARF register number mapping, or if the register was a virtual
register that was never materialized. Previously, we would just emit a
bogus location, after this patch we don't emit a location at all by
doing an early exit.

After my bugfix in r223401 today, this doesn't actually happen on any
target that I tested this with, but it's still preferable to make the
possibility of a failure explicit.

llvm-svn: 223428

9 years agoAdd a comment.
Adrian Prantl [Fri, 5 Dec 2014 01:02:36 +0000 (01:02 +0000)]
Add a comment.

llvm-svn: 223427

9 years ago[analyzer] Eliminated endless loop.
Anton Yartsev [Fri, 5 Dec 2014 00:59:07 +0000 (00:59 +0000)]
[analyzer] Eliminated endless loop.

llvm-svn: 223426

9 years agoMake GetSVN.cmake do its VCS queries with native CMake code.
Paul Robinson [Fri, 5 Dec 2014 00:50:15 +0000 (00:50 +0000)]
Make GetSVN.cmake do its VCS queries with native CMake code.
This lets the queries work on Windows as well as Linux.

This does mean make and cmake aren't using the same scripts to do the
queries (again), but at least GetSVN.cmake understands git and git-svn
as well as svn now.

llvm-svn: 223425

9 years agolinkGlobalVariableProto never returns null. Simplify the caller. NFC.
Rafael Espindola [Fri, 5 Dec 2014 00:30:47 +0000 (00:30 +0000)]
linkGlobalVariableProto never returns null. Simplify the caller. NFC.

llvm-svn: 223424

9 years agoKill any python test script that takes more than 5 minutes
Vince Harron [Fri, 5 Dec 2014 00:23:03 +0000 (00:23 +0000)]
Kill any python test script that takes more than 5 minutes

There is at least one test that hangs on the Linux debian buildbot.

When that test hangs, the buildbot kills dosep which loses all test
results.  This change kills just the hung test and should let us see
which test is hanging.  This is useful for that test and any others
in the future which start hanging.

llvm-svn: 223423

9 years agoUse isOSBinFormatMachO() instead of comparing the object format
Eric Christopher [Fri, 5 Dec 2014 00:22:48 +0000 (00:22 +0000)]
Use isOSBinFormatMachO() instead of comparing the object format
against an enum.

llvm-svn: 223422

9 years agoRename the x86 isTargetMacho to isTargetMachO for uniformity.
Eric Christopher [Fri, 5 Dec 2014 00:22:38 +0000 (00:22 +0000)]
Rename the x86 isTargetMacho to isTargetMachO for uniformity.

llvm-svn: 223421

9 years agoBoth of these subtargets have functions that check whether or
Eric Christopher [Fri, 5 Dec 2014 00:22:35 +0000 (00:22 +0000)]
Both of these subtargets have functions that check whether or
not the target is mach-o. Use them.

llvm-svn: 223420

9 years ago[ASan, LSan] Improve tracking of thread creation.
Sergey Matveev [Fri, 5 Dec 2014 00:10:15 +0000 (00:10 +0000)]
[ASan, LSan] Improve tracking of thread creation.

In the current scheme of things, the call to ThreadStart() in the child
thread is not synchronized with the parent thread. So, if a pointer is passed to
pthread_create, there may be a window of time during which this pointer will not
be discoverable by LSan. I.e. the pthread_create interceptor has already
returneed and thus the pointer is no longer on the parent stack, but we don't
yet know the location of the child stack. This has caused bogus leak reports
(see http://llvm.org/bugs/show_bug.cgi?id=21621/).

This patch makes the pthread_create interceptor wait until the child thread is
properly registered before returning.

llvm-svn: 223419

9 years agoMove merging of alignment to a central location. NFC.
Rafael Espindola [Fri, 5 Dec 2014 00:09:02 +0000 (00:09 +0000)]
Move merging of alignment to a central location. NFC.

llvm-svn: 223418

9 years agoAdd a few extra cases to the test. NFC.
Rafael Espindola [Fri, 5 Dec 2014 00:02:42 +0000 (00:02 +0000)]
Add a few extra cases to the test. NFC.

llvm-svn: 223417

9 years agoRe-add support to llvm-objdump for Mach-O universal files and archives with -macho
Kevin Enderby [Thu, 4 Dec 2014 23:56:27 +0000 (23:56 +0000)]
Re-add support to llvm-objdump for Mach-O universal files and archives with -macho
with fixes.  Includes the move of tests for llvm-objdump for universal files to an X86
directory.  And the fix where it was failing on linux Rafael tracked down with asan.
I had both Jim Grosbach and Adam Hemet look over the second fix since I could not
set up asan to reproduce with the old version but not with the fix.

llvm-svn: 223416

9 years ago[X86] Delete dead code in fcopysign lowering. NFC.
Ahmed Bougacha [Thu, 4 Dec 2014 23:52:15 +0000 (23:52 +0000)]
[X86] Delete dead code in fcopysign lowering. NFC.

r32900 introduced custom lowering for fcopysign, with two checks to
change the magnitude value's type if it's larger/smaller than the sign
value's type.  r32932 replaced that code for the smaller case.
r43205 did the same for the larger case, but left the old code, now dead.

llvm-svn: 223415

9 years agoConvert test to use an extra Input file. NFC.
Rafael Espindola [Thu, 4 Dec 2014 23:31:21 +0000 (23:31 +0000)]
Convert test to use an extra Input file. NFC.

llvm-svn: 223414

9 years agoParse qualifiers after comma in declarator lists as a Microsoft extension
Nico Rieck [Thu, 4 Dec 2014 23:31:08 +0000 (23:31 +0000)]
Parse qualifiers after comma in declarator lists as a Microsoft extension

MSVC parses and ignores these with a warning.

llvm-svn: 223413

9 years agoRecognize __unaligned keyword after type specifier
Nico Rieck [Thu, 4 Dec 2014 23:30:25 +0000 (23:30 +0000)]
Recognize __unaligned keyword after type specifier

The __unaligned keyword can appear after a struct definition:

  struct foo {...} __unaligned *x;

llvm-svn: 223412

9 years agoRemove extra semicolon.
Rui Ueyama [Thu, 4 Dec 2014 23:26:11 +0000 (23:26 +0000)]
Remove extra semicolon.

llvm-svn: 223411

9 years agoRevert "Fix UBSan report in StringMap implementation."
Alexey Samsonov [Thu, 4 Dec 2014 23:00:50 +0000 (23:00 +0000)]
Revert "Fix UBSan report in StringMap implementation."

This reverts commit r223402. Some bots fail with -Winvalid-offsetof
warning.

llvm-svn: 223407

9 years agoSimplify implementation and testcase of r223401 based on feedback from dblaikie.
Adrian Prantl [Thu, 4 Dec 2014 22:58:41 +0000 (22:58 +0000)]
Simplify implementation and testcase of r223401 based on feedback from dblaikie.

llvm-svn: 223405

9 years agoAdding a FIXME to the code, based on a discussion in IRC; NFC.
Aaron Ballman [Thu, 4 Dec 2014 22:45:31 +0000 (22:45 +0000)]
Adding a FIXME to the code, based on a discussion in IRC; NFC.

llvm-svn: 223403

9 years agoFix UBSan report in StringMap implementation.
Alexey Samsonov [Thu, 4 Dec 2014 22:45:31 +0000 (22:45 +0000)]
Fix UBSan report in StringMap implementation.

Use offsetof() instead of a member access within null pointer.

llvm-svn: 223402

9 years agoDebug info: If the RegisterCoalescer::reMaterializeTrivialDef() is
Adrian Prantl [Thu, 4 Dec 2014 22:29:04 +0000 (22:29 +0000)]
Debug info: If the RegisterCoalescer::reMaterializeTrivialDef() is
eliminating all uses of a vreg, update any DBG_VALUE describing that vreg
to point to the rematerialized register instead.

llvm-svn: 223401

9 years agoFix a bunch of -Winconsistent-missing-override warnings.
Eric Christopher [Thu, 4 Dec 2014 22:26:07 +0000 (22:26 +0000)]
Fix a bunch of -Winconsistent-missing-override warnings.

llvm-svn: 223400

9 years agoAdd some tests for SimplifyCFG's TurnSwitchRangeIntoICmp(). NFC.
Hans Wennborg [Thu, 4 Dec 2014 22:19:28 +0000 (22:19 +0000)]
Add some tests for SimplifyCFG's TurnSwitchRangeIntoICmp(). NFC.

llvm-svn: 223396

9 years agoAdd some tests for SimplifyCFG's ConstantFoldTerminator(). NFC.
Hans Wennborg [Thu, 4 Dec 2014 22:19:25 +0000 (22:19 +0000)]
Add some tests for SimplifyCFG's ConstantFoldTerminator(). NFC.

llvm-svn: 223395

9 years agoAlso use --icf=safe if we are being linked by gold.
Rafael Espindola [Thu, 4 Dec 2014 22:16:08 +0000 (22:16 +0000)]
Also use --icf=safe if we are being linked by gold.

llvm-svn: 223394

9 years agoFix a minor error where I forgot to declare a variable.
Zachary Turner [Thu, 4 Dec 2014 22:07:02 +0000 (22:07 +0000)]
Fix a minor error where I forgot to declare a variable.

llvm-svn: 223393

9 years agoRevert "Use timeout when reading debugserver's port from a named pipe."
Zachary Turner [Thu, 4 Dec 2014 22:06:42 +0000 (22:06 +0000)]
Revert "Use timeout when reading debugserver's port from a named pipe."

This reverts commit 4a5ad2c077166cc3d6e7ab4cc6e3dcbbe922af86.

Windows doesn't support select() for pipe objects, and this also fails
to compile on Windows.  Reverting this until we can get it sorted out
to keep the windows build working.

llvm-svn: 223392

9 years agoSilence warning: "NOMINMAX" redefined.
Yaron Keren [Thu, 4 Dec 2014 21:46:50 +0000 (21:46 +0000)]
Silence warning: "NOMINMAX" redefined.

llvm-svn: 223391

9 years agoAdd a FIXME as requested by Renato Golin.
Roman Divacky [Thu, 4 Dec 2014 21:39:24 +0000 (21:39 +0000)]
Add a FIXME as requested by Renato Golin.

llvm-svn: 223390

9 years agoSilence warning: variable 'buffer' set but not used.
Yaron Keren [Thu, 4 Dec 2014 21:36:38 +0000 (21:36 +0000)]
Silence warning: variable 'buffer' set but not used.

llvm-svn: 223389

9 years agoRevert "Fix a build breakage. Looks like the LLVM side of this change has been reverted"
David Majnemer [Thu, 4 Dec 2014 21:26:25 +0000 (21:26 +0000)]
Revert "Fix a build breakage. Looks like the LLVM side of this change has been reverted"

This reverts commit r223375.  We need to use unique_ptr to build with
LLVM r223183.

llvm-svn: 223388

9 years agoCMake: build DLLs in the right directory and include them in the 'install' target...
Hans Wennborg [Thu, 4 Dec 2014 21:01:49 +0000 (21:01 +0000)]
CMake: build DLLs in the right directory and include them in the 'install' target (PR21719)

When CMake builds a dynamic library on Windows, the .dll file's location is
determined by the RUNTIME_OUTPUT_DIRECTORY, which we were previously not
setting.

This means for example that clang_rt.asan_dynamic-i386.dll will get built
and installed in the same directory as the corresponding .lib file,
instead of being built in the bin/ directory and not installed at all.

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

llvm-svn: 223387

9 years agoRoll gofrontend to 2a85649c19e1.
Peter Collingbourne [Thu, 4 Dec 2014 20:39:58 +0000 (20:39 +0000)]
Roll gofrontend to 2a85649c19e1.

llvm-svn: 223385

9 years agoAdd attributes for AMDGPU register limits.
Matt Arsenault [Thu, 4 Dec 2014 20:38:18 +0000 (20:38 +0000)]
Add attributes for AMDGPU register limits.

This is a performance hint that can be applied to kernels
to attempt to limit the number of used registers.

llvm-svn: 223384

9 years ago[x86] Fix isOffsetSuitableForCodeModel kernel code model offset
Bruno Cardoso Lopes [Thu, 4 Dec 2014 20:36:06 +0000 (20:36 +0000)]
[x86] Fix isOffsetSuitableForCodeModel kernel code model offset

Offset == 0 is a valid offset for kernel code model according to the
x86_64 System V ABI. Found by inspection, no testcase.

llvm-svn: 223383

9 years ago[AArch64] Combining Load and IntToFp should check for neon availability
Weiming Zhao [Thu, 4 Dec 2014 20:25:50 +0000 (20:25 +0000)]
[AArch64] Combining Load and IntToFp should check for neon availability

llvm-svn: 223382

9 years agoFix yet another unseen regression caused by r223113
Asiri Rathnayake [Thu, 4 Dec 2014 19:34:59 +0000 (19:34 +0000)]
Fix yet another unseen regression caused by r223113

r223113 added support for ARM modified immediate assembly syntax. Which
assumes all immediate operands are prefixed with a '#'. This assumption
is wrong as per the ARMARM - which recommends that all '#' characters be
treated optional. The current patch fixes this regression and adds a test
case. A follow-up patch will expand the test coverage to other instructions.

llvm-svn: 223381

9 years agoFix thumbv4t indirect calls
Jonathan Roelofs [Thu, 4 Dec 2014 19:34:50 +0000 (19:34 +0000)]
Fix thumbv4t indirect calls

So there are a couple of issues with indirect calls on thumbv4t. First, the most
'obvious' instruction, 'blx' isn't available until v5t. And secondly, the
next-most-obvious sequence: 'mov lr, pc; bx rN' doesn't DTRT in thumb code
because the saved off pc has its thumb bit cleared, so when the callee returns
we end up in ARM mode.... yuck.

The solution is to 'bl' to a nearby landing pad with a 'bx rN' in it.

We could cut down on code size by sharing the landing pads between call sites
that are close enough, but for the moment let's do correctness first and look at
performance later.

Patch by: Iain Sandoe

http://reviews.llvm.org/D6519

llvm-svn: 223380

9 years agoWe should not pretend that an int is a valid ObjC pointer. If your number truly is...
Enrico Granata [Thu, 4 Dec 2014 19:31:51 +0000 (19:31 +0000)]
We should not pretend that an int is a valid ObjC pointer. If your number truly is a pointer, po (id)myNumber is a better alternative. Fixes rdar://16585032

llvm-svn: 223379

9 years agoAdd a test case for argument type coercion in an invoke of a vararg function
Philip Reames [Thu, 4 Dec 2014 19:13:45 +0000 (19:13 +0000)]
Add a test case for argument type coercion in an invoke of a vararg function

This would have caught the bug I fixed in 223370.

llvm-svn: 223378

9 years agoRemove dead code from SymbolFileDWARF:
Greg Clayton [Thu, 4 Dec 2014 18:49:24 +0000 (18:49 +0000)]
Remove dead code from SymbolFileDWARF:

lldb::TypeSP
SymbolFileDWARF::FindDefinitionTypeForDIE (
    DWARFCompileUnit* dwarf_cu,
    const DWARFDebugInfoEntry *die,
    const lldb_private::ConstString &type_name);

This function isn't used as it has been replaced by:

lldb::TypeSP
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (
    const DWARFDeclContext &die_decl_ctx);

I am about to change the way we resolve C/C++ class/struct/union types and want to clean up SymbolFileDWARF before I start.

llvm-svn: 223376

9 years agoFix a build breakage. Looks like the LLVM side of this change has been reverted
Enrico Granata [Thu, 4 Dec 2014 18:39:40 +0000 (18:39 +0000)]
Fix a build breakage. Looks like the LLVM side of this change has been reverted

llvm-svn: 223375

9 years agoAdd a section to Statepoint docs mentioning shared bugzilla search and standard maili...
Philip Reames [Thu, 4 Dec 2014 18:33:28 +0000 (18:33 +0000)]
Add a section to Statepoint docs mentioning shared bugzilla search and standard mailing lists

llvm-svn: 223374

9 years agoRevert "Rewrite InputGraph's Group"
Rui Ueyama [Thu, 4 Dec 2014 18:29:03 +0000 (18:29 +0000)]
Revert "Rewrite InputGraph's Group"

This reverts commit r223330 because it broke Darwin and ELF
linkers in a way that we couldn't have caught with the existing
test cases.

llvm-svn: 223373

9 years agoDetect if the linker is gold and if so always use --gc-sections.
Rafael Espindola [Thu, 4 Dec 2014 17:54:35 +0000 (17:54 +0000)]
Detect if the linker is gold and if so always use --gc-sections.

llvm-svn: 223372

9 years agoRevert "r223364 - Revert r223347 which has caused crashes on bootstrap bots."
Hal Finkel [Thu, 4 Dec 2014 17:45:19 +0000 (17:45 +0000)]
Revert "r223364 - Revert r223347 which has caused crashes on bootstrap bots."

Reapply r223347, with a fix to not crash on uninserted instructions (or more
precisely, instructions in uninserted blocks). bugpoint was able to reduce the
test case somewhat, but it is still somewhat large (and relies on setting
things up to be simplified during inlining), so I've not included it here.
Nevertheless, it is clear what is going on and why.

Original commit message:

Restrict somewhat the memory-allocation pointer cmp opt from r223093

Based on review comments from Richard Smith, restrict this optimization from
applying to globals that might resolve lazily to other dynamically-loaded
modules, and also from dynamic allocas (which might be transformed into malloc
calls). In short, take extra care that the compared-to pointer is really
simultaneously live with the memory allocation.

llvm-svn: 223371

9 years agoFix a typo: use of cast where dyn_cast was intended
Philip Reames [Thu, 4 Dec 2014 17:27:58 +0000 (17:27 +0000)]
Fix a typo: use of cast where dyn_cast was intended

This bug has the effect of converting a test of isGCRelocate(InvokeInst*) from a false return to a crash.

This may be the root cause of the crash Joerg reported against r223137, but I'm still waiting for a clean build of clang to complete to be able to confirm.  Once I've confirmed the issue, I'll submit a test case separately.

llvm-svn: 223370

9 years agotest-release.sh: Add a way to specify --build to configure
Daniel Sanders [Thu, 4 Dec 2014 17:15:35 +0000 (17:15 +0000)]
test-release.sh: Add a way to specify --build to configure

Summary:
I currently have to specify --build=mips-linux-gnu or --build=mipsel-linux-gnu
to configure in order to successfully recurse a 32-bit build of the compiler on
my mips64-linux-gnu and mips64el-linux-gnu targets. This is a bug and will be
fixed but in the meantime it will be useful to have a way to work around this.

Reviewers: tstellarAMD

Subscribers: llvm-commits

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

llvm-svn: 223369

9 years agoRemove dead code. NFC.
Rafael Espindola [Thu, 4 Dec 2014 16:59:36 +0000 (16:59 +0000)]
Remove dead code. NFC.

This interface was added 2 years ago but users never developed.

llvm-svn: 223368

9 years agoclang-format: [JS] Don't put top-level dict literals on a single line.
Daniel Jasper [Thu, 4 Dec 2014 16:07:17 +0000 (16:07 +0000)]
clang-format: [JS] Don't put top-level dict literals on a single line.

These are often used for enums which apparently are easier to read if
formatted with one element per line.

llvm-svn: 223367

9 years agoFix a minor regression introduced in r223113
Asiri Rathnayake [Thu, 4 Dec 2014 14:49:07 +0000 (14:49 +0000)]
Fix a minor regression introduced in r223113

r223113 added support for ARM modified immediate assembly syntax. That patch
has broken support for immediate expressions, as in:
    add r0, #(4 * 4)
It wasn't caught because we don't have any tests for this feature. This patch
fixes this regression and adds test cases.

llvm-svn: 223366

9 years agoUse size_type in the interface exposed by SmallVector.
Rafael Espindola [Thu, 4 Dec 2014 14:40:35 +0000 (14:40 +0000)]
Use size_type in the interface exposed by SmallVector.

This matches std::vector and should avoid unnecessary masking to 32 bits
when calling them on o 64 bits system.

llvm-svn: 223365

9 years agoRevert r223347 which has caused crashes on bootstrap bots.
Alexander Potapenko [Thu, 4 Dec 2014 14:22:27 +0000 (14:22 +0000)]
Revert r223347 which has caused crashes on bootstrap bots.

llvm-svn: 223364

9 years agoRevert "[Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for...
Rafael Espindola [Thu, 4 Dec 2014 14:10:20 +0000 (14:10 +0000)]
Revert "[Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for PUSH/POP/LDM/STM. <Differential Revision: reviews.llvm.org/D6090>"

This reverts commit r223356.

It was failing check-all (MC/ARM/thumb.s in particular).

llvm-svn: 223363

9 years ago[X86] Improve a dag-combine that handles a vector extract -> zext sequence.
Michael Kuperstein [Thu, 4 Dec 2014 13:49:51 +0000 (13:49 +0000)]
[X86] Improve a dag-combine that handles a vector extract -> zext sequence.

The current DAG combine turns a sequence of extracts from <4 x i32> followed by zexts into a store followed by scalar loads.
According to measurements by Martin Krastev (see PR 21269) for x86-64, a sequence of an extract, movs and shifts gives better performance. However, for 32-bit x86, the previous sequence still seems better.

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

llvm-svn: 223360

9 years ago[ELF] Adjust ELF header entry symbol value if this symbol is microMIPS encoded
Simon Atanasyan [Thu, 4 Dec 2014 13:43:35 +0000 (13:43 +0000)]
[ELF] Adjust ELF header entry symbol value if this symbol is microMIPS encoded

To find an AtomLayout object for the given symbol I replace the
`Layout::findAtomAddrByName` method by `Layout::findAtomLayoutByName` method.

llvm-svn: 223359

9 years agoFix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
Faisal Vali [Thu, 4 Dec 2014 12:40:21 +0000 (12:40 +0000)]
Fix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
should indicate a c++ parameter pack not a c-variadic.

int i = [](auto...) { return 0; }(); // OK now.

llvm-svn: 223357

9 years ago[Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for PUSH/POP...
Jyoti Allur [Thu, 4 Dec 2014 11:52:49 +0000 (11:52 +0000)]
[Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for PUSH/POP/LDM/STM. <Differential Revision: reviews.llvm.org/D6090>

llvm-svn: 223356

9 years ago[msan] Put the coverage files for coverage-levels.cc into a temporary dir.
Alexander Potapenko [Thu, 4 Dec 2014 11:35:32 +0000 (11:35 +0000)]
[msan] Put the coverage files for coverage-levels.cc into a temporary dir.

llvm-svn: 223355

9 years ago[X86] Simplify code. NFC.
Andrea Di Biagio [Thu, 4 Dec 2014 11:21:44 +0000 (11:21 +0000)]
[X86] Simplify code. NFC.

Replaced some logic that checked if a build_vector node is doing a splat of a
non-undef value with a call to method BuildVectorSDNode::getSplatValue().
No functional change intended.

llvm-svn: 223354

9 years agoCleanup of the fix done recently for a lldb-mi hang on OSX.
Hafiz Abid Qadeer [Thu, 4 Dec 2014 11:05:31 +0000 (11:05 +0000)]
Cleanup of the fix done recently for a lldb-mi hang on OSX.
It was observed that we dont need to set stdin to unbuffered and setting console
to non-canonical mode.

Patch originally came from "Ilia K <ki.stfu@gmail.com>"

llvm-svn: 223353

9 years agoMake getInsertArgumentAdjuster insert extra arguments to the end by default.
Alexander Kornienko [Thu, 4 Dec 2014 11:00:56 +0000 (11:00 +0000)]
Make getInsertArgumentAdjuster insert extra arguments to the end by default.

llvm-svn: 223352

9 years agotest-release.sh: Correct the logged configure command to match the one actually issued.
Daniel Sanders [Thu, 4 Dec 2014 11:00:09 +0000 (11:00 +0000)]
test-release.sh: Correct the logged configure command to match the one actually issued.

--disable-timestamps was added to the configure command way back in r142647 but
the command that echos this command to the log was not updated at the time.

llvm-svn: 223351

9 years agoUse DomTree in MachineSink to sink over diamonds.
Patrik Hagglund [Thu, 4 Dec 2014 10:36:42 +0000 (10:36 +0000)]
Use DomTree in MachineSink to sink over diamonds.

According to a previous FIXME comment we now not only look at MBB
successors, but also handle code sinking past them:

  x = computation
  if () {} else {}
  use x

The instruction could be sunk over the whole diamond for the
if/then/else (or loop, etc), allowing it to be sunk into other blocks
after that.

Modified test added in r204522, due to one spill less present.

Minor fixes in comments.

Patch provided by Jonas Paulsson. Reviewed by Hal Finkel.

llvm-svn: 223350

9 years ago[InstCombine] Minor optimization for bswap with binary ops
Simon Pilgrim [Thu, 4 Dec 2014 09:44:01 +0000 (09:44 +0000)]
[InstCombine] Minor optimization for bswap with binary ops

Added instcombine optimizations for BSWAP with AND/OR/XOR ops:

OP( BSWAP(x), BSWAP(y) ) -> BSWAP( OP(x, y) )
OP( BSWAP(x), CONSTANT ) -> BSWAP( OP(x, BSWAP(CONSTANT) ) )

Since its just a one liner, I've also added BSWAP to the DAGCombiner equivalent as well:

fold (OP (bswap x), (bswap y)) -> (bswap (OP x, y))

Refactored bswap-fold tests to use FileCheck instead of just checking that the bswaps had gone.

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

llvm-svn: 223349

9 years agoMasked Load / Store Intrinsics - the CodeGen part.
Elena Demikhovsky [Thu, 4 Dec 2014 09:40:44 +0000 (09:40 +0000)]
Masked Load / Store Intrinsics - the CodeGen part.
I'm recommiting the codegen part of the patch.
The vectorizer part will be send to review again.

Masked Vector Load and Store Intrinsics.
Introduced new target-independent intrinsics in order to support masked vector loads and stores. The loop vectorizer optimizes loops containing conditional memory accesses by generating these intrinsics for existing targets AVX2 and AVX-512. The vectorizer asks the target about availability of masked vector loads and stores.
Added SDNodes for masked operations and lowering patterns for X86 code generator.
Examples:
<16 x i32> @llvm.masked.load.v16i32(i8* %addr, <16 x i32> %passthru, i32 4 /* align */, <16 x i1> %mask)
declare void @llvm.masked.store.v8f64(i8* %addr, <8 x double> %value, i32 4, <8 x i1> %mask)

Scalarizer for other targets (not AVX2/AVX-512) will be done in a separate patch.

http://reviews.llvm.org/D6191

llvm-svn: 223348

9 years agoRestrict somewhat the memory-allocation pointer cmp opt from r223093
Hal Finkel [Thu, 4 Dec 2014 09:22:28 +0000 (09:22 +0000)]
Restrict somewhat the memory-allocation pointer cmp opt from r223093

Based on review comments from Richard Smith, restrict this optimization from
applying to globals that might resolve lazily to other dynamically-loaded
modules, and also from dynamic allocas (which might be transformed into malloc
calls). In short, take extra care that the compared-to pointer is really
simultaneously live with the memory allocation.

llvm-svn: 223347

9 years agoAdd missing test file
Jean-Daniel Dupas [Thu, 4 Dec 2014 09:20:13 +0000 (09:20 +0000)]
Add missing test file

llvm-svn: 223346

9 years agoclang-format: More restrictively classify import declarations.
Daniel Jasper [Thu, 4 Dec 2014 08:57:27 +0000 (08:57 +0000)]
clang-format: More restrictively classify import declarations.

Before:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                       aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 223345

9 years agoclang-formatted ranged loops and assignment, NFC.
Yaron Keren [Thu, 4 Dec 2014 08:30:39 +0000 (08:30 +0000)]
clang-formatted ranged loops and assignment, NFC.

llvm-svn: 223344

9 years agoAdd mach-o LC_RPATH support to llvm-objdump
Jean-Daniel Dupas [Thu, 4 Dec 2014 07:37:02 +0000 (07:37 +0000)]
Add mach-o LC_RPATH support to llvm-objdump

Summary: Add rpath load command support in Mach-O object and update llvm-objdump to use it.

Subscribers: llvm-commits

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

llvm-svn: 223343

9 years ago[OPENMP] Codegen for 'omp master' directive
Alexey Bataev [Thu, 4 Dec 2014 07:23:53 +0000 (07:23 +0000)]
[OPENMP] Codegen for 'omp master' directive
Patch adds 2 library functions to OpenMPRuntime class - int32 kmpc_master(ident_t *, int32 gtid) and void kmpc_end_master(ident_t *, int32 gtid);
For 'omp master' directive the next code is generated:

if (__kmpc_master(loc, gtid)) {
    <Associated structured block>;
      __kmpc_end_master(log, gtid);
}

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

llvm-svn: 223342

9 years ago[PECOFF] Improve /export compatibility.
Rui Ueyama [Thu, 4 Dec 2014 06:09:39 +0000 (06:09 +0000)]
[PECOFF] Improve /export compatibility.

Looks like the rule of /export is more complicated than
I was thinking. If /export:foo, for example, is given, and
if the actual symbol name in an object file is _foo@<number>,
we need to export that symbol as foo, not as the mangled name.

If only /export:_foo@<number> is given, the symbol is exported
as _foo@<number>.

If both /export:foo and /export:_foo@<number> are given,
they are considered as duplicates, and the linker needs to
choose the unmangled name.

The basic idea seems that the linker needs to export a symbol
with the same name as given as /export.

We exported mangled symbols. This patch fixes that issue.

llvm-svn: 223341

9 years agoAlways emit kernel arg info for SPIR.
Sameer Sahasrabuddhe [Thu, 4 Dec 2014 05:30:58 +0000 (05:30 +0000)]
Always emit kernel arg info for SPIR.

http://llvm.org/bugs/show_bug.cgi?id=21555

Currently, kernel argument metadata is omitted unless the
"-cl-kernel-arg-info" option is specified. But the SPIR 1.2 spec
requires that all metadata except kernel_arg_name should always be
emitted, and kernel_arg_name is only emitted when
"-cl-kernel-arg-info" is specified.

Patch ported by Ryan Burn from the Khronos SPIR generator.
https://github.com/KhronosGroup/SPIR

llvm-svn: 223340

9 years ago[X86] Clean up whitespace as well as minor coding style
Michael Liao [Thu, 4 Dec 2014 05:20:33 +0000 (05:20 +0000)]
[X86] Clean up whitespace as well as minor coding style

llvm-svn: 223339