platform/upstream/llvm.git
9 years agoDebugInfo: Prepare for deletion of DIScope
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 18:32:15 +0000 (18:32 +0000)]
DebugInfo: Prepare for deletion of DIScope

An upcoming LLVM commit will delete `DIScope`, so update users to
`MDScope*`.

llvm-svn: 235326

9 years ago[Orc] Use the 64-bit versions of FXSAVE/FXRSTOR for JIT reentry.
Lang Hames [Mon, 20 Apr 2015 18:25:44 +0000 (18:25 +0000)]
[Orc] Use the 64-bit versions of FXSAVE/FXRSTOR for JIT reentry.

llvm-svn: 235325

9 years agoAdd targets to cmake for specific target components.
Pete Cooper [Mon, 20 Apr 2015 18:22:05 +0000 (18:22 +0000)]
Add targets to cmake for specific target components.

This adds the following targets to cmake.  These can be used to build and link only specific parts of a backend, instead of having to link the whole backend.

- AllTargetsAsmPrinters, AllTargetsAsmParsers, AllTargetsDescs, AllTargetsDisassemblers, AllTargetsInfos

A typical use for these is instead of linking ${LLVM_TARGETS_TO_BUILD}.  This commit changes llvm-mc to show how to use the new targets.

Reviewed by Chris Bieneman.

llvm-svn: 235324

9 years agoDebugInfo: Remove typedefs for DITypeRef, etc.
Duncan P. N. Exon Smith [Mon, 20 Apr 2015 18:20:03 +0000 (18:20 +0000)]
DebugInfo: Remove typedefs for DITypeRef, etc.

Remove typedefs for type refs:

  - DITypeRef => MDTypeRef
  - DIScopeRef => MDScopeRef
  - DIDescriptorRef => DebugNodeRef

llvm-svn: 235323

9 years agoConnectionFileDescriptor::BytesAvailable reading too many command bytes
Vince Harron [Mon, 20 Apr 2015 18:15:33 +0000 (18:15 +0000)]
ConnectionFileDescriptor::BytesAvailable reading too many command bytes

ConnectionFileDescriptor::BytesAvailable was reading multiple command
bytes from the command pipe but only processing the first. This
change only allows one byte to be read at a time, ensuring that all
get handled.

This isn't known to cause any bugs, but it might cause current/future
bugs.

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

llvm-svn: 235322

9 years ago[mips][microMIPSr6] Implement BITSWAP instruction
Jozef Kolek [Mon, 20 Apr 2015 18:14:59 +0000 (18:14 +0000)]
[mips][microMIPSr6] Implement BITSWAP instruction

Implement BITSWAP instruction using mapping.

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

llvm-svn: 235321

9 years agoAllow specifying tool path/prefix for tests with CROSS_COMPILE.
Robert Flack [Mon, 20 Apr 2015 18:07:55 +0000 (18:07 +0000)]
Allow specifying tool path/prefix for tests with CROSS_COMPILE.

CROSS_COMPILE environment variable is a common convention to specify the path
and/or prefix to cross compilation tools (e.g. ar, objcopy).

Test Plan:
dotest.py $DOTEST_OPTS -t -p 'TestBSDArchives.py|TestBreakpointCommandsFromPython.py|TestFormats.py|TestObjCDynamicValue.py'
All of these tests now compile successfully and pass running macosx -> linux
using a cross compilation toolchain prefixed by CROSS_COMPILE without requiring
changing your PATH. They still pass when run locally on macosx.

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

llvm-svn: 235320

9 years ago[AArch64] LORID_EL1 register must be treated as read-only
Vladimir Sukharev [Mon, 20 Apr 2015 16:54:37 +0000 (16:54 +0000)]
[AArch64] LORID_EL1 register must be treated as read-only

Patch by: John Brawn

Reviewers: jmolloy

Subscribers: llvm-commits

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

llvm-svn: 235314

9 years agoThis patch implements several improvements to the
Sean Callanan [Mon, 20 Apr 2015 16:31:29 +0000 (16:31 +0000)]
This patch implements several improvements to the
module-loading support for the expression parser.

- It adds support for auto-loading modules referred
  to by a compile unit.  These references are
  currently in the form of empty translation units.
  This functionality is gated by the setting

  target.auto-import-clang-modules (boolean) = false

- It improves and corrects support for loading
  macros from modules, currently by textually
  pasting all #defines into the user's expression.
  The improvements center around including only those
  modules that are relevant to the current context -
  hand-loaded modules and the modules that are imported
  from the current compile unit.

- It adds an "opt-in" mechanism for all of this
  functionality.  Modules have to be explicitly
  imported (via @import) or auto-loaded (by enabling
  the above setting) to enable any of this
  functionality.

It also adds support to the compile unit and symbol
file code to deal with empty translation units that
indicate module imports, and plumbs this through to
the CompileUnit interface.

Finally, it makes the following changes to the test
suite:

- It adds a testcase that verifies that modules are
  automatically loaded when the appropriate setting
  is enabled (lang/objc/modules-auto-import); and

- It modifies lanb/objc/modules-incomplete to test
  the case where a module #undefs something that is
  #defined in another module.

<rdar://problem/20299554>

llvm-svn: 235313

9 years ago[InlineFunction] Don't add lifetime markers for zero-sized allocas.
Akira Hatanaka [Mon, 20 Apr 2015 16:11:05 +0000 (16:11 +0000)]
[InlineFunction] Don't add lifetime markers for zero-sized allocas.

This commit fixes the code which adds lifetime markers in InlineFunction to skip
zero-sized allocas instead of asserting on them.

