Commit Graph

188341 Commits

Author SHA1 Message Date
Will Newton 0b7f842592 ELF: Use ELF reloc .def files to reduce duplication
Tested with check-lld with no regressions.

llvm-svn: 223462
2014-12-05 12:43:26 +00:00
Andrea Di Biagio 2876a67312 [X86] Avoid introducing extra shuffles when lowering packed vector shifts.
When lowering a vector shift node, the backend checks if the shift count is a
shuffle with a splat mask. If so, then it introduces an extra dag node to
extract the splat value from the shuffle. The splat value is then used
to generate a shift count of a target specific shift.

However, if we know that the shift count is a splat shuffle, we can use the
splat index 'I' to extract the I-th element from the first shuffle operand.
The advantage is that the splat shuffle may become dead since we no longer
use it.

Example:

;;
define <4 x i32> @example(<4 x i32> %a, <4 x i32> %b) {
  %c = shufflevector <4 x i32> %b, <4 x i32> undef, <4 x i32> zeroinitializer
  %shl = shl <4 x i32> %a, %c
  ret <4 x i32> %shl
}
;;

Before this patch, llc generated the following code (-mattr=+avx):
  vpshufd $0, %xmm1, %xmm1   # xmm1 = xmm1[0,0,0,0]
  vpxor  %xmm2, %xmm2
  vpblendw $3, %xmm1, %xmm2, %xmm1 # xmm1 = xmm1[0,1],xmm2[2,3,4,5,6,7]
  vpslld %xmm1, %xmm0, %xmm0
  retq

With this patch, the redundant splat operation is removed from the code.
  vpxor  %xmm2, %xmm2
  vpblendw $3, %xmm1, %xmm2, %xmm1 # xmm1 = xmm1[0,1],xmm2[2,3,4,5,6,7]
  vpslld %xmm1, %xmm0, %xmm0
  retq

llvm-svn: 223461
2014-12-05 12:13:30 +00:00
Alexander Kornienko bc0c423a46 [clang-tidy] Add clang-tidy check for unique_ptr's reset+release -> move
Replace x.reset(y.release()); with x = std::move(y);
If y is rvalue, replace with x = y; instead.

http://reviews.llvm.org/D6485

Patch by Alexey Sokolov!

llvm-svn: 223460
2014-12-05 11:59:05 +00:00
Daniel Jasper 31f6c54733 clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.
This fixes llvm.org/PR21756.

llvm-svn: 223458
2014-12-05 10:42:21 +00:00
Dmitry Vyukov bf253a3d3f tsan: protect trace memory range on startup
so that user does not map something there ahead of us

