platform/upstream/llvm.git
9 years agoRevert r235749 - Accidentally commited cruft from the wrong path.
Lang Hames [Fri, 24 Apr 2015 19:08:30 +0000 (19:08 +0000)]
Revert r235749 - Accidentally commited cruft from the wrong path.

llvm-svn: 235750

9 years ago[CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.
Lang Hames [Fri, 24 Apr 2015 19:04:55 +0000 (19:04 +0000)]
[CodeGen] Make AsmPrinter's OutStreamer member a unique_ptr.

AsmPrinter owns the OutStreamer, so an owning pointer makes sense here. Using a
reference for this is crufty.

llvm-svn: 235749

9 years agoSimplify now that there is only one file. NFC.
Rafael Espindola [Fri, 24 Apr 2015 19:01:30 +0000 (19:01 +0000)]
Simplify now that there is only one file. NFC.

llvm-svn: 235747

9 years agounwind: stage 2 of creating project structure
Saleem Abdulrasool [Fri, 24 Apr 2015 18:58:18 +0000 (18:58 +0000)]
unwind: stage 2 of creating project structure

llvm-svn: 235746

9 years agoReturn ErrorOr<std::unique_ptr<File>>. NFC.
Rafael Espindola [Fri, 24 Apr 2015 18:51:30 +0000 (18:51 +0000)]
Return ErrorOr<std::unique_ptr<File>>. NFC.

llvm-svn: 235744

9 years agoRemove unused enum value. NFC.
Rafael Espindola [Fri, 24 Apr 2015 18:36:57 +0000 (18:36 +0000)]
Remove unused enum value. NFC.

llvm-svn: 235742

9 years agoReturn an ErrorOr<std::unique_ptr<File>>. NFC.
Rafael Espindola [Fri, 24 Apr 2015 18:33:50 +0000 (18:33 +0000)]
Return an ErrorOr<std::unique_ptr<File>>. NFC.

llvm-svn: 235741

9 years ago[Test] Explictly pass target architecture.
Davide Italiano [Fri, 24 Apr 2015 18:18:34 +0000 (18:18 +0000)]
[Test] Explictly pass target architecture.

If we're not being explicit, the test fails on windows.
Reported and tested by Aaron Ballman!

llvm-svn: 235739

9 years agoRevert changes to LTO test case since llvm-lto can't handle textual IR inputs
David Blaikie [Fri, 24 Apr 2015 18:13:27 +0000 (18:13 +0000)]
Revert changes to LTO test case since llvm-lto can't handle textual IR inputs

llvm-svn: 235738

9 years agoLook for both .debug and dsym debugging symbol information for stripped executable.
Robert Flack [Fri, 24 Apr 2015 18:09:54 +0000 (18:09 +0000)]
Look for both .debug and dsym debugging symbol information for stripped executable.

Currently Symbols::LocateExecutableSymbolFile on MacOSX only looks for external
dsym debugging information, however if running on a stripped dwarf executable it
should also check for a .debug file as well.

Test Plan:
./dotest.py $DOTEST_OPTS -t -p TestSharedLibStrippedSymbols.py
This test now passes when running a remote Mac -> Linux test, and still passes
running locally on Mac or locally on Linux.

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

llvm-svn: 235737

9 years agoSkip extra LLVM IR assemble/disassemble steps in some tests
David Blaikie [Fri, 24 Apr 2015 18:06:09 +0000 (18:06 +0000)]
Skip extra LLVM IR assemble/disassemble steps in some tests

llvm-svn: 235736

9 years ago[opaque pointer type] bitcode: add explicit callee type to invoke instructions
David Blaikie [Fri, 24 Apr 2015 18:06:06 +0000 (18:06 +0000)]
[opaque pointer type] bitcode: add explicit callee type to invoke instructions

llvm-svn: 235735

9 years agoFix LoopInterchange/reductions.ll test for debug builds
Andrew Kaylor [Fri, 24 Apr 2015 17:39:16 +0000 (17:39 +0000)]
Fix LoopInterchange/reductions.ll test for debug builds

llvm-svn: 235734

9 years agoTeach AArch64\lit.local.cfg the new triple names windows-gnu and windows-msvc.
Yaron Keren [Fri, 24 Apr 2015 17:14:16 +0000 (17:14 +0000)]
Teach AArch64\lit.local.cfg the new triple names windows-gnu and windows-msvc.

Tests were failing when built with -DLLVM_DEFAULT_TARGET_TRIPLE=i686-pc-windows-gnu.

llvm-svn: 235733

9 years ago[CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken
Chris Bieneman [Fri, 24 Apr 2015 17:09:20 +0000 (17:09 +0000)]
[CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken

In CMake dependencies can be filenames or targets, and targets can't be filenames. The Ninja generator handles filename dependencies because it generates targets for every output file from a command. For example:

add_custom_command(OUTPUT foo.txt COMMAND touch foo.txt)

With the Ninja generator this generates a target foo.txt, but with the Makefile generator it doesn't. This is probably because Ninja explicitly requires these hard dependency ties, and Make just behaves oddly in general.

To fix this we need to make the tablegen actions depend on a target rather than a filename.

llvm-svn: 235732

9 years agoLinker: Update -override testcase to check callers
Duncan P. N. Exon Smith [Fri, 24 Apr 2015 16:56:24 +0000 (16:56 +0000)]
Linker: Update -override testcase to check callers

Check that `@main` is calling `@foo2` (the renamed internal function),
not the `@foo` with external linkage that's been pulled in from the
override file.

llvm-svn: 235730

9 years agoSwitch lowering: fix APInt overflow causing infinite loop / OOM
Hans Wennborg [Fri, 24 Apr 2015 16:53:55 +0000 (16:53 +0000)]
Switch lowering: fix APInt overflow causing infinite loop / OOM

llvm-svn: 235729

9 years ago[lsan] Add an interface function for on-demand leak checking.
Sergey Matveev [Fri, 24 Apr 2015 16:53:15 +0000 (16:53 +0000)]
[lsan] Add an interface function for on-demand leak checking.

Summary:
Add an interface function which can be used to periodically trigger
leak detection in a long-running process.

NB: The meaning of the kIgnored tag has been changed to allow easy clean-up
between subsequent leak checks. Previously, this tag was applied to explicitly
ignored (i.e. with __lsan_disable() or __lsan_ignore_object()) chunks *and* any
chunks only reachable from those. With this change, it's only applied to
explicitly ignored chunks.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 235728

9 years agoRevert r235726 "interface"
Sergey Matveev [Fri, 24 Apr 2015 16:51:21 +0000 (16:51 +0000)]
Revert r235726 "interface"

Accidentally committed from local branch. :(

llvm-svn: 235727

9 years agointerface
Sergey Matveev [Fri, 24 Apr 2015 16:49:04 +0000 (16:49 +0000)]
interface

llvm-svn: 235726

9 years ago[WinEH] Split the landingpad BB instead of cloning it
Reid Kleckner [Fri, 24 Apr 2015 16:22:19 +0000 (16:22 +0000)]
[WinEH] Split the landingpad BB instead of cloning it

This means we don't have to RAUW the landingpad instruction and
landingpad BB, which is a nice win.

llvm-svn: 235725

9 years agoDelete unnecessary generality in loadFile.
Rafael Espindola [Fri, 24 Apr 2015 15:51:45 +0000 (15:51 +0000)]
Delete unnecessary generality in loadFile.

loadFile could load mulitple files just because yaml has a feature for
putting multiple documents in one file.

Designing a linker around what yaml can do seems like a bad idea to
me. This patch changes it to read a single file.

There are further improvements to be done to the api and they
will follow shortly.

llvm-svn: 235724

9 years agoFix typo in comment.
Diego Novillo [Fri, 24 Apr 2015 15:46:41 +0000 (15:46 +0000)]
Fix typo in comment.

llvm-svn: 235723

9 years agoAdd COMPILER_RT_ABI attribute to declarations of builtin functions in unittests
Derek Schuff [Fri, 24 Apr 2015 15:45:57 +0000 (15:45 +0000)]
Add COMPILER_RT_ABI attribute to declarations of builtin functions in unittests

Summary:
This makes their local declarations match their definitions for ARM targets,
where they have a different calling convention.

This really only affects functions that use floating point types (since the
runtime functions use soft-float, and some targets may default to hard-float)
but it seemed good to make it uniform and do the int-only ones too.

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

llvm-svn: 235722

9 years agoUse the cleaner syntx value initialization to zero initialize POD structs.
Yaron Keren [Fri, 24 Apr 2015 15:39:47 +0000 (15:39 +0000)]
Use the cleaner syntx value initialization to zero initialize POD structs.
Suggestion from David Blaikie!

llvm-svn: 235721

9 years agoSilence clang warning: private field 'data_' is not used.
Yaron Keren [Fri, 24 Apr 2015 15:10:15 +0000 (15:10 +0000)]
Silence clang warning: private field 'data_' is not used.

llvm-svn: 235720

9 years agoSilence clang warning: missing field 'Dr0' initializer.
Yaron Keren [Fri, 24 Apr 2015 14:26:27 +0000 (14:26 +0000)]
Silence clang warning: missing field 'Dr0' initializer.

llvm-svn: 235719

9 years ago[mips][FastISel] Specify which types we handle for integer extension.
Vasileios Kalintiris [Fri, 24 Apr 2015 13:48:19 +0000 (13:48 +0000)]
[mips][FastISel] Specify which types we handle for integer extension.

Summary:
Perform integer extension only when the destination type is one of
i8, i16 & i32 and when the source type is i1, i8 or i16. For other
combinations we fall back to SelectionDAG.

This fixes the test MultiSource/Benchmarks/7zip that was failing in our
out-of-tree MIPS buildbots.

Reviewers: dsanders

Subscribers: llvm-commits

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

llvm-svn: 235718

9 years agoRemoving dead code; NFC. This code was triggering a C4718 warning (recursive call...
Aaron Ballman [Fri, 24 Apr 2015 12:51:45 +0000 (12:51 +0000)]
Removing dead code; NFC. This code was triggering a C4718 warning (recursive call has no side effects, deleting) with MSVC.

llvm-svn: 235717

9 years agoFix condition detection in EmulateInstructionARM
Tamas Berghammer [Fri, 24 Apr 2015 12:13:44 +0000 (12:13 +0000)]
Fix condition detection in EmulateInstructionARM

The condition detection code is calculating the result of the condition
based on the first 3 bit of the condition and then negate it if the LSB
of the condition is set. It works for the normal conditions but 0b1110
and 0b1111 are special as both of them should evaluate to true
independently the value of CPSR. This CL removes the negating logic from
those cases.

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

llvm-svn: 235715

9 years agoFix order of b and blx instrction in EmulateInstructionARM
Tamas Berghammer [Fri, 24 Apr 2015 12:13:41 +0000 (12:13 +0000)]
Fix order of b and blx instrction in EmulateInstructionARM

In the previous ordering some "blx <label>" instruction was recognised
as "b #imm24" instructions causing a failure in the instruction
emulator.

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

llvm-svn: 235714

9 years agoFix write register context for arm "add<c> <Rd>, sp, #imm"
Tamas Berghammer [Fri, 24 Apr 2015 12:13:38 +0000 (12:13 +0000)]
Fix write register context for arm "add<c> <Rd>, sp, #imm"

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

llvm-svn: 235713

9 years agoUse self.fail() in MiGdbSetShowTestCase.test_lldbmi_gdb_set_target_async_off (MI)
Ilia K [Fri, 24 Apr 2015 11:41:42 +0000 (11:41 +0000)]
Use self.fail() in MiGdbSetShowTestCase.test_lldbmi_gdb_set_target_async_off (MI)

llvm-svn: 235712

9 years agoFix CMICmnLLDBDebuggerHandleEvents::GetProcessStdout/GetProcessStderr to use stream...
Ilia K [Fri, 24 Apr 2015 11:33:36 +0000 (11:33 +0000)]
Fix CMICmnLLDBDebuggerHandleEvents::GetProcessStdout/GetProcessStderr to use stream-record (MI)

llvm-svn: 235711

9 years ago[BitcodeReader] Fix asserts when we read a non-vector type for insert/extract/shuffle
Filipe Cabecinhas [Fri, 24 Apr 2015 11:30:15 +0000 (11:30 +0000)]
[BitcodeReader] Fix asserts when we read a non-vector type for insert/extract/shuffle

Added some additional checking for vector types + tests.

Bug found with AFL fuzz.

llvm-svn: 235710

9 years agoFix CMICmnMIOutOfBandRecord to accept stream-records (MI)
Ilia K [Fri, 24 Apr 2015 11:27:36 +0000 (11:27 +0000)]
Fix CMICmnMIOutOfBandRecord to accept stream-records (MI)

Previously the CMICmnMIOutOfBandRecord class worked only with async-records.

llvm-svn: 235709

9 years ago[Mips] Simplify the code a bit using early return
Simon Atanasyan [Fri, 24 Apr 2015 11:14:24 +0000 (11:14 +0000)]
[Mips] Simplify the code a bit using early return

No functional changes.

llvm-svn: 235708

9 years agoclang-format: Don't wrap after short first segments of builder calls.
Daniel Jasper [Fri, 24 Apr 2015 10:08:09 +0000 (10:08 +0000)]
clang-format: Don't wrap after short first segments of builder calls.

Before:
  a()
      .aaaaa()
      .aaaaa()
      .aaaaa();

After:
  a().aaaaa()
      .aaaaa()
      .aaaaa();

llvm-svn: 235707

9 years ago[ARM] Update TODO notes
Denis Protivensky [Fri, 24 Apr 2015 09:55:11 +0000 (09:55 +0000)]
[ARM] Update TODO notes

llvm-svn: 235706

9 years ago[ARM] Implement R_ARM_COPY relocation
Denis Protivensky [Fri, 24 Apr 2015 08:53:02 +0000 (08:53 +0000)]
[ARM] Implement R_ARM_COPY relocation

This adds support of copying objects from shared libraries.

llvm-svn: 235705

9 years ago[Msan] XFAIL the ftime.cc test on FreeBSD
Viktor Kutuzov [Fri, 24 Apr 2015 07:54:38 +0000 (07:54 +0000)]
[Msan] XFAIL the ftime.cc test on FreeBSD
Differential Revision: http://reviews.llvm.org/D9222

llvm-svn: 235704

9 years ago[Msan] Fix the backtrace.cc tests to build and pass on FreeBSD
Viktor Kutuzov [Fri, 24 Apr 2015 07:52:47 +0000 (07:52 +0000)]
[Msan] Fix the backtrace.cc tests to build and pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9221

llvm-svn: 235703

9 years agoclang-format: More selectively detect QT's "signals".
Daniel Jasper [Fri, 24 Apr 2015 07:50:34 +0000 (07:50 +0000)]
clang-format: More selectively detect QT's "signals".

llvm-svn: 235702

9 years ago[Sanitizers] Do not call internal_sigdelset() on non-Linux
Viktor Kutuzov [Fri, 24 Apr 2015 07:48:26 +0000 (07:48 +0000)]
[Sanitizers] Do not call internal_sigdelset() on non-Linux
Differential Revision: http://reviews.llvm.org/D9220

llvm-svn: 235701

9 years agoCorrect extractelement constant folding
Pawel Bylica [Fri, 24 Apr 2015 07:42:35 +0000 (07:42 +0000)]
Correct extractelement constant folding

Summary: Constant folding of extractelement with out-of-bound index produces undef also for indexes bigger than 64bit (instead of crash assert failure as before)

Test Plan: Unit tests included.

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 235700

9 years agoFix APInt long division algorithm
Pawel Bylica [Fri, 24 Apr 2015 07:38:39 +0000 (07:38 +0000)]
Fix APInt long division algorithm

Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling.

Test Plan: Unit test that reveals the bug included.

Reviewers: chandlerc, yaron.keren

Reviewed By: yaron.keren

Subscribers: llvm-commits

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

llvm-svn: 235699

9 years ago[TableGen] Clang changes for r235697 to stop leaking Expanders and Operators in SetTh...
Craig Topper [Fri, 24 Apr 2015 06:53:50 +0000 (06:53 +0000)]
[TableGen] Clang changes for r235697 to stop leaking Expanders and Operators in SetTheory.

llvm-svn: 235698

9 years ago[TableGen] Don't leak Expanders and Operators in SetTheory.
Craig Topper [Fri, 24 Apr 2015 06:49:44 +0000 (06:49 +0000)]
[TableGen] Don't leak Expanders and Operators in SetTheory.

llvm-svn: 235697

9 years ago[TableGen] Fix all remaining memory leaks of Init and RecTy objects.
Craig Topper [Fri, 24 Apr 2015 05:38:48 +0000 (05:38 +0000)]
[TableGen] Fix all remaining memory leaks of Init and RecTy objects.

llvm-svn: 235696

9 years agoResurrect r235688
Jingyue Wu [Fri, 24 Apr 2015 04:22:39 +0000 (04:22 +0000)]
Resurrect r235688

We should skip vector types which are not SCEVable.

test/CodeGen/NVPTX/sched2.ll passes

llvm-svn: 235695

9 years ago[OPENMP] Codegen for 'firstprivate' clause in 'single' directive.
Alexey Bataev [Fri, 24 Apr 2015 04:21:15 +0000 (04:21 +0000)]
[OPENMP] Codegen for 'firstprivate' clause in 'single' directive.

Emit the following code for 'single' directive with 'firtstprivate' clause:

if (@__kmpc_single()) {
  <init for firstprivates>
  @__kmpc_end_single();
}
@__kmpc_cancel_barrier(); // To avoid data race in firstprivate init
Differential Revision: http://reviews.llvm.org/D9223

llvm-svn: 235694

9 years agoRemove unused variable to silence GCC warning
David Majnemer [Fri, 24 Apr 2015 04:14:25 +0000 (04:14 +0000)]
Remove unused variable to silence GCC warning

llvm-svn: 235693

9 years ago[OPENMP] Do not emit implicit barrier for single directive with 'copyprivate' clause(s).
Alexey Bataev [Fri, 24 Apr 2015 04:00:39 +0000 (04:00 +0000)]
[OPENMP] Do not emit implicit barrier for single directive with 'copyprivate' clause(s).

Runtime function for 'copyprivate' directive generates implicit barriers, so no need to emit it.
Differential Revision: http://reviews.llvm.org/D9215

llvm-svn: 235692

9 years ago[OPENMP] Codegen for 'firstprivate' clause in 'sections' directive.
Alexey Bataev [Fri, 24 Apr 2015 03:37:03 +0000 (03:37 +0000)]
[OPENMP] Codegen for 'firstprivate' clause in 'sections' directive.

If there are 2 or more sections in a 'section' directive the following code is generated:

<init for firstprivates>
@__kmpc_cancel_barrier();// To avoid data race in firstprivate init
@__kmpc_for_static_init_4();
<BODY for sections directive>
@__kmpc_for_static_fini()
If there is only one section, the following code is generated:

if (@__kmpc_single()) {
  <init for firstprivates>
  @__kmpc_end_single();
}
@__kmpc_cancel_barrier(); // To avoid data race in firstprivate init
Differential Revision: http://reviews.llvm.org/D9214

llvm-svn: 235691

9 years agoRevert r235688
Jingyue Wu [Fri, 24 Apr 2015 03:26:11 +0000 (03:26 +0000)]
Revert r235688

Seems breaking builds

llvm-svn: 235690

9 years ago[NVPTX] Emits "generic()" depending on the original address space
Jingyue Wu [Fri, 24 Apr 2015 02:57:30 +0000 (02:57 +0000)]
[NVPTX] Emits "generic()" depending on the original address space

Summary:
Fixes a bug in the NVPTX codegen. The code used to miss necessary "generic()"
on aggregates of addrspacecasts.

Test Plan: addrspacecast-gvar.ll

Reviewers: eliben, jholewinski

Reviewed By: jholewinski

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 235689

9 years ago[NVPTX] enable NaryReassociate in NVPTX
Jingyue Wu [Fri, 24 Apr 2015 02:54:06 +0000 (02:54 +0000)]
[NVPTX] enable NaryReassociate in NVPTX

Summary:
We run NaryReassociate right after SLSR because SLSR enables many
opportunities for NaryReassociate. For example, in nary-slsr.ll

  foo((a + b) + c);
  foo((a + b * 2) + c);
  foo((a + b * 3) + c);   // 2 muls and 6 adds

after SLSR:

  ab = a + b;
  foo(ab + c);
  ab2 = ab + b;
  foo(ab2 + c);
  ab3 = ab2 + b;
  foo(ab3 + c);           // 6 adds

after NaryReassociate:

  abc = (a + b) + c;
  foo(abc);
  ab2c = abc + b;
  foo(ab2c);
  ab3c = ab2c + b;
  foo(ab3c);              // 4 adds

Test Plan: nary-slsr.ll

Reviewers: jholewinski, eliben

Reviewed By: eliben

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 235688

9 years agoR600/SI: Fix verifier error when producing v_madmk_f32
Matt Arsenault [Fri, 24 Apr 2015 01:57:58 +0000 (01:57 +0000)]
R600/SI: Fix verifier error when producing v_madmk_f32

Copy the kill flags when swapping the operands.

llvm-svn: 235687

9 years agoReplace getPointeeType()->isFunctionType with isMemberDataPointerType
David Majnemer [Fri, 24 Apr 2015 01:25:08 +0000 (01:25 +0000)]
Replace getPointeeType()->isFunctionType with isMemberDataPointerType

llvm-svn: 235682

9 years ago[MS ABI] Fix the preferred alignment of member pointers
David Majnemer [Fri, 24 Apr 2015 01:25:05 +0000 (01:25 +0000)]
[MS ABI] Fix the preferred alignment of member pointers

Member pointers in the MS ABI have different alignment depending on
whether they were created on the stack or live in a record.

llvm-svn: 235681

9 years agoCleanup some MS-ABI specific code
David Majnemer [Fri, 24 Apr 2015 01:24:59 +0000 (01:24 +0000)]
Cleanup some MS-ABI specific code

No functional change intended.

llvm-svn: 235680

9 years agoImprove isTriviallyReMaterializable() documentation.
Matthias Braun [Fri, 24 Apr 2015 01:15:27 +0000 (01:15 +0000)]
Improve isTriviallyReMaterializable() documentation.

This should make it clear under which narrow circumstances implicit
physreg uses are okay when rematerializing and prevent people from
accidentally allowing too much when overriding
isReallyTriviallyReMaterializable() even with the weaker assert in the
RegisterCoalescer.

llvm-svn: 235679

9 years ago[modules] Partial revert of r235669: don't create ModuleMacros for imported local...
Richard Smith [Fri, 24 Apr 2015 00:41:09 +0000 (00:41 +0000)]
[modules] Partial revert of r235669: don't create ModuleMacros for imported local macros.

The surrounding infrastructure isn't quite ready for this yet.

llvm-svn: 235677

9 years agoStart to share SWIG interface files between languages.
Bruce Mitchener [Fri, 24 Apr 2015 00:38:53 +0000 (00:38 +0000)]
Start to share SWIG interface files between languages.

Summary:
Move scripts/Python/interface to scripts/interface so that we
can start making iterative improvements towards sharing the
interface files between multiple languages (each of which would
have their own directory as now).

Test Plan: Build and see.

Reviewers: zturner, emaste, clayborg

Reviewed By: clayborg

Subscribers: mjsabby, lldb-commits

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

llvm-svn: 235676

9 years agoR600/RegisterCoalescer: Enable more rematerialization/add missing testcase
Matthias Braun [Fri, 24 Apr 2015 00:25:50 +0000 (00:25 +0000)]
R600/RegisterCoalescer: Enable more rematerialization/add missing testcase

This enables the rematerialization of some R600 MOV instructions in the
RegisterCoalescer and adds a testcase for r235668.

llvm-svn: 235675

9 years agoFix a couple of typos in comments.
Michael Zolotukhin [Fri, 24 Apr 2015 00:10:27 +0000 (00:10 +0000)]
Fix a couple of typos in comments.

llvm-svn: 235674

9 years agoRegisterCoalescer: implicit phsreg uses are fine when rematerializing
Matthias Braun [Fri, 24 Apr 2015 00:01:37 +0000 (00:01 +0000)]
RegisterCoalescer: implicit phsreg uses are fine when rematerializing

The target hooks should have already checked them. This change is
necessary to enable the remateriailzation on R600.

llvm-svn: 235673

9 years agoRevert accidentally committed "MC: Allow targets to stop symbol name quoting"
Matt Arsenault [Thu, 23 Apr 2015 23:34:51 +0000 (23:34 +0000)]
Revert accidentally committed "MC: Allow targets to stop symbol name quoting"

llvm-svn: 235672

9 years agoR600/SI: Special case v_mov_b32 as really rematerializable
Matt Arsenault [Thu, 23 Apr 2015 23:34:48 +0000 (23:34 +0000)]
R600/SI: Special case v_mov_b32 as really rematerializable

This should be fixed to properly understand all rematerializable
instructions while ignoring implicit reads of exec.

llvm-svn: 235671

9 years agoMC: Allow targets to stop symbol name quoting
Matt Arsenault [Thu, 23 Apr 2015 23:34:05 +0000 (23:34 +0000)]
MC: Allow targets to stop symbol name quoting

Currently symbol names are printed in quotes if it contains something
outside of the arbitrary set of characters that isAcceptableChar tests
for. On somem targets, it is never OK to print a symbol name in quotes
so allow targets to opt out of this behavior.

llvm-svn: 235670

9 years ago[modules] Refactor creation of ModuleMacros and create them when importing from local...
Richard Smith [Thu, 23 Apr 2015 23:29:05 +0000 (23:29 +0000)]
[modules] Refactor creation of ModuleMacros and create them when importing from local submodules.

llvm-svn: 235669

9 years agoRegisterCoalescer: Avoid unnecessary register class widening for some rematerializations
Matthias Braun [Thu, 23 Apr 2015 23:24:36 +0000 (23:24 +0000)]
RegisterCoalescer: Avoid unnecessary register class widening for some rematerializations

I couldn't provide a testcase as none of the public targets has wide
register classes with alot of subregisters and at the same time an
instruction which "ReMaterializable" and "AsCheapAsAMove" (could
probably be added for R600).

llvm-svn: 235668

9 years agoRe-commit "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works"
Reid Kleckner [Thu, 23 Apr 2015 23:22:33 +0000 (23:22 +0000)]
Re-commit "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works"

This reverts commit r235617.

r235649 should have addressed the problems.

llvm-svn: 235667

9 years agoFix modules build post-r235612.
Richard Smith [Thu, 23 Apr 2015 23:22:26 +0000 (23:22 +0000)]
Fix modules build post-r235612.

llvm-svn: 235666

9 years ago[PowerPC] Support register name prefixes for vector registers
Hal Finkel [Thu, 23 Apr 2015 23:16:22 +0000 (23:16 +0000)]
[PowerPC] Support register name prefixes for vector registers

Match binutils by supporting the optional register name prefix for new vector
registers ("vs" for VSX registers and "q" for QPX registers).

llvm-svn: 235665

9 years agoInstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)
Justin Bogner [Thu, 23 Apr 2015 23:06:47 +0000 (23:06 +0000)]
InstrProf: Stop using RegionCounter outside of CodeGenPGO (NFC)

The RegionCounter type does a lot of legwork, but most of it is only
meaningful within the implementation of CodeGenPGO. The uses elsewhere
in CodeGen generally just want to increment or read counters, so do
that directly.

llvm-svn: 235664

9 years ago[PowerPC] Use sync inst alias when printing
Hal Finkel [Thu, 23 Apr 2015 23:05:08 +0000 (23:05 +0000)]
[PowerPC] Use sync inst alias when printing

So long as the choice between printing msync and sync is not ambiguous, we can
print 'sync 0' and just 'sync'.

llvm-svn: 235663

9 years agoR600: Correctly lower CONCAT_VECTOR nodes with more than 2 operands
Tom Stellard [Thu, 23 Apr 2015 22:59:24 +0000 (22:59 +0000)]
R600: Correctly lower CONCAT_VECTOR nodes with more than 2 operands

llvm-svn: 235662

9 years ago[modules] Properly attribute macros to modules if they're in a file textually include...
Richard Smith [Thu, 23 Apr 2015 22:58:06 +0000 (22:58 +0000)]
[modules] Properly attribute macros to modules if they're in a file textually included into a file in the module.

llvm-svn: 235661

9 years agoFix comment for NoCommonBits.
Michael Zolotukhin [Thu, 23 Apr 2015 22:55:48 +0000 (22:55 +0000)]
Fix comment for NoCommonBits.

Maybe there is a better wording, but at least it should be technically
correct now.

llvm-svn: 235660

9 years ago[PowerPC] Add asm/disasm support for dcbt with hint
Hal Finkel [Thu, 23 Apr 2015 22:47:57 +0000 (22:47 +0000)]
[PowerPC] Add asm/disasm support for dcbt with hint

Add assembler/disassembler support for dcbt/dcbtst (and aliases) with the hint
field specified (non-zero). Unforunately, the syntax for this instruction is
special in that it differs for server vs. embedded cores:
   dcbt ra, rb, th [server]
   dcbt th, ra, rb [embedded]
where th can be omitted when it is 0. dcbtst is the same. Thus we need to play
games in the parser and the printer to flip the operands around on the embedded
cores. We'll use the server syntax as the default (binutils currently uses the
embedded form by default, but IBM is changing that).

We also stop marking dcbtst as having unmodeled side effects (this is not
necessary, it is just a hint like dcbt -- noticed by inspection, so no separate
test case).

llvm-svn: 235657

9 years ago[WinEH] Ignore filter clauses while mapping landing pad blocks.
Andrew Kaylor [Thu, 23 Apr 2015 22:38:36 +0000 (22:38 +0000)]
[WinEH] Ignore filter clauses while mapping landing pad blocks.

llvm-svn: 235656

9 years ago[Sanitizer] Fix getpwnam test on ppc64le Fedora 21.
Jay Foad [Thu, 23 Apr 2015 22:20:33 +0000 (22:20 +0000)]
[Sanitizer] Fix getpwnam test on ppc64le Fedora 21.

Summary:
On ppc64le Fedora 21, getpwnam_r("no-such-user", ...) returns ENOENT
instead of 0. Tolerate this in the test case.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

llvm-svn: 235654

9 years agoFix build.
Chaoren Lin [Thu, 23 Apr 2015 22:19:29 +0000 (22:19 +0000)]
Fix build.

llvm-svn: 235653

9 years agoRemove trivial assert to fix NDEBUG Werror builds
Reid Kleckner [Thu, 23 Apr 2015 21:36:32 +0000 (21:36 +0000)]
Remove trivial assert to fix NDEBUG Werror builds

llvm-svn: 235652

9 years agoRecommit r235458: [opaque pointer type] Avoid using PointerType::getElementType for...
David Blaikie [Thu, 23 Apr 2015 21:36:23 +0000 (21:36 +0000)]
Recommit r235458: [opaque pointer type] Avoid using PointerType::getElementType for a few cases of CallInst

(reverted in r235533)

Original commit message:

"Calls to llvm::Value::mutateType are becoming extra-sensitive now that
instructions have extra type information that will not be derived from
operands or result type (alloca, gep, load, call/invoke, etc... ). The
special-handling for mutateType will get more complicated as this work
continues - it might be worth making mutateType virtual & pushing the
complexity down into the classes that need special handling. But with
only two significant uses of mutateType (vectorization and linking) this
seems OK for now.

Totally open to ideas/suggestions/improvements, of course.

With this, and a bunch of exceptions, we can roundtrip an indirect call
site through bitcode and IR. (a direct call site is actually trickier...
I haven't figured out how to deal with the IR deserializer's lazy
construction of Function/GlobalVariable decl's based on the type of the
entity which means looking through the "pointer to T" type referring to
the global)"

The remapping done in ValueMapper for LTO was insufficient as the types
weren't correctly mapped (though I was using the post-mapped operands,
some of those operands might not have been mapped yet so the type
wouldn't be post-mapped yet). Instead use the pre-mapped type and
explicitly map all the types.

llvm-svn: 235651

9 years agoFix clang docs build.
Sergey Matveev [Thu, 23 Apr 2015 21:29:37 +0000 (21:29 +0000)]
Fix clang docs build.

llvm-svn: 235650

9 years ago[WinEH] Replace more lpad value uses with undef
Reid Kleckner [Thu, 23 Apr 2015 21:22:30 +0000 (21:22 +0000)]
[WinEH] Replace more lpad value uses with undef

We were asserting on code like this:
  extern "C" unsigned long _exception_code();
  void might_crash(unsigned long);
  void foo() {
    __try {
      might_crash(0);
    } __except(1) {
      might_crash(_exception_code());
    }
  }

Gtest and many other libraries get the exception code from the __except
block. What's supposed to happen here is that EAX is live into the
__except block, and it contains the exception code. Eventually we'll
represent that as a use of the landingpad ehptr value, but for now we
can replace it with undef.

llvm-svn: 235649

9 years ago[modules] Remove the now-redundant import of all pending macros at the end of buildin...
Richard Smith [Thu, 23 Apr 2015 21:20:19 +0000 (21:20 +0000)]
[modules] Remove the now-redundant import of all pending macros at the end of building a module.

Since we now track module macros separately from their visibility state, this
is no longer necessary.

llvm-svn: 235648

9 years ago[MachineCopyPropagation] Handle undef flags conservatively so that we do not
Quentin Colombet [Thu, 23 Apr 2015 21:17:39 +0000 (21:17 +0000)]
[MachineCopyPropagation] Handle undef flags conservatively so that we do not
remove copies that are useful after breaking some hardware dependencies.
In other words, handle this kind of situations conservatively by assuming reg2
is redefined by the undef flag.
reg1 = copy reg2
= inst reg2<undef>
reg2 = copy reg1
Copy propagation used to remove the last copy.
This is incorrect because the undef flag on reg2 in inst, allows next
passes to put whatever trashed value in reg2 that may help.
In practice we end up with this code:
reg1 = copy reg2
reg2 = 0
= inst reg2<undef>
reg2 = copy reg1

This fixes PR21743.

llvm-svn: 235647

9 years agoUnbreak build
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:57:39 +0000 (20:57 +0000)]
Unbreak build

llvm-svn: 235646

9 years ago[Hexagon] Minor cleanup in HexagonFrameLowering
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:42:20 +0000 (20:42 +0000)]
[Hexagon] Minor cleanup in HexagonFrameLowering

llvm-svn: 235645

9 years ago[modules] Store a ModuleMacro* on an imported macro directive rather than duplicating...
Richard Smith [Thu, 23 Apr 2015 20:40:50 +0000 (20:40 +0000)]
[modules] Store a ModuleMacro* on an imported macro directive rather than duplicating the info within it.

llvm-svn: 235644

9 years agoAdd clang/docs/SanitizerCoverage.rst
Sergey Matveev [Thu, 23 Apr 2015 20:40:04 +0000 (20:40 +0000)]
Add clang/docs/SanitizerCoverage.rst

Moved from https://code.google.com/p/address-sanitizer/wiki/AsanCoverage

llvm-svn: 235643

9 years agoFix clang-tools-extra build after clang r235614.
Richard Smith [Thu, 23 Apr 2015 20:38:48 +0000 (20:38 +0000)]
Fix clang-tools-extra build after clang r235614.

llvm-svn: 235642

9 years agoR600/SI: Fix indirect addressing with a negative constant offset
Tom Stellard [Thu, 23 Apr 2015 20:32:01 +0000 (20:32 +0000)]
R600/SI: Fix indirect addressing with a negative constant offset

When the base register index of the vector plus the constant offset
was less than zero, we were passing the wrong base register to the indirect
addressing instruction.

In this case, we need to set the base register to v0 and then add
the computed (negative) index to m0.

llvm-svn: 235641

9 years agoThumb2: When applying branch optimizations, visit branches in reverse order.
Peter Collingbourne [Thu, 23 Apr 2015 20:31:35 +0000 (20:31 +0000)]
Thumb2: When applying branch optimizations, visit branches in reverse order.

The order in which branches appear in ImmBranches is approximately their
order within the function body. By visiting later branches first, we reduce
the distance between earlier forward branches and their targets, making it
more likely that the cbn?z optimization, which can only apply to forward
branches, will succeed for those earlier branches.

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

llvm-svn: 235640

9 years agoARM: When re-creating a branch via InsertBranch, preserve CPSR flags.
Peter Collingbourne [Thu, 23 Apr 2015 20:31:32 +0000 (20:31 +0000)]
ARM: When re-creating a branch via InsertBranch, preserve CPSR flags.

In particular, this preserves the kill flag, which allows the Thumb2 cbn?z
optimization to be applied in cases where a branch has been re-created after
the live variables analysis pass, e.g. by the machine block placement pass.

This appears to be low risk; a number of other targets seem to already be
doing something similar, e.g. AArch64, PowerPC.

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

llvm-svn: 235639

9 years agoThumb2: When optimizing for size, do not if-convert branches involving comparisons...
Peter Collingbourne [Thu, 23 Apr 2015 20:31:30 +0000 (20:31 +0000)]
Thumb2: When optimizing for size, do not if-convert branches involving comparisons with zero.

This allows the constant island pass to lower these branches to cbn?z
instructions, resulting in a shorter instruction sequence.

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

llvm-svn: 235638

9 years agoARM: When spilling extra registers for alignment, prefer low registers on all Thumb...
Peter Collingbourne [Thu, 23 Apr 2015 20:31:26 +0000 (20:31 +0000)]
ARM: When spilling extra registers for alignment, prefer low registers on all Thumb targets.

This makes it more likely that we can use the 16-bit push and pop instructions
on Thumb-2, saving around 4 bytes per function.

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

llvm-svn: 235637