rdar://problem/20531155

llvm-svn: 235312

9 years agoRecognize n/1 in the SCEV divide function
Brendon Cahoon [Mon, 20 Apr 2015 16:03:28 +0000 (16:03 +0000)]
Recognize n/1 in the SCEV divide function

n/1 generates a quotient equal to n and a remainder of 0.
If this case is not recognized, then the SCEV divide() function
can return a remainder that is greater than or equal to the
denominator, which means the delinearized subscripts for the
test case will be incorrect.

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

llvm-svn: 235311

9 years ago[PowerPC] Flow oversized lines for r235309
Bill Schmidt [Mon, 20 Apr 2015 15:58:46 +0000 (15:58 +0000)]
[PowerPC] Flow oversized lines for r235309

llvm-svn: 235310

9 years ago[PowerPC] Add future work for vector insert/extract to README_ALTIVEC.txt
Bill Schmidt [Mon, 20 Apr 2015 15:54:26 +0000 (15:54 +0000)]
[PowerPC] Add future work for vector insert/extract to README_ALTIVEC.txt

llvm-svn: 235309

9 years ago[mips][microMIPSr6] Implement disassembler support
Jozef Kolek [Mon, 20 Apr 2015 14:40:38 +0000 (14:40 +0000)]
[mips][microMIPSr6] Implement disassembler support

Implement disassembler support for microMIPS32r6.

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

llvm-svn: 235307

9 years agoFreeBSD/arm core file support
Ed Maste [Mon, 20 Apr 2015 13:58:19 +0000 (13:58 +0000)]
FreeBSD/arm core file support

Patch by Andrew Turner, with minor edits. XCode changes are mine; please
update if necessary.

llvm-svn: 235305

9 years agoNativeProcessLinux: Merge operation and monitor threads
Pavel Labath [Mon, 20 Apr 2015 13:53:49 +0000 (13:53 +0000)]
NativeProcessLinux: Merge operation and monitor threads

Summary:
This commit moves the functionality of the operation thread into the new monitor thread. This is
required to avoid a kernel race between the two threads and I believe it actually makes the code
cleaner.

Test Plan: Ran the test suite a couple of times, no regressions.

Reviewers: ovyalov, tberghammer, vharron

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 235304

9 years agoDon't allow pwrite to resize a stream.
Rafael Espindola [Mon, 20 Apr 2015 13:04:30 +0000 (13:04 +0000)]
Don't allow pwrite to resize a stream.

The current implementations could exhibit some behavior differences:

raw_fd_ostream: Whatever the underlying fd does with seek+write. In a normal
file, the write position would be back to the old offset.

raw_svector_ostream: The write position is always the end of the stream, so
after pwrite the write position would be the new end. This matches what OS_X
(all BSD?) do with a pwrite in a O_APPEND fd.

Given that we don't need that feature and don't use O_APPEND a lot in LLVM,
just disallow it.

I am open to suggestions on renaming pwrite to something else, but this fixes
the issue for now.

Thanks to Yaron Keren for reporting it.

llvm-svn: 235303

9 years ago[mips][microMIPSr6] Implement BALC and BC instructions
Jozef Kolek [Mon, 20 Apr 2015 13:04:14 +0000 (13:04 +0000)]
[mips][microMIPSr6] Implement BALC and BC instructions

This patch implements BALC and BC instructions using mapping.

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

llvm-svn: 235302

9 years agoclang-format: Fix incorrect multi-var declstmt detection.
Daniel Jasper [Mon, 20 Apr 2015 12:54:29 +0000 (12:54 +0000)]
clang-format: Fix incorrect multi-var declstmt detection.

This is now obvious as the pointer alignment behavior was changed.

Before (even with pointer alignment "Left"):
  MACRO Constructor(const int &i) : a(a), b(b) {}

After:
  MACRO Constructor(const int& i) : a(a), b(b) {}

llvm-svn: 235301

9 years agoLook past locals in comdats.
Rafael Espindola [Mon, 20 Apr 2015 12:44:06 +0000 (12:44 +0000)]
Look past locals in comdats.

We have to avoid converting a reference to a global into a reference to a local,
but it is fine to look past a local.

Patch by Vasileios Kalintiris.

I just moved the comment and added thet test.

llvm-svn: 235300

9 years ago[mips] Support building compiler-rt with gcc.
Daniel Sanders [Mon, 20 Apr 2015 12:44:01 +0000 (12:44 +0000)]
[mips] Support building compiler-rt with gcc.

Summary:
This will allow us to enable it on the buildbot (and then enable a
sanitizer buildbot).

The problem is that gcc for Mips does not accept -m32/-m64 like clang does.
We therefore need to use the nearest equivalent -mips32r2/-mips64r2. We must
also specify -mabi=64 in the -mips64r2 case since gcc's default ABI has
traditionally been N32 whereas clang's is N64.

Reviewers: sagar

Reviewed By: sagar

Subscribers: llvm-commits, samsonov, kcc, mohit.bhakkad, Anand.Takale, sagar

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

llvm-svn: 235299

9 years ago[mips][microMIPSr6] Implement initial mapping support
Jozef Kolek [Mon, 20 Apr 2015 12:42:08 +0000 (12:42 +0000)]
[mips][microMIPSr6] Implement initial mapping support

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

llvm-svn: 235298

9 years ago[Asan] Link lit tests shared libraries with -Wl,z,origin on FreeBSD
Viktor Kutuzov [Mon, 20 Apr 2015 12:25:11 +0000 (12:25 +0000)]
[Asan] Link lit tests shared libraries with -Wl,z,origin on FreeBSD
Differential Revision: http://reviews.llvm.org/D8834