llvm-svn: 223456
2014-12-05 10:06:06 +00:00
David Majnemer 153c3948f1 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
2014-12-05 08:56:55 +00:00
Charlie Turner c96e95c157 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
2014-12-05 08:22:47 +00:00
David Majnemer 8de6864146 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
2014-12-05 08:11:58 +00:00
Stephane Sezer 7a1d22a2af 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
2014-12-05 05:02:41 +00:00
Alexey Bataev 39bd119842 [OPENMP] Test for 'omp barrier' directive
llvm-svn: 223445
2014-12-05 04:10:27 +00:00
Alexey Bataev 8f7c1b0b9d [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
2014-12-05 04:09:23 +00:00
Richard Smith 1d21a07ca1 [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
2014-12-05 02:33:27 +00:00
Hal Finkel 66d7791176 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
2014-12-05 02:07:35 +00:00
Vince Harron 41b3f630d7 Reverting r223423, test timeout
Was causing dosep to hang in some cases.

llvm-svn: 223441
2014-12-05 02:06:03 +00:00
Hal Finkel d013d99fe0 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
2014-12-05 01:57:22 +00:00
Duncan P. N. Exon Smith 024360e4bc ADT: Remove GetStringMapEntryFromValue()
It relies on undefined behaviour, since `StringMapEntry<>` is not
a standard layout type.  There are no users anyway.

llvm-svn: 223439
2014-12-05 01:41:36 +00:00
Duncan P. N. Exon Smith c1a664fea2 IR: Stop relying on GetStringMapEntryFromValue()
It relies on undefined behaviour.

llvm-svn: 223438
2014-12-05 01:41:34 +00:00
Sean Callanan 221262996a 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
2014-12-05 01:31:55 +00:00
Sean Callanan c8278afc9f Changes to the expression parser to actually use
the types that we find in Clang modules.

llvm-svn: 223436
2014-12-05 01:27:35 +00:00
Sean Callanan c631b64fab Additional changes required by r223433.
llvm-svn: 223435
2014-12-05 01:26:42 +00:00
Sean Callanan 99214ab599 Removed a stray directory.
llvm-svn: 223434
2014-12-05 01:22:25 +00:00
Sean Callanan 9998acd004 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
2014-12-05 01:21:59 +00:00
Sean Callanan 47aed6365f Added the LLDB enumeration necessary to find the
Clang headers directory.  Needed by r223430.

llvm-svn: 223432
2014-12-05 01:17:47 +00:00
Sean Callanan 5dc2981cf8 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
2014-12-05 01:16:31 +00:00
Sean Callanan b1e1c62fac 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
2014-12-05 01:15:04 +00:00
Eric Christopher 0e2618857c 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
2014-12-05 01:06:59 +00:00
Adrian Prantl ab255fcd09 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
2014-12-05 01:02:46 +00:00
Adrian Prantl c29be67009 Add a comment.
llvm-svn: 223427
2014-12-05 01:02:36 +00:00
Anton Yartsev a466a93ffe [analyzer] Eliminated endless loop.
llvm-svn: 223426
2014-12-05 00:59:07 +00:00
Paul Robinson 56a31a304d 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
2014-12-05 00:50:15 +00:00
Rafael Espindola 3124ed4b23 linkGlobalVariableProto never returns null. Simplify the caller. NFC.
llvm-svn: 223424
2014-12-05 00:30:47 +00:00
Vince Harron de0d41fb4d 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
2014-12-05 00:23:03 +00:00
Eric Christopher 610952e0d5 Use isOSBinFormatMachO() instead of comparing the object format
against an enum.

llvm-svn: 223422
2014-12-05 00:22:48 +00:00
Eric Christopher 2189515132 Rename the x86 isTargetMacho to isTargetMachO for uniformity.
llvm-svn: 223421
2014-12-05 00:22:38 +00:00
Eric Christopher 66322e822c Both of these subtargets have functions that check whether or
not the target is mach-o. Use them.

llvm-svn: 223420
2014-12-05 00:22:35 +00:00
Sergey Matveev b029c5101f [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
2014-12-05 00:10:15 +00:00
Rafael Espindola 439835a6fe Move merging of alignment to a central location. NFC.
llvm-svn: 223418
2014-12-05 00:09:02 +00:00
Rafael Espindola 8da0a5b876 Add a few extra cases to the test. NFC.
llvm-svn: 223417
2014-12-05 00:02:42 +00:00
Kevin Enderby ef3ad2ff32 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
2014-12-04 23:56:27 +00:00
Ahmed Bougacha 24ebb93da1 [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
2014-12-04 23:52:15 +00:00
Rafael Espindola 3dcdb8d285 Convert test to use an extra Input file. NFC.
llvm-svn: 223414
2014-12-04 23:31:21 +00:00
Nico Rieck eaaae27bc5 Parse qualifiers after comma in declarator lists as a Microsoft extension
MSVC parses and ignores these with a warning.

llvm-svn: 223413
2014-12-04 23:31:08 +00:00
Nico Rieck 3e1ee83626 Recognize __unaligned keyword after type specifier
The __unaligned keyword can appear after a struct definition:

  struct foo {...} __unaligned *x;

llvm-svn: 223412
2014-12-04 23:30:25 +00:00
Rui Ueyama c2576d5464 Remove extra semicolon.
llvm-svn: 223411
2014-12-04 23:26:11 +00:00
Alexey Samsonov 4c79708a34 Revert "Fix UBSan report in StringMap implementation."
This reverts commit r223402. Some bots fail with -Winvalid-offsetof
warning.

llvm-svn: 223407
2014-12-04 23:00:50 +00:00
Adrian Prantl da7e03f1bf Simplify implementation and testcase of r223401 based on feedback from dblaikie.
llvm-svn: 223405
2014-12-04 22:58:41 +00:00
Aaron Ballman be243a70e3 Adding a FIXME to the code, based on a discussion in IRC; NFC.
llvm-svn: 223403
2014-12-04 22:45:31 +00:00
Alexey Samsonov 36b525feb0 Fix UBSan report in StringMap implementation.
Use offsetof() instead of a member access within null pointer.

llvm-svn: 223402
2014-12-04 22:45:31 +00:00
Adrian Prantl a3ae0b3b5b 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
2014-12-04 22:29:04 +00:00
Eric Christopher e9a36eab1e Fix a bunch of -Winconsistent-missing-override warnings.
llvm-svn: 223400
2014-12-04 22:26:07 +00:00