llvm-svn: 235297

9 years ago[mips][microMIPSr6] Implement initial subtarget support
Jozef Kolek [Mon, 20 Apr 2015 12:23:06 +0000 (12:23 +0000)]
[mips][microMIPSr6] Implement initial subtarget support

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

llvm-svn: 235296

9 years ago[X86][FastIsel] Fix assertion failure when selecting int-to-double conversion (PR23273).
Andrea Di Biagio [Mon, 20 Apr 2015 11:56:59 +0000 (11:56 +0000)]
[X86][FastIsel] Fix assertion failure when selecting int-to-double conversion (PR23273).

This fixes a regression introduced at revision 231243.
The target-independent selection algorithm in FastISel knows how to select
a SINT_TO_FP if the target is SSE but not AVX. That is because on X86, the
tablegen'd 'fastEmit' functions know how to select CVTSI2SSrr and CVTSI2SDrr.

Method X86FastISel::X86SelectSIToFP was therefore working under the
wrong assumption that the target was AVX. That assumption was incorrect since
we can have a target that is neither AVX nor SSE.

So, rather than asserting for the presence of AVX, we should have had an
early exit from 'X86SelectSIToFP' if the target was not AVX.
This patch fixes the issue replacing the invalid assertion with an early exit.

Thanks to Dimitry Andric for reporting this problem and for providing a small
reproducible testcase. Added test pr23273.ll.

llvm-svn: 235295

9 years agotsan: deflake a test
Dmitry Vyukov [Mon, 20 Apr 2015 10:35:21 +0000 (10:35 +0000)]
tsan: deflake a test

llvm-svn: 235294

9 years agotsan: fix handling of pthread_detach
Dmitry Vyukov [Mon, 20 Apr 2015 10:35:10 +0000 (10:35 +0000)]
tsan: fix handling of pthread_detach

Fixes https://llvm.org/bugs/show_bug.cgi?id=23235

If pthread_create is followed by pthread_detach,
the new thread may not acquire synchronize with
the parent thread.

llvm-svn: 235293

9 years agoAuto advance pc for signle stepping on arm when emulation failes
Tamas Berghammer [Mon, 20 Apr 2015 10:31:22 +0000 (10:31 +0000)]
Auto advance pc for signle stepping on arm when emulation failes

The arm instruction emulation handles only some of the opcode (including
all of them modifying the PC). For the rest of the instructions we can
advance the PC by the size of the instruction as they don't modify the
PC on any other way.

Differential revision: http://reviews.llvm.org/D9076

llvm-svn: 235292

9 years agoStop read thread of Communication on EOF
Tamas Berghammer [Mon, 20 Apr 2015 09:52:47 +0000 (09:52 +0000)]
Stop read thread of Communication on EOF

Previously the read thread was only stopped if CloseOnEOF was set on the
communication channel. It caused it to spin in case of an EOF because
::select() always reported that we can read from the file descriptor.
This CL change this behavior with stopping the read thread on EOF but do
a disconnect only if CloseOnEOF is enabled.

Differential revision: http://reviews.llvm.org/D9077

llvm-svn: 235291

9 years ago[Mips] Write DT_MIPS_OPTIONS tag to .dynamic section
Simon Atanasyan [Mon, 20 Apr 2015 07:36:27 +0000 (07:36 +0000)]
[Mips] Write DT_MIPS_OPTIONS tag to .dynamic section

If .MIPS.options section exists the DT_MIPS_OPTIONS tag should hold
an address of this section.

llvm-svn: 235290

9 years ago[Mips] Support R_MICROMIPS_PC18_S3/PC19_S2/PC21_S2/PC26_S2 relocations handling
Simon Atanasyan [Mon, 20 Apr 2015 07:34:52 +0000 (07:34 +0000)]
[Mips] Support R_MICROMIPS_PC18_S3/PC19_S2/PC21_S2/PC26_S2 relocations handling

llvm-svn: 235289

9 years ago[Mips] Support R_MICROMIPS_GOT_DISP / PAGE / OFST relocations handling
Simon Atanasyan [Mon, 20 Apr 2015 07:33:02 +0000 (07:33 +0000)]
[Mips] Support R_MICROMIPS_GOT_DISP / PAGE / OFST relocations handling

llvm-svn: 235288

9 years agoFix buildbot failure on darwin from r235284.
Karthik Bhat [Mon, 20 Apr 2015 07:07:10 +0000 (07:07 +0000)]
Fix buildbot failure on darwin from r235284.

llvm-svn: 235287

9 years agoFix bug in Replacement's toString on Windows (missing flush).
Manuel Klimek [Mon, 20 Apr 2015 06:58:56 +0000 (06:58 +0000)]
Fix bug in Replacement's toString on Windows (missing flush).

Adapt function to LLVM coding style.

llvm-svn: 235286

9 years ago[Mips] Support DT_MIPS_OPTIONS dynamic section tag in the llvm-readobj
Simon Atanasyan [Mon, 20 Apr 2015 05:34:48 +0000 (05:34 +0000)]
[Mips] Support DT_MIPS_OPTIONS dynamic section tag in the llvm-readobj

llvm-svn: 235285

9 years ago[NFC] Refactor identification of reductions as common utility function.
Karthik Bhat [Mon, 20 Apr 2015 04:38:33 +0000 (04:38 +0000)]
[NFC] Refactor identification of reductions as common utility function.
This patch refactors reduction identification code out of LoopVectorizer and
exposes them as common utilities.
No functional change.
Review: http://reviews.llvm.org/D9046

llvm-svn: 235284

9 years ago[InlineAsm] Remove EarlyClobber on registers that are also inputs
Hal Finkel [Mon, 20 Apr 2015 00:01:30 +0000 (00:01 +0000)]
[InlineAsm] Remove EarlyClobber on registers that are also inputs

When an inline asm call has an output register marked as early-clobber, but
that same register is also an input operand, what should we do? GCC accepts
this, and is documented to accept this for read/write operands saying,
"Furthermore, if the earlyclobber operand is also a read/write operand, then
that operand is written only after it's used." For write-only operands, the
situation seems less clear, but I have at least one existing codebase that
assumes this will work, in part because it has syscall macros like this:

({                                                                         \
  register uint64_t r0 __asm__ ("r0") = (__NR_ ## name);                   \
  register uint64_t r3 __asm__ ("r3") = ((uint64_t) (arg0));               \
  register uint64_t r4 __asm__ ("r4") = ((uint64_t) (arg1));               \
  register uint64_t r5 __asm__ ("r5") = ((uint64_t) (arg2));               \
  __asm__ __volatile__                                                     \
  ("sc"                                                                    \
   : "=&r"(r0),"=&r"(r3),"=&r"(r4),"=&r"(r5)                               \
   :   "0"(r0),  "1"(r3),  "2"(r4),  "3"(r5)                               \
   : "r6","r7","r8","r9","r10","r11","r12","cr0","memory");                \
  r3;                                                                      \
})

Furthermore, with register aliases and subregister relationships that only the
backend knows about, rejecting this in the frontend seems like a difficult
proposition (if we wanted to do so). However, keeping the early-clobber flag on
the INLINEASM MI does not work for us, because it will cause the register's
live interval to end to soon (so it will not appear defined to be used as an
input).

Fortunately, fixing this does not seem hard: When forming the INLINEASM MI,
check to see if any of the early-clobber outputs are also inputs, and if so,
remove the early-clobber flag.

llvm-svn: 235283

9 years agoAccept --dynamic-linker <file>.
Davide Italiano [Sun, 19 Apr 2015 23:45:41 +0000 (23:45 +0000)]
Accept --dynamic-linker <file>.

Before we only accepted --dynamic-linker=<file> and -dynamic-linker <file>
but older versions of GNU ld (e.g. 2.17.50) accept this other form, so
try to be compatible.

PR: 23233
llvm-svn: 235282

9 years ago[X86][SSE] Fix for getScalarValueForVectorElement to detect scalar sources requiring...
Simon Pilgrim [Sun, 19 Apr 2015 22:16:49 +0000 (22:16 +0000)]
[X86][SSE] Fix for getScalarValueForVectorElement to detect scalar sources requiring truncation.

The fix ensures that scalar sources inserted into a vector are the correct bit size.

Integer scalar sources from BUILD_VECTOR and SCALAR_TO_VECTOR nodes may require truncation that this function doesn't currently support.

llvm-svn: 235281

9 years agoFix LLDB ARM GCC4.7 broken build
Omair Javaid [Sun, 19 Apr 2015 21:36:06 +0000 (21:36 +0000)]
Fix LLDB ARM GCC4.7 broken build

llvm-svn: 235280

9 years ago[X86][SSE] Extended copysign tests to include llvm intrinsic implementation and const...
Simon Pilgrim [Sun, 19 Apr 2015 21:34:57 +0000 (21:34 +0000)]
[X86][SSE] Extended copysign tests to include llvm intrinsic implementation and constant folding.

llvm-svn: 235279

9 years ago[mips] Update MIPS relocations list
Simon Atanasyan [Sun, 19 Apr 2015 20:51:55 +0000 (20:51 +0000)]
[mips] Update MIPS relocations list

No functional changes.

llvm-svn: 235278

9 years agoMake ubsan respect log_path
Hal Finkel [Sun, 19 Apr 2015 20:16:13 +0000 (20:16 +0000)]
Make ubsan respect log_path

As with the other sanitizers, it is desirable to allow ubsan's output to be
redirected to somewhere other than stderr (and into per-process log files).

llvm-svn: 235277

9 years ago[Sema] Check availability of ObjC super class and protocols of a container
Argyrios Kyrtzidis [Sun, 19 Apr 2015 20:15:55 +0000 (20:15 +0000)]
[Sema] Check availability of ObjC super class and protocols of a container
in the context of the container itself.

Otherwise we will emit 'unavailable' errors when referencing an unavailable super class
even though the subclass is also marked 'unavailable'.

rdar://20598702

llvm-svn: 235276

9 years agoCorrect machine type for 32-bit arm
Ed Maste [Sun, 19 Apr 2015 18:27:00 +0000 (18:27 +0000)]
Correct machine type for 32-bit arm

Reported by Andrew Turner.

llvm-svn: 235275

9 years agoRemove constexpr support for std::apply because it introduces regressions.
Eric Fiselier [Sun, 19 Apr 2015 15:32:52 +0000 (15:32 +0000)]
Remove constexpr support for std::apply because it introduces regressions.

llvm-svn: 235274

9 years agoUpdate isl to a6523fb42c35
Tobias Grosser [Sun, 19 Apr 2015 09:06:02 +0000 (09:06 +0000)]
Update isl to a6523fb42c35

A minor update mostly documenting the isl coding style as well as adding
functions to inspect isl_schedule_constraints objects.

llvm-svn: 235273

9 years ago[MS ABI] Correctly associate align attrs before the class-key
David Majnemer [Sun, 19 Apr 2015 07:53:29 +0000 (07:53 +0000)]
[MS ABI] Correctly associate align attrs before the class-key

__declspec(align(...)) is unlike all other attributes in that it is not
applied to a variable if it appears before the class-key.  If the
tag in question isn't part of a variable declaration, it is not ignored.

Instead, the alignment attribute is applied to the tag.

This fixes PR18024.

llvm-svn: 235272

9 years agoDependences: Allow to disable dependences computeout
Tobias Grosser [Sun, 19 Apr 2015 07:07:26 +0000 (07:07 +0000)]
Dependences: Allow to disable dependences computeout

llvm-svn: 235271

9 years agoInclude __mulodi4 in the 32-bit ARM versions of libclang_rt.cc_kext.a.
Bob Wilson [Sun, 19 Apr 2015 04:09:44 +0000 (04:09 +0000)]
Include __mulodi4 in the 32-bit ARM versions of libclang_rt.cc_kext.a.

This is needed when building the Darwin kernel with
-fsanitize=undefined-trap. rdar://problem/12783702

llvm-svn: 235270

9 years agoRemove the FCFI option from TargetOptions as it is currently unused.
Eric Christopher [Sun, 19 Apr 2015 03:21:08 +0000 (03:21 +0000)]
Remove the FCFI option from TargetOptions as it is currently unused.

llvm-svn: 235269

9 years agoRemove CFIFuncName from TargetOptions as it is currently unused.
Eric Christopher [Sun, 19 Apr 2015 03:21:04 +0000 (03:21 +0000)]
Remove CFIFuncName from TargetOptions as it is currently unused.

llvm-svn: 235268

9 years agoRemove the CFIEnforcing flag from TargetOptions as it is unused.
Eric Christopher [Sun, 19 Apr 2015 03:20:59 +0000 (03:20 +0000)]
Remove the CFIEnforcing flag from TargetOptions as it is unused.

llvm-svn: 235267

9 years agoRemove the CFIType TargetOption as it is unused.
Eric Christopher [Sun, 19 Apr 2015 03:20:55 +0000 (03:20 +0000)]
Remove the CFIType TargetOption as it is unused.

llvm-svn: 235266

9 years agoRemove the JITEmitDebugInfo TargetOptions as they're only set and
Eric Christopher [Sun, 19 Apr 2015 03:20:51 +0000 (03:20 +0000)]
Remove the JITEmitDebugInfo TargetOptions as they're only set and
not used anywhere in llvm.

llvm-svn: 235265

9 years agoTry to work around failure to convert this lambda to a function pointer in some versi...
Richard Smith [Sun, 19 Apr 2015 01:47:53 +0000 (01:47 +0000)]
Try to work around failure to convert this lambda to a function pointer in some versions of GCC.

llvm-svn: 235264

9 years ago[modules] Refactor macro emission. No functionality change.
Richard Smith [Sun, 19 Apr 2015 01:34:23 +0000 (01:34 +0000)]
[modules] Refactor macro emission. No functionality change.

llvm-svn: 235263

9 years agoRemove unnecessary include and probably a layering violation.
Craig Topper [Sun, 19 Apr 2015 00:57:33 +0000 (00:57 +0000)]
Remove unnecessary include and probably a layering violation.

llvm-svn: 235262

9 years ago[MemCpyOpt] Don't force i64 when promoting memset/memcpy sizes.
Ahmed Bougacha [Sat, 18 Apr 2015 23:06:04 +0000 (23:06 +0000)]
[MemCpyOpt] Don't force i64 when promoting memset/memcpy sizes.

Harden r235258 to support any integer bitwidth.  The quick glance at
the reference made me think only i32 and i64 were valid types, but
they're not special, so any overload is legal.

Thanks to David Majnemer for noticing!

llvm-svn: 235261

9 years ago[X86][AVX2] Force execution domain on broadcast folding tests.
Simon Pilgrim [Sat, 18 Apr 2015 21:24:16 +0000 (21:24 +0000)]
[X86][AVX2] Force execution domain on broadcast folding tests.

llvm-svn: 235260

9 years ago[X86][SSE] Force execution domain on float/double unpack shuffle tests.
Simon Pilgrim [Sat, 18 Apr 2015 18:50:55 +0000 (18:50 +0000)]
[X86][SSE] Force execution domain on float/double unpack shuffle tests.

llvm-svn: 235259

9 years ago[MemCpyOpt] Promote both memset/memcpy sizes if differently typed.
Ahmed Bougacha [Sat, 18 Apr 2015 17:57:41 +0000 (17:57 +0000)]
[MemCpyOpt] Promote both memset/memcpy sizes if differently typed.

Followup to r235232, which caused PR23278.

We can't assume the memset and memcpy sizes have the same type, as
nothing in the language reference prevents that.
Instead, zext both to i64 if they disagree.

While there, robustify tests by using i8 %c rather than i8 0 for the
memset character.

llvm-svn: 235258

9 years ago[InstCombine] Create zero constants on demand.
Benjamin Kramer [Sat, 18 Apr 2015 16:52:08 +0000 (16:52 +0000)]
[InstCombine] Create zero constants on demand.

No functional change intended.

llvm-svn: 235257

9 years agoDrop unused extern declaration
Tobias Grosser [Sat, 18 Apr 2015 15:57:56 +0000 (15:57 +0000)]
Drop unused extern declaration

llvm-svn: 235256

9 years agoRemove usages of host architecture within ELF object file for unknown parts of ArchSpec.
Oleksiy Vyalov [Sat, 18 Apr 2015 14:08:16 +0000 (14:08 +0000)]
Remove usages of host architecture within ELF object file for unknown parts of ArchSpec.

http://reviews.llvm.org/D9078

llvm-svn: 235255

9 years agoClear InsnToMemAcc map in ScopDetection after each runOnFunction
Tobias Grosser [Sat, 18 Apr 2015 11:01:25 +0000 (11:01 +0000)]
Clear InsnToMemAcc map in ScopDetection after each runOnFunction

Otherwise, instructions in different functions that share the same pointer (due
to earlier modifications), might get assigned incorrect memory access
information (belonging to instructions in previous functions), which can result
in arbitrary memory corruption and assertion failures.

This fixes llvm.org/PR23160 and possibly also llvm.org/PR23167.

Note: InsnToMemAcc is a global variable that should never have existed in the
first place. We will clean this up in a subsequent patch.

Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Debugged-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 235254

9 years agoMake helper function static. NFC.
Benjamin Kramer [Sat, 18 Apr 2015 10:00:10 +0000 (10:00 +0000)]
Make helper function static. NFC.

llvm-svn: 235253

9 years agoFix typo
Tobias Grosser [Sat, 18 Apr 2015 09:40:01 +0000 (09:40 +0000)]
Fix typo

llvm-svn: 235252

9 years ago[Sema] Don't crash if array bound calculation overflowed constexpr array
David Majnemer [Sat, 18 Apr 2015 04:55:51 +0000 (04:55 +0000)]
[Sema] Don't crash if array bound calculation overflowed constexpr array

We didn't correctly expect a QualifiedTypeLoc when faced with fixing a
variable array type into a constant array type.

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

llvm-svn: 235251

9 years ago[InstCombine] (mul nsw 1, INT_MIN) != (shl nsw 1, 31)
David Majnemer [Sat, 18 Apr 2015 04:41:30 +0000 (04:41 +0000)]
[InstCombine] (mul nsw 1, INT_MIN) != (shl nsw 1, 31)

Multiplying INT_MIN by 1 doesn't trigger nsw.  However, shifting 1 into
the sign bit *does* trigger nsw.

llvm-svn: 235250

9 years ago[GlobalMerge] Look at uses to create smaller global sets.
Ahmed Bougacha [Sat, 18 Apr 2015 01:21:58 +0000 (01:21 +0000)]
[GlobalMerge] Look at uses to create smaller global sets.

Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".

Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.

In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative.  Anything in-between isn't trivially
available, so stick with Function grouping for now.

cl::opts are added for testing; both enabled by default.

A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur.  Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.

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

llvm-svn: 235249

9 years agoDebugInfo: Delete DIDescriptor (but not its subclasses)
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:35:36 +0000 (00:35 +0000)]
DebugInfo: Delete DIDescriptor (but not its subclasses)

Delete `DIDescriptor` and update the remaining users.  I'll follow-up by
deleting subclasses in manageable groups (top-down).

llvm-svn: 235248

9 years ago[GNU/ELF] Add support for -x/--discard-all.
Davide Italiano [Sat, 18 Apr 2015 00:32:38 +0000 (00:32 +0000)]
[GNU/ELF] Add support for -x/--discard-all.

PR: 23232
llvm-svn: 235247

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:26:49 +0000 (00:26 +0000)]
Remove dead code, NFC

llvm-svn: 235246

9 years agoDebugInfo: Prepare for deletion of DIDescriptor
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:07:30 +0000 (00:07 +0000)]
DebugInfo: Prepare for deletion of DIDescriptor

Prepare for upcoming LLVM change to delete `DIDescriptor`.

llvm-svn: 235245

9 years agodocs: Update Kaleidoscope for recent DI changes
Duncan P. N. Exon Smith [Sat, 18 Apr 2015 00:01:35 +0000 (00:01 +0000)]
docs: Update Kaleidoscope for recent DI changes

This has been bit-rotting, so fix it up.  I'll have to edit this again
once the MD* classes have been renamed to DI* -- I'll try to remember to
do that with the commit that renames them.

llvm-svn: 235244

9 years ago[AArch64] Don't force MVT::Untyped when selecting LD1LANEpost.
Ahmed Bougacha [Fri, 17 Apr 2015 23:43:33 +0000 (23:43 +0000)]
[AArch64] Don't force MVT::Untyped when selecting LD1LANEpost.

The result is either an Untyped reg sequence, on ldN with N > 1, or
just the type of the input vector, on ld1.  Don't force Untyped.
Instead, just use the type of the reg sequence.

This mirrors the behavior of createTuple, which feeds the LD1*_POST.

The narrow code path wasn't actually covered by tests, because V64
insert_vector_elt are widened to V128 before the LD1LANEpost combine
has the chance to run, usually.

The only case where it does run on V64 vectors is if the vector ops
legalizer ran.  So, tickle the code with a ctpop.

Fixes PR23265.

llvm-svn: 235243

9 years agoFix another typo in r235224 testcase. NFC.
Ahmed Bougacha [Fri, 17 Apr 2015 23:38:46 +0000 (23:38 +0000)]
Fix another typo in r235224 testcase.  NFC.

Third time's the charm!

llvm-svn: 235242

9 years agoFix build wanrings and line endings
Andrew Kaylor [Fri, 17 Apr 2015 23:20:24 +0000 (23:20 +0000)]
Fix build wanrings and line endings

llvm-svn: 235241

9 years agoDebugInfo: Remove DIDescriptor from the DebugInfo API
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 23:20:10 +0000 (23:20 +0000)]
DebugInfo: Remove DIDescriptor from the DebugInfo API

Stop using `DIDescriptor` and its subclasses in the `DebugInfoFinder`
API, as well as the rest of the API hanging around in `DebugInfo.h`.

llvm-svn: 235240

9 years ago[WinEH] Fixes for a few cppeh failures.
Andrew Kaylor [Fri, 17 Apr 2015 23:05:43 +0000 (23:05 +0000)]
[WinEH] Fixes for a few cppeh failures.

Differential Review: http://reviews.llvm.org/D9065

llvm-svn: 235239

9 years ago[LoopAccesses] Improve debug output
Adam Nemet [Fri, 17 Apr 2015 22:43:10 +0000 (22:43 +0000)]
[LoopAccesses] Improve debug output

llvm-svn: 235238

9 years ago[PDB] Support executables and source/line info.
Zachary Turner [Fri, 17 Apr 2015 22:40:36 +0000 (22:40 +0000)]
[PDB] Support executables and source/line info.

Previously DebugInfoPDB could only load data for a PDB given a
path to the PDB.  It could not open an EXE and find the matching
PDB and verify it matched, etc.  This patch adds support for that
so that we can simply load debug information for a PDB directly.

Additionally, this patch extends DebugInfoPDB to support getting
source and line information for symbols.

llvm-svn: 235237

9 years ago[opaque pointer type] Access the pointee of the result type from the GEP rather than...
David Blaikie [Fri, 17 Apr 2015 22:32:20 +0000 (22:32 +0000)]
[opaque pointer type] Access the pointee of the result type from the GEP rather than pulling it out of the pointer result type

The implementation of this GEP::getResultElementType will be refactored
to either rely on a member variable, or recompute the value from the
indicies (any preferences?).

llvm-svn: 235236

9 years ago[opaque pointer type] Query the GEP for its source element type directly rather than...
David Blaikie [Fri, 17 Apr 2015 22:32:17 +0000 (22:32 +0000)]
[opaque pointer type] Query the GEP for its source element type directly rather than finding it through the pointer type of the first operand in the Verifier

llvm-svn: 235235

9 years ago[opaque pointer type] Avoid creating (and then unwrapping) a pointer type to compute...
David Blaikie [Fri, 17 Apr 2015 22:32:16 +0000 (22:32 +0000)]
[opaque pointer type] Avoid creating (and then unwrapping) a pointer type to compute the result type of a GEP

llvm-svn: 235234

9 years ago[opaque pointer type] Use the parsed explicit pointee type when error-checking geps...
David Blaikie [Fri, 17 Apr 2015 22:32:13 +0000 (22:32 +0000)]
[opaque pointer type] Use the parsed explicit pointee type when error-checking geps during LL parsing

llvm-svn: 235233

9 years ago[MemCpyOpt] Optimize double-storing by memset+memcpy.
Ahmed Bougacha [Fri, 17 Apr 2015 22:20:57 +0000 (22:20 +0000)]
[MemCpyOpt] Optimize double-storing by memset+memcpy.

A common idiom in some code is to do the following:

  memset(dst, 0, dst_size);
  memcpy(dst, src, src_size);

Some of the memset is redundant; instead, we can do:

  memcpy(dst, src, src_size);
  memset(dst + src_size, 0,
         dst_size <= src_size ? 0 : dst_size - src_size);

Original patch by: Joel Jones
Differential Revision: http://reviews.llvm.org/D498

llvm-svn: 235232

9 years agoChange AArch64 i128 returns to use [2 x i64] when possible.
Pete Cooper [Fri, 17 Apr 2015 22:16:24 +0000 (22:16 +0000)]
Change AArch64 i128 returns to use [2 x i64] when possible.

Something like { void*, void * } would be passed to a function as a [2 x i64], but returned as an i128.  This patch unifies the 2 behaviours so that we also return it as a [2 x i64].

This is better for the quality of the IR, and the size of the final LLVM binary as we tend to want to insert/extract values from these types and do so with the insert/extract instructions is less IR than shifting, truncating, and or'ing values.

Reviewed by Tim Northover.

llvm-svn: 235231

9 years ago[LangRef] Remove redundant and inconsistent condition.
Sean Silva [Fri, 17 Apr 2015 21:58:55 +0000 (21:58 +0000)]
[LangRef] Remove redundant and inconsistent condition.

Just above, 'op2' is stated to be unsigned, so 'negative' doesn't make
sense (and is handled by "larger than" anyway). The descriptions for
lshr and ashr don't say 'negative or' either.

llvm-svn: 235230

9 years agoAsmPrinter: Create a unified .debug_loc stream
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 21:34:47 +0000 (21:34 +0000)]
AsmPrinter: Create a unified .debug_loc stream

This commit removes `DebugLocList` and replaces it with
`DebugLocStream`.

  - `DebugLocEntry` no longer contains its byte/comment streams.
  - The `DebugLocEntry` list for a variable/inlined-at pair is allocated
    on the stack, and released right after `DebugLocEntry::finalize()`
    (possible because of the refactoring in r231023).  Now, only one
    list is in memory at a time now.
  - There's a single unified stream for the `.debug_loc` section that
    persists, stored in the new `DebugLocStream` data structure.

The last point is important: this collapses the nested `SmallVector<>`s
from `DebugLocList` into unified streams.  We previously had something
like the following:

    vec<tuple<Label, CU,
              vec<tuple<BeginSym, EndSym,
                        vec<Value>,
                        vec<char>,
                        vec<string>>>>>

A `SmallVector` can avoid allocations, but is statically fairly large
for a vector: three pointers plus the size of the small storage, which
is the number of elements in small mode times the element size).
Nesting these is expensive, since an inner vector's size contributes to
the element size of an outer one.  (Nesting any vector is expensive...)

In the old data structure, the outer vector's *element* size was 632B,
excluding allocation costs for when the middle and inner vectors
exceeded their small sizes.  312B of this was for the "three" pointers
in the vector-tree beneath it.  If you assume 1M functions with an
average of 10 variable/inlined-at pairs each (in an LTO scenario),
that's almost 6GB (besides inner allocations), with almost 3GB for the
"three" pointers.

This came up in a heap profile a little while ago of a `clang -flto -g`
bootstrap, with `DwarfDebug::collectVariableInfo()` using something like
10-15% of the total memory.

With this commit, we have:

    tuple<vec<tuple<Label, CU, Offset>>,
          vec<tuple<BeginSym, EndSym, Offset, Offset>>,
          vec<char>,
          vec<string>>

The offsets are used to create `ArrayRef` slices of adjacent
`SmallVector`s.  This reduces the number of vectors to four (unrelated
to the number of variable/inlined-at pairs), and caps the number of
allocations at the same number.

Besides saving memory and limiting allocations, this is NFC.

I don't know my way around this code very well yet, but I wonder if we
could go further: why stream to a side-table, instead of directly to the
output stream?

llvm-svn: 235229

9 years agoAArch64: Add test for returning [2 x i64] in registers. NFC.
Pete Cooper [Fri, 17 Apr 2015 21:31:25 +0000 (21:31 +0000)]
AArch64: Add test for returning [2 x i64] in registers.  NFC.

llvm-svn: 235228

9 years agoCompute A-B when A or B is weak.
Rafael Espindola [Fri, 17 Apr 2015 21:15:17 +0000 (21:15 +0000)]
Compute A-B when A or B is weak.

Similar to r235222, but for the weak symbol case.

In an "ideal" assembler/object format an expression would always refer to the
final value and A-B would only be computed from a section in the same
comdat as A and B with A and B strong.

Unfortunately that is not the case with debug info on ELF, so we need an
heuristic.  Since we need an heuristic, we may as well use the same one as
gas:

* call weak_sym : produces a relocation, even if in the same section.
* A - weak_sym and weak_sym -A: don't produce a relocation if we can
  compute it.

This fixes pr23272 and changes the fix of pr22815 to match what gas does.

llvm-svn: 235227

9 years agoFix typo in r235224 testcase. NFC.
Ahmed Bougacha [Fri, 17 Apr 2015 21:11:58 +0000 (21:11 +0000)]
Fix typo in r235224 testcase. NFC.

llvm-svn: 235226

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 21:06:49 +0000 (21:06 +0000)]
Remove dead code, NFC

llvm-svn: 235225

9 years ago[AArch64] Avoid vector->load dependency cycles when creating LD1*post.
Ahmed Bougacha [Fri, 17 Apr 2015 21:02:30 +0000 (21:02 +0000)]
[AArch64] Avoid vector->load dependency cycles when creating LD1*post.

They would break the SelectionDAG.
Note that the opposite load->vector dependency is already obvious in:
  (LD1*post vec, ..)

llvm-svn: 235224

9 years ago[WinEH] Reusing HandlerType entries leads to small CatchHigh values
David Majnemer [Fri, 17 Apr 2015 20:12:09 +0000 (20:12 +0000)]
[WinEH] Reusing HandlerType entries leads to small CatchHigh values

CatchHigh may be smaller than TryHigh if we reuse an outlined catch
handler for two different invokes with different EH states.  We have no
evidence which shows that CatchHigh must be greater than TryHigh or
TryLow.  We can revisit this if we turn out to be wrong.

llvm-svn: 235223

9 years agoCompute A-B if both A and B are in the same comdat section.
Rafael Espindola [Fri, 17 Apr 2015 20:05:17 +0000 (20:05 +0000)]
Compute A-B if both A and B are in the same comdat section.

Part of pr23272.

A small annoyance with the assembly syntax we implement is that given an
expression there is no way to know if what is desired is the value of that
expression for the symbols in this file or for the final values of those
symbols in a link.

The first case is useful for use in sections that get discarded or ignored
if the section they are describing is discarded.

For axample, consider A-B where A and B are in the same comdat section.

We can compute the value of the difference in the section that is present in
the current .o and if that section survives to the final DSO the value will
still will be correct.

But the section is in a comdat. Another section from another object file
might be used istead. We know that that section will define A and B, but
we have no idea what the value of A-B might be.

In practice we have to assume that the intention is to compute the value
in the current section since otherwise the is no way to create something like
the debug aranges section.

llvm-svn: 235222

9 years ago[opaque pointer types] Use the pointee type loaded from bitcode when constructing...
David Blaikie [Fri, 17 Apr 2015 19:56:21 +0000 (19:56 +0000)]
[opaque pointer types] Use the pointee type loaded from bitcode when constructing a LoadInst

Now (with a few carefully placed suppressions relating to general type
serialization, etc) we can round trip a simple load through bitcode and
textual IR without calling getElementType on a PointerType.

llvm-svn: 235221

9 years agoFix build errors introduced by r235215
Pirama Arumuga Nainar [Fri, 17 Apr 2015 19:51:44 +0000 (19:51 +0000)]
Fix build errors introduced by r235215

Summary:
- Handle TypePromoteFloat in switch statements
- Move an expression into an assert to avoid unused variable in
  non-assert builds.

Reviewers: srhines, ab

Subscribers: llvm-commits

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

llvm-svn: 235220