platform/upstream/llvm.git
9 years agoDriver: Move crash report command mangling into Command::Print
Justin Bogner [Tue, 21 Oct 2014 17:24:44 +0000 (17:24 +0000)]
Driver: Move crash report command mangling into Command::Print

This pushes the logic for generating a crash reproduction script
entirely into Command::Print, instead of Command doing half of the
work and then relying on textual substitution for the rest. This makes
this logic much easier to read and will simplify fixing a couple of
issues in this area.

llvm-svn: 220305

9 years agoR600/SI: Add pattern for bswap
Matt Arsenault [Tue, 21 Oct 2014 16:25:08 +0000 (16:25 +0000)]
R600/SI: Add pattern for bswap

llvm-svn: 220304

9 years ago[PBQP] Check for out of bound access in DEBUG builds
Arnaud A. de Grandmaison [Tue, 21 Oct 2014 16:24:21 +0000 (16:24 +0000)]
[PBQP] Check for out of bound access in DEBUG builds

It is just too easy to use a virtual register intead of a NodeId without a
compiler warning. This does not fix the fundamental problem, i.e. both
have the same underlying types, but increases the likelyhood to detect it.

llvm-svn: 220303

9 years ago[PBQP] Fix coalescing benefits
Arnaud A. de Grandmaison [Tue, 21 Oct 2014 16:24:15 +0000 (16:24 +0000)]
[PBQP] Fix coalescing benefits

As coalescing registers is a benefit, the cost should be improved (i.e. made smaller) when coalescing is possible.

llvm-svn: 220302

9 years agoX86AsmInstrumentation.cpp: Dissolve initializer-ranged-for. MSC17 disliked it.
NAKAMURA Takumi [Tue, 21 Oct 2014 16:22:52 +0000 (16:22 +0000)]
X86AsmInstrumentation.cpp: Dissolve initializer-ranged-for. MSC17 disliked it.

llvm-svn: 220301

9 years agoSilence a -Wcast-qual warning; NFC.
Aaron Ballman [Tue, 21 Oct 2014 16:12:37 +0000 (16:12 +0000)]
Silence a -Wcast-qual warning; NFC.

llvm-svn: 220300

9 years agoTest commit
Colin LeMahieu [Tue, 21 Oct 2014 16:03:10 +0000 (16:03 +0000)]
Test commit
Fixing brief comment.

llvm-svn: 220299

9 years agoComment cleanup. NFC.
Rafael Espindola [Tue, 21 Oct 2014 15:49:46 +0000 (15:49 +0000)]
Comment cleanup. NFC.

Don't duplicate names in comments and remove useless ones. Hopefully anyone
reading this knows what main is.

llvm-svn: 220298

9 years agoThe nodebug attribute has a C++11-style spelling supported by GCC as well. This modif...
Aaron Ballman [Tue, 21 Oct 2014 15:46:57 +0000 (15:46 +0000)]
The nodebug attribute has a C++11-style spelling supported by GCC as well. This modifies it so we support that spelling as well.

llvm-svn: 220297

9 years agoSome tests used __typeof__ instead of decltype. Replace these usages.
Marshall Clow [Tue, 21 Oct 2014 15:07:09 +0000 (15:07 +0000)]
Some tests used __typeof__ instead of decltype. Replace these usages.

llvm-svn: 220296

9 years agoLWG #2212 (not yet adopted) mandates that tuple_size/tuple_element are available...
Marshall Clow [Tue, 21 Oct 2014 15:05:31 +0000 (15:05 +0000)]
LWG #2212 (not yet adopted) mandates that tuple_size/tuple_element are available if <array> or <utility> are included (not just <tuple>). We already do this. Add some tests to make sure that this remains true.

llvm-svn: 220295

9 years agoAdd support for addmod to mri scripts.
Rafael Espindola [Tue, 21 Oct 2014 14:46:17 +0000 (14:46 +0000)]
Add support for addmod to mri scripts.

llvm-svn: 220294

9 years agoFixing the MSVC build by removing friendship with CodeGenFunction; NFC.
Aaron Ballman [Tue, 21 Oct 2014 13:39:56 +0000 (13:39 +0000)]
Fixing the MSVC build by removing friendship with CodeGenFunction; NFC.

llvm-svn: 220293

9 years ago[Tsan] Add FreeBSD support to longjmp-related definitions
Viktor Kutuzov [Tue, 21 Oct 2014 13:38:05 +0000 (13:38 +0000)]
[Tsan] Add FreeBSD support to longjmp-related definitions
Differential Revision: http://reviews.llvm.org/D5857

llvm-svn: 220292

9 years ago[Tsan] Fix sigaction_t to match system definition on FreeBSD
Viktor Kutuzov [Tue, 21 Oct 2014 13:31:05 +0000 (13:31 +0000)]
[Tsan] Fix sigaction_t to match system definition on FreeBSD
Differential Revision: http://reviews.llvm.org/D5856

llvm-svn: 220291

9 years ago[PowerPC] Avoid VSX FMA mutate when killed product reg = addend reg
Bill Schmidt [Tue, 21 Oct 2014 13:02:37 +0000 (13:02 +0000)]
[PowerPC] Avoid VSX FMA mutate when killed product reg = addend reg

With VSX enabled, test/CodeGen/PowerPC/recipest.ll exposes a bug in
the FMA mutation pass.  If we have a situation where a killed product
register is the same register as the FMA target, such as:

   %vreg5<def,tied1> = XSNMSUBADP %vreg5<tied0>, %vreg11, %vreg5,
                       %RM<imp-use>; VSFRC:%vreg5 F8RC:%vreg11

then the substitution makes no sense.  We end up getting a crash when
we try to extend the interval associated with the killed product
register, as there is already a live range for %vreg5 there.  This
patch just disables the mutation under those circumstances.

Since recipest.ll generates different code with VMX enabled, I've
modified that test to use -mattr=-vsx.  I've borrowed the code from
that test that exposed the bug and placed it in fma-mutate.ll, where
it tests several mutation opportunities including the "bad" one.

llvm-svn: 220290

9 years ago[analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package.
Anton Yartsev [Tue, 21 Oct 2014 12:41:36 +0000 (12:41 +0000)]
[analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus package.

llvm-svn: 220289

9 years ago[ARM] NEON 32-bit scalar moves are also available in VFPv2
Oliver Stannard [Tue, 21 Oct 2014 11:49:14 +0000 (11:49 +0000)]
[ARM] NEON 32-bit scalar moves are also available in VFPv2

The 32-bit variants of the NEON scalar<->GPR move instructions are
also available in VFPv2. The 8- and 16-bit variants do require NEON.

Note that the checks in the test file are all -DAG because they are
checking a mixture of stdout and stderr, and the ordering is not
guaranteed.

llvm-svn: 220288

9 years agoclang-format: [Java] Understand string literal concatenation.
Daniel Jasper [Tue, 21 Oct 2014 11:34:53 +0000 (11:34 +0000)]
clang-format: [Java] Understand string literal concatenation.

Before:
  String someString = "abc" + "cde";

After:
  String someString = "abc"
                      + "cde";

llvm-svn: 220287

9 years agoclang-format: [Java] Fix formatting of multiple annotations.
Daniel Jasper [Tue, 21 Oct 2014 11:17:56 +0000 (11:17 +0000)]
clang-format: [Java] Fix formatting of multiple annotations.

Before:
  @SuppressWarnings(value = "unchecked")
  @Author(name = "abc") public void doSomething() {
  }

After:
  @SuppressWarnings(value = "unchecked")
  @Author(name = "abc")
  public void doSomething() {
  }

llvm-svn: 220286

9 years agoclang-format: [Java] Fix space in generic method calls.
Daniel Jasper [Tue, 21 Oct 2014 11:13:31 +0000 (11:13 +0000)]
clang-format: [Java] Fix space in generic method calls.

Before:
  A.<B>doSomething();

After:
  A.<B>doSomething();

llvm-svn: 220285

9 years agoclang-format: [Java] Improve annotation handling.
Daniel Jasper [Tue, 21 Oct 2014 10:58:14 +0000 (10:58 +0000)]
clang-format: [Java] Improve annotation handling.

Before:
@SuppressWarnings(
    value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") public static int iiiiiiiiiiiiiiiiiiiiiiii;

After:
  @SuppressWarnings(value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
  public static int iiiiiiiiiiiiiiiiiiiiiiii;

llvm-svn: 220284

9 years ago[asan-asm-instrumentation] Fixed memory accesses with rbp as a base or an index register.
Yuri Gorshenin [Tue, 21 Oct 2014 10:22:27 +0000 (10:22 +0000)]
[asan-asm-instrumentation] Fixed memory accesses with rbp as a base or an index register.

Summary: Fixed memory accesses with rbp as a base or an index register.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 220283

9 years agoclang-format: [Java] Make annotation formatting more consistent.
Daniel Jasper [Tue, 21 Oct 2014 10:02:03 +0000 (10:02 +0000)]
clang-format: [Java] Make annotation formatting more consistent.

Before:
  DoSomething(new A() {
    @Override public String toString() {
    }
  });

After:
  DoSomething(new A() {
    @Override
    public String toString() {
    }
  });

llvm-svn: 220282

9 years agoclang-format: [Java] Improve generic support.
Daniel Jasper [Tue, 21 Oct 2014 09:57:09 +0000 (09:57 +0000)]
clang-format: [Java] Improve generic support.

Before:
  Iterable< ? > a;
  Iterable< ? extends SomeObject > a;

After:
  Iterable<?> a;
  Iterable<? extends SomeObject> a;

llvm-svn: 220281

9 years agoclang-format: [Java] Support extending inner classes.
Daniel Jasper [Tue, 21 Oct 2014 09:31:29 +0000 (09:31 +0000)]
clang-format: [Java] Support extending inner classes.

Before:
  class A extends B
  .C {}

After:
  class A extends B.C {}

llvm-svn: 220280

9 years agoclang-format: [Java] Support annotations with parameters.
Daniel Jasper [Tue, 21 Oct 2014 09:25:39 +0000 (09:25 +0000)]
clang-format: [Java] Support annotations with parameters.

Before:
  @SuppressWarnings
  (value = "unchecked") public void doSomething() { .. }

After:
  @SuppressWarnings(value = "unchecked")
  public void doSomething() { .. }

llvm-svn: 220279

9 years ago[Thumb2] LDRS?[BH] cannot load to the PC
Oliver Stannard [Tue, 21 Oct 2014 09:14:15 +0000 (09:14 +0000)]
[Thumb2] LDRS?[BH] cannot load to the PC

The Thumb2 LDRS?[BH] instructions are not valid when the destination
register is the PC (these encodings are used for preload hints).

llvm-svn: 220278

9 years agoTeach the load analysis to allow finding available values which require
Chandler Carruth [Tue, 21 Oct 2014 09:00:40 +0000 (09:00 +0000)]
Teach the load analysis to allow finding available values which require
inttoptr or ptrtoint cast provided there is datalayout available.
Eventually, the datalayout can just be required but in practice it will
always be there today.

To go with the ability to expose available values requiring a ptrtoint
or inttoptr cast, helpers are added to perform one of these three casts.

These smarts are necessary to finish canonicalizing loads and stores to
the operational type requirements without regressing fundamental
combines.

I've added some test cases. These should actually improve as the load
combining and store combining improves, but they may fundamentally be
highlighting some missing combines for select in addition to exercising
the specific added logic to load analysis.

llvm-svn: 220277

9 years ago[mips][microMIPS] Implement ADDU16 and SUBU16 instructions
Zoran Jovanovic [Tue, 21 Oct 2014 08:44:58 +0000 (08:44 +0000)]
[mips][microMIPS] Implement ADDU16 and SUBU16 instructions
Differential Revision: http://reviews.llvm.org/D5118

llvm-svn: 220276

9 years ago[mips][microMIPS] Implement AND16, NOT16, OR16 and XOR16 instructions
Zoran Jovanovic [Tue, 21 Oct 2014 08:32:40 +0000 (08:32 +0000)]
[mips][microMIPS] Implement AND16, NOT16, OR16 and XOR16 instructions
Differential Revision: http://reviews.llvm.org/D5117

llvm-svn: 220275

9 years agoclang-format: [Java] Wrap after each function annotation.
Daniel Jasper [Tue, 21 Oct 2014 08:24:18 +0000 (08:24 +0000)]
clang-format: [Java] Wrap after each function annotation.

Before:
  @Override public String toString() { .. }

After:
  @Override
  public String toString() { .. }

llvm-svn: 220274

9 years ago[mips][microMIPS] Implement microMIPS 16-bit instructions registers
Zoran Jovanovic [Tue, 21 Oct 2014 08:23:11 +0000 (08:23 +0000)]
[mips][microMIPS] Implement microMIPS 16-bit instructions registers
Differential Revision: http://reviews.llvm.org/D5116

llvm-svn: 220273

9 years agoTest case B: fixed check rule
Evgeny Astigeevich [Tue, 21 Oct 2014 08:16:42 +0000 (08:16 +0000)]
Test case B: fixed check rule

llvm-svn: 220272

9 years agoTest case B is updated to work for 32-bit and 64-bit platforms
Evgeny Astigeevich [Tue, 21 Oct 2014 08:01:37 +0000 (08:01 +0000)]
Test case B is updated to work for 32-bit and 64-bit platforms

llvm-svn: 220271

9 years agoclang-format: [ObjC] Fix spacing in block variable parameters.
Daniel Jasper [Tue, 21 Oct 2014 07:57:50 +0000 (07:57 +0000)]
clang-format: [ObjC] Fix spacing in block variable parameters.

Before:
  { void (^block)(Object * x); }

After:
  { void (^block)(Object *x); }

llvm-svn: 220270

9 years agoclang-format: Fix space in direct destructor calls.
Daniel Jasper [Tue, 21 Oct 2014 07:51:54 +0000 (07:51 +0000)]
clang-format: Fix space in direct destructor calls.

Before:
  void F(int& i) { i. ~int(); }

After:
  void F(int& i) { i.~int(); }

Also, some cleanups.

llvm-svn: 220269

9 years agoAdd missing qualifier to documentation.
Nick Lewycky [Tue, 21 Oct 2014 06:44:23 +0000 (06:44 +0000)]
Add missing qualifier to documentation.

llvm-svn: 220268

9 years agoUpdate documentation to match API change in r215323.
Nick Lewycky [Tue, 21 Oct 2014 06:43:08 +0000 (06:43 +0000)]
Update documentation to match API change in r215323.

llvm-svn: 220267

9 years agoOpenMPClause.h: Fix a warning. [-Wdocumentation]
NAKAMURA Takumi [Tue, 21 Oct 2014 06:40:57 +0000 (06:40 +0000)]
OpenMPClause.h: Fix a warning. [-Wdocumentation]

llvm-svn: 220266

9 years agoDriver: Tighten up crash report tests
Justin Bogner [Tue, 21 Oct 2014 05:13:09 +0000 (05:13 +0000)]
Driver: Tighten up crash report tests

These tests were a little bit too flexible in terms of filenames.

llvm-svn: 220265

9 years agoRemove unused member variable.
Craig Topper [Tue, 21 Oct 2014 04:19:18 +0000 (04:19 +0000)]
Remove unused member variable.

llvm-svn: 220264

9 years ago[Gnu] Move certain options to a different group.
Shankar Easwaran [Tue, 21 Oct 2014 04:02:32 +0000 (04:02 +0000)]
[Gnu] Move certain options to a different group.

The -mllvm option is not specific to LTO.

llvm-svn: 220263

9 years ago[OPENMP] Codegen for 'private' clause in 'parallel' directive.
Alexey Bataev [Tue, 21 Oct 2014 03:16:40 +0000 (03:16 +0000)]
[OPENMP] Codegen for 'private' clause in 'parallel' directive.
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D4752

llvm-svn: 220262

9 years ago[ELF] Remove duplicate code.
Shankar Easwaran [Tue, 21 Oct 2014 03:12:57 +0000 (03:12 +0000)]
[ELF] Remove duplicate code.

The base class ELFObjectReader/ELFDSOReader implement the canParse functionaity
with this change.

llvm-svn: 220261

9 years agoRemove dead buildbot link
Eric Fiselier [Tue, 21 Oct 2014 02:46:31 +0000 (02:46 +0000)]
Remove dead buildbot link

llvm-svn: 220260

9 years ago[PECOFF] Look for decorated entry symbol name.
Rui Ueyama [Tue, 21 Oct 2014 02:28:28 +0000 (02:28 +0000)]
[PECOFF] Look for decorated entry symbol name.

Entry symbol name can be decorated. When we look for _WinMain, we
also have to look for _WinMain@16.

llvm-svn: 220259

9 years agoRemove including <complex.h> in test case, and change to use _Complex instead.
Jiangning Liu [Tue, 21 Oct 2014 02:19:58 +0000 (02:19 +0000)]
Remove including <complex.h> in test case, and change to use _Complex instead.

llvm-svn: 220258

9 years agoLower compound assignment for the missing type llvm::Type::FP128TyID.
Jiangning Liu [Tue, 21 Oct 2014 01:34:34 +0000 (01:34 +0000)]
Lower compound assignment for the missing type llvm::Type::FP128TyID.

llvm-svn: 220257

9 years agoFix a bit of confusion about .set and produce more readable assembly.
Rafael Espindola [Tue, 21 Oct 2014 01:17:30 +0000 (01:17 +0000)]
Fix a bit of confusion about .set and produce more readable assembly.

Every target we support has support for assembly that looks like

a = b - c
.long a

What is special about MachO is that the above combination suppresses the
production of a relocation.

With this change we avoid producing the intermediary labels when they don't
add any value.

llvm-svn: 220256

9 years agoDo not attribute static allocas to the call site's DebugLoc.
Paul Robinson [Tue, 21 Oct 2014 01:00:55 +0000 (01:00 +0000)]
Do not attribute static allocas to the call site's DebugLoc.

When functions are inlined, instructions without debug information are
attributed to the call site's DebugLoc. After inlining, inlined static
allocas are moved to the caller's entry block, adjacent to the caller's
original static alloca instructions. By retaining the call site's
DebugLoc, these instructions could cause instructions that were
subsequently inserted at the entry block to pick up the same DebugLoc.

Patch by Wolfgang Pieb!

llvm-svn: 220255

9 years agoMake the "synchronous" mode actually work without race conditions.
Greg Clayton [Tue, 21 Oct 2014 01:00:42 +0000 (01:00 +0000)]
Make the "synchronous" mode actually work without race conditions.

There were many issues with synchronous mode that we discovered when started to try and add a "batch" mode. There was a race condition where the event handling thread might consume events when in sync mode and other times the Process::WaitForProcessToStop() would consume them. This also led to places where the Process IO handler might or might not get popped when it needed to be.

llvm-svn: 220254

9 years agoMake this test a bit more strict.
Rafael Espindola [Tue, 21 Oct 2014 00:47:49 +0000 (00:47 +0000)]
Make this test a bit more strict.

llvm-svn: 220253

9 years agoTeach lit to filter the host LDFLAGS down from the build system and into
Chandler Carruth [Tue, 21 Oct 2014 00:36:28 +0000 (00:36 +0000)]
Teach lit to filter the host LDFLAGS down from the build system and into
the CGO build environment. This lets things like -rpath propagate down
to the C++ code that is built along side the Go bindings when testing
them.

Patch by Peter Collingbourne, and verified that it works by me.

llvm-svn: 220252

9 years agoPR21202: Memory leak in Windows RWMutexImpl when using SRWLOCK
David Blaikie [Tue, 21 Oct 2014 00:34:39 +0000 (00:34 +0000)]
PR21202: Memory leak in Windows RWMutexImpl when using SRWLOCK

llvm-svn: 220251

9 years agoMake AsmPrinter::EmitLabelOffsetDifference a static helper and simplify.
Rafael Espindola [Tue, 21 Oct 2014 00:25:49 +0000 (00:25 +0000)]
Make AsmPrinter::EmitLabelOffsetDifference a static helper and simplify.

It had exactly one caller in a position where we know hasSetDirective is true.

llvm-svn: 220250

9 years ago[MCJIT] Temporarily revert r220245 - it broke several bots.
Lang Hames [Tue, 21 Oct 2014 00:24:02 +0000 (00:24 +0000)]
[MCJIT] Temporarily revert r220245 - it broke several bots.

(See e.g. http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/17653)

llvm-svn: 220249

9 years agoIntroduce enum values for previously defined metadata types. (NFC)
Philip Reames [Tue, 21 Oct 2014 00:13:20 +0000 (00:13 +0000)]
Introduce enum values for previously defined metadata types. (NFC)

Our metadata scheme lazily assigns IDs to string metadata, but we have a mechanism to preassign them as well.  Using a preassigned ID is helpful since we get compile time type checking, and avoid some (minimal) string construction and comparison.  This change adds enum value for three existing metadata types:
+    MD_nontemporal = 9, // "nontemporal"
+    MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
+    MD_nonnull = 11 // "nonnull"

I went through an updated various uses as well.  I made no attempt to get all uses; I focused on the ones which were easily grepable and easily to translate.  For example, there were several items in LoopInfo.cpp I chose not to update.

llvm-svn: 220248

9 years agoRemove unused local variable
Alexey Samsonov [Mon, 20 Oct 2014 23:58:08 +0000 (23:58 +0000)]
Remove unused local variable

llvm-svn: 220247

9 years agoExtend the verifier to validate range metadata on calls and invokes.
Philip Reames [Mon, 20 Oct 2014 23:52:07 +0000 (23:52 +0000)]
Extend the verifier to validate range metadata on calls and invokes.

Range metadata applies to loads, call, and invokes.  We were validating that metadata applied to loads was correct according to the LangRef, but we were not validating metadata applied to calls or invokes.  This change extracts the checking functionality to a common location, reuses it for all valid locations, and adds a simple test to ensure a misused range on a call gets reported.

llvm-svn: 220246

9 years ago[MCJIT] Make MCJIT honor symbol visibility settings when populating the global
Lang Hames [Mon, 20 Oct 2014 23:39:54 +0000 (23:39 +0000)]
[MCJIT] Make MCJIT honor symbol visibility settings when populating the global
symbol table.

Patch by Anthony Pesch. Thanks Anthony!

llvm-svn: 220245

9 years agoSwitch C compilations to C11 by default.
Richard Smith [Mon, 20 Oct 2014 23:26:58 +0000 (23:26 +0000)]
Switch C compilations to C11 by default.

This is long-since overdue, and matches GCC 5.0. This should also be
backwards-compatible, because we already supported all of C11 as an extension
in C99 mode.

llvm-svn: 220244

9 years agoRevert "Improve Windows toolchain support for non-standard environments." (r220226)
Hans Wennborg [Mon, 20 Oct 2014 23:26:03 +0000 (23:26 +0000)]
Revert "Improve Windows toolchain support for non-standard environments." (r220226)

In environments where PATH was set to point to the VS installation, Clang would
override that by looking in the registry and finding the latest VS installation.

If the environment is set up to point to a VS installation, that should take
precedence.

Reverting this until we can fix it.

llvm-svn: 220243

9 years ago[X86] Fix a bug in the lowering of the mask of VSELECT.
Quentin Colombet [Mon, 20 Oct 2014 23:13:30 +0000 (23:13 +0000)]
[X86] Fix a bug in the lowering of the mask of VSELECT.
X86 code to lower VSELECT messed a bit with the bits set in the mask of VSELECT
when it knows it can be lowered into BLEND. Indeed, only the high bits need to be
set for those and it optimizes those accordingly.
However, when the mask is a compile time constant, the lowering will be handled
by the generic optimizer and those modifications will generate bad code in the
generic optimizer.

This patch fixes that by preventing the optimization if the VSELECT will be
handled by the generic optimizer.

<rdar://problem/18675020>

llvm-svn: 220242

9 years agoDriver: Consolidate the logic for naming the module crashdump cache
Justin Bogner [Mon, 20 Oct 2014 22:47:23 +0000 (22:47 +0000)]
Driver: Consolidate the logic for naming the module crashdump cache

List the module cache we use for crashdumps as a tempfile. This
simplifies how we pick up this directory when generating the actual
crash diagnostic and removes some duplicate logic.

llvm-svn: 220241

9 years agoIntroduce a 'nonnull' metadata on Load instructions.
Philip Reames [Mon, 20 Oct 2014 22:40:55 +0000 (22:40 +0000)]
Introduce a 'nonnull' metadata on Load instructions.

The newly introduced 'nonnull' metadata is analogous to existing 'nonnull' attributes, but applies to load instructions rather than call arguments or returns.  Long term, it would be nice to combine these into a single construct.   The value of the load is allowed to vary between successive loads, but null is not a valid value to be loaded by any load marked nonnull.

Reviewed by: Hal Finkel
Differential Revision:  http://reviews.llvm.org/D5220

llvm-svn: 220240

9 years ago[X86] Memory folding for commutative instructions (updated)
Simon Pilgrim [Mon, 20 Oct 2014 22:14:22 +0000 (22:14 +0000)]
[X86] Memory folding for commutative instructions (updated)

This patch improves support for commutative instructions in the x86 memory folding implementation by attempting to fold a commuted version of the instruction if the original folding fails - if that folding fails as well the instruction is 're-commuted' back to its original order before returning.

Updated version of r219584 (reverted in r219595) - the commutation attempt now explicitly ensures that neither of the commuted source operands are tied to the destination operand / register, which was the source of all the regressions that occurred with the original patch attempt.

Added additional regression test case provided by Joerg Sonnenberger.

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

llvm-svn: 220239

9 years agoDriver: Name crashdump scripts after the first temp file
Justin Bogner [Mon, 20 Oct 2014 21:47:56 +0000 (21:47 +0000)]
Driver: Name crashdump scripts after the first temp file

In practice there's only ever one temporary output file when
generating a crashdump, but even if there were many iterating over
each and creating a duplicate run script for each one wouldn't make
very much sense.

This updates the behaviour to only generate the script once, based on
the first filename.

This should make it more reasonable to generate extra output files to
include in the crashdump going forward, so I've also added a FIXME to
look into doing just that with the extra module crashdump files.

llvm-svn: 220238

9 years agoExplain why we don't always use --gc-sections.
Rafael Espindola [Mon, 20 Oct 2014 21:37:38 +0000 (21:37 +0000)]
Explain why we don't always use --gc-sections.

llvm-svn: 220237

9 years agoARM: rework Thumb1 frame index rewriting
Tim Northover [Mon, 20 Oct 2014 21:28:41 +0000 (21:28 +0000)]
ARM: rework Thumb1 frame index rewriting

The previous code had a few problems, motivating the choices here.

1. It could create instructions clobbering CPSR, but the incoming MachineInstr
   didn't reflect this. A potential source of corruption. This is why the patch
   has a new PseudoInst for before lowering.
2. Similarly, there was some code to handle the incoming instruction not being
   ARMCC::AL, but this would have caused massive problems if it was actually
   invoked when a complex offset needing more than one instruction was requested.
3. It wasn't designed to handle unaligned pointers (or offsets). These should
   probably be minimised anyway, but the code needs to deal with them properly
   regardless.
4. It had some rather dubious ad-hoc code to avoid calling
   emitThumbRegPlusImmediate, a function which should be designed to do precisely
   this job.

We seem to cover the common cases correctly now, and hopefully can enhance
emitThumbRegPlusImmediate to handle any extra optimisations we need to add in
future.

llvm-svn: 220236

9 years agoDriver: Use an early return instead of a long if condition (NFC)
Justin Bogner [Mon, 20 Oct 2014 21:20:27 +0000 (21:20 +0000)]
Driver: Use an early return instead of a long if condition (NFC)

This just flattens an if block by returning early on the "else"
condition.

llvm-svn: 220235

9 years agoDriver: Make FailingCommand mandatory for generateCompilationDiagnostics
Justin Bogner [Mon, 20 Oct 2014 21:02:05 +0000 (21:02 +0000)]
Driver: Make FailingCommand mandatory for generateCompilationDiagnostics

We currently use a null FailingCommand when generating crash reports
as an indication that the cause is FORCE_CLANG_DIAGNOSTICS_CRASH, the
environment variable that exists to test crash dumps. This means that
our tests don't actually cover real crashes at all, and adds a more
complicated code path that's only used in the tests.

Instead, we can have the driver synthesize that every command failed
and just call generateCompilationDiagnostics normally.

llvm-svn: 220234

9 years agoTry to fix GCC error about invalid use of const_cast in const version of ErrorOr...
Alexey Samsonov [Mon, 20 Oct 2014 20:41:21 +0000 (20:41 +0000)]
Try to fix GCC error about invalid use of const_cast in const version of ErrorOr::get()

llvm-svn: 220233

9 years agoConstify getELFDynamicSymbolIterators standalone function. NFC.
Alexey Samsonov [Mon, 20 Oct 2014 20:33:20 +0000 (20:33 +0000)]
Constify getELFDynamicSymbolIterators standalone function. NFC.

llvm-svn: 220232

9 years agoAdd const version of OwningBinary::getBinary
Alexey Samsonov [Mon, 20 Oct 2014 20:32:47 +0000 (20:32 +0000)]
Add const version of OwningBinary::getBinary

llvm-svn: 220231

9 years agoBe more specific about return type of MachOUniversalBinary::getObjectForArch
Alexey Samsonov [Mon, 20 Oct 2014 20:30:57 +0000 (20:30 +0000)]
Be more specific about return type of MachOUniversalBinary::getObjectForArch

llvm-svn: 220230

9 years agoFix whitespace introduced in r220221
David Blaikie [Mon, 20 Oct 2014 20:29:35 +0000 (20:29 +0000)]
Fix whitespace introduced in r220221

Post commit review feedback from Yaron Keren.

llvm-svn: 220229

9 years agoConstify input argument of RelocVisitor and DWARFContext constructors. NFC.
Alexey Samsonov [Mon, 20 Oct 2014 20:28:51 +0000 (20:28 +0000)]
Constify input argument of RelocVisitor and DWARFContext constructors. NFC.

llvm-svn: 220228

9 years agoTeach Lit to catch OSError exceptions when creating a process during the
Dan Liew [Mon, 20 Oct 2014 20:14:28 +0000 (20:14 +0000)]
Teach Lit to catch OSError exceptions when creating a process during the
execution of a shell command. This can happen for example if the
``RUN:`` line calls a python script which can work correctly under
Linux/OSX but will not work under Windows. A more useful error message
is now shown rather than an unhelpful backtrace.

llvm-svn: 220227

9 years agoImprove Windows toolchain support for non-standard environments.
Zachary Turner [Mon, 20 Oct 2014 20:08:04 +0000 (20:08 +0000)]
Improve Windows toolchain support for non-standard environments.

Typically clang finds Visual Studio by the user explicitly setting
up a Visual Studio environment via vcvarsall.  But we still try to
behave intelligently and fallback to different methods of finding
Visual Studio when this is not done.  This patch improves various
fallback codepaths to make Visual Studio locating more robust.

Specifically, this patch:

* Adds support for searching environment variables for VS 12.0
* Correctly locates include folders for Windows SDK 8.x (this was
  previously broken, and would cause clang to error)
* Prefers locating link.exe in the same location as cl.exe.  This
  is helpful in case another link.exe is in the path earlier than
  Visual Studio (e.g. GnuWin32)
* Minor cleanup in the registry reading code to make it more
  robust in the presence of long pathnames.

llvm-svn: 220226

9 years agoMoved out IIT_V64 from common values section.
Robert Khasanov [Mon, 20 Oct 2014 19:25:05 +0000 (19:25 +0000)]
Moved out IIT_V64 from common values section.
Thanks Juergen Ributzka for notice.

llvm-svn: 220224

9 years agoPR21312: Fix a regression in non-type template parameters of function type that are...
David Blaikie [Mon, 20 Oct 2014 18:56:54 +0000 (18:56 +0000)]
PR21312: Fix a regression in non-type template parameters of function type that are static member functions.

llvm-svn: 220221

9 years agoDon't allow the expression parser to magically
Sean Callanan [Mon, 20 Oct 2014 18:36:58 +0000 (18:36 +0000)]
Don't allow the expression parser to magically
look through 'self' at its ivars.  It produces
surprising results.

<rdar://problem/18698760>

llvm-svn: 220220

9 years agoSkip dsym test on !Darwin
Ed Maste [Mon, 20 Oct 2014 18:12:46 +0000 (18:12 +0000)]
Skip dsym test on !Darwin

r219978 fixed this test to work on Darwin, and removed the expected
failure decorator, but it then started running (and failing) on FreeBSD.

I'd think @dsym_test should skip the test on all non-Darwin operating
systems. It seems not to be the case, so for now skip it the same way as
done for other @dsym_test tests.

llvm-svn: 220219

9 years agoDon't use mkstemp, as it doesn't exist on Windows.
Zachary Turner [Mon, 20 Oct 2014 17:46:56 +0000 (17:46 +0000)]
Don't use mkstemp, as it doesn't exist on Windows.

Differential Revision: http://reviews.llvm.org/D5849
Reviewed by: Jason Molenda

llvm-svn: 220218

9 years agoRemove LLDB_DEFAULT_SHELL #define, and determine this at runtime.
Zachary Turner [Mon, 20 Oct 2014 17:46:43 +0000 (17:46 +0000)]
Remove LLDB_DEFAULT_SHELL #define, and determine this at runtime.

Differential Revision: http://reviews.llvm.org/D5805
Reviewed by: Greg Clayton

llvm-svn: 220217

9 years agoFix indentation.
David Blaikie [Mon, 20 Oct 2014 17:42:23 +0000 (17:42 +0000)]
Fix indentation.

llvm-svn: 220216

9 years agoAdd RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfo
Hal Finkel [Mon, 20 Oct 2014 17:32:04 +0000 (17:32 +0000)]
Add RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfo

Clang supports __restrict__ as a function qualifier, but
DeclaratorChunk::FunctionTypeInfo lacked a field to track the qualifier's
source location (as we do with volatile, etc.). This was the subject of a FIXME
in GetFullTypeForDeclarator (in SemaType.cpp). This should also prove useful as
we add more warnings regarding questionable uses of the restrict qualifier.

There is no significant functional change (except for an improved source range
associated with the err_invalid_qualified_function_type diagnostic fixit
generated by GetFullTypeForDeclarator).

llvm-svn: 220215

9 years agoRevert most of r215810, which is no longer needed
Ben Langmuir [Mon, 20 Oct 2014 16:27:32 +0000 (16:27 +0000)]
Revert most of r215810, which is no longer needed

Now that we no longer add mappings when there are no local entities,
there is no need to always bump the size of the tables that correspond
to ContinuousRangeMaps.

llvm-svn: 220208

9 years agoDon't add ID mappings for offsets with no entities in a module
Ben Langmuir [Mon, 20 Oct 2014 16:27:30 +0000 (16:27 +0000)]
Don't add ID mappings for offsets with no entities in a module

This is a better fix for 'duplicate key' problems in module continuous
range maps (vs what I added in r215810) by not adding any mappings at
all when there are no local entities. Now it also covers selectors,
which were not always being bumped because the record SELECTOR_OFFSET is
not always emitted.  I'll back out most of r215810 in a future commit,
since it should no longer be needed.

llvm-svn: 220207

9 years ago[AArch64] test case for compfail fixed by r219748
Gerolf Hoflehner [Mon, 20 Oct 2014 16:08:33 +0000 (16:08 +0000)]
[AArch64] test case for compfail fixed by r219748

llvm-svn: 220206

9 years agoFix Intrinsic::getType not working with vararg
Steven Wu [Mon, 20 Oct 2014 15:47:24 +0000 (15:47 +0000)]
Fix Intrinsic::getType not working with vararg

VarArg Intrinsic functions are encoded with "void" type as the last
argument. Now Intrinsic::getType can correctly return all the intrinsic
function type.

llvm-svn: 220205

9 years ago[Thumb2] RFE, SRS and "SUBS pc, lr" are undefined on v7M
Oliver Stannard [Mon, 20 Oct 2014 15:37:35 +0000 (15:37 +0000)]
[Thumb2] RFE, SRS and "SUBS pc, lr" are undefined on v7M

These instructions are related to the v7[AR] exception model, and are
not defined on v7M.

llvm-svn: 220204

9 years agoFix checks for Android.
Dan Albert [Mon, 20 Oct 2014 15:35:01 +0000 (15:35 +0000)]
Fix checks for Android.

__ANDROID__ is a define that comes from the toolchain when building
for Android targets. ANDROID has a different meaning. ANDROID is
defined for _every_ Android build, including those done for host
modules. For host modules, we want to build the regular Linux
sanitizers and builtins, not the one for Android devices. This hasn't
been a problem until now because we only just started building the
sanitizers for the host.

llvm-svn: 220203

9 years agoclang-format: Fix overloaded operator edge case.
Daniel Jasper [Mon, 20 Oct 2014 13:56:30 +0000 (13:56 +0000)]
clang-format: Fix overloaded operator edge case.

Before:
  template <class F>
  void Call(F f) {
    f.template operator() <int>();
  }

After:
  template <class F>
  void Call(F f) {
    f.template operator()<int>();
  }

llvm-svn: 220202

9 years agoD5823: Fix typo in Clang test arm-cortex-cpus.c; patch by Gabor Ballabas!
Artyom Skrobov [Mon, 20 Oct 2014 13:48:19 +0000 (13:48 +0000)]
D5823: Fix typo in Clang test arm-cortex-cpus.c; patch by Gabor Ballabas!

llvm-svn: 220201

9 years agoRemove unnecessary else.
Sid Manning [Mon, 20 Oct 2014 13:08:19 +0000 (13:08 +0000)]
Remove unnecessary else.

llvm-svn: 220200

9 years ago[clang-tidy] Add support for custom configuration file names/formats.
Alexander Kornienko [Mon, 20 Oct 2014 12:29:15 +0000 (12:29 +0000)]
[clang-tidy] Add support for custom configuration file names/formats.

Summary: We're using different clang-tidy frontends (command-line, batch analysis jobs, code review integration), some of which are limited in the choice of configuration format. In order to avoid duplication of configuration information, we need to support the same configuration format in the command-line tool. This patch adds an extension point to make this possible without rewriting FileOptionsProvider.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 220199

9 years agoRevert r220174, "Always use -Wl,-gc-sections on our build."
NAKAMURA Takumi [Mon, 20 Oct 2014 12:12:21 +0000 (12:12 +0000)]
Revert r220174, "Always use -Wl,-gc-sections on our build."

It dropped required functions for plugins with gnu ld 2.20 and 2.21.

  Failing Tests (1):
      LLVM :: Feature/load_module.ll

  Hello: bin/opt: symbol lookup error: lib/LLVMHello.so: undefined symbol: _ZN4llvm11raw_ostream13write_escapedENS_9StringRefEb

  Failing Tests (1):
      Clang :: Frontend/plugins.c

  error: unable to load plugin 'lib/PrintFunctionNames.so': 'lib/PrintFunctionNames.so: undefined symbol: _ZN5clang15PluginASTAction6anchorEv'

I think we should inspect linker's version or behavior to introduce --gc-sections for --export-dynamic.

llvm-svn: 220198

9 years agoclang-format: [ObjC] Fix using selector names as macro arguments.
Daniel Jasper [Mon, 20 Oct 2014 12:01:45 +0000 (12:01 +0000)]
clang-format: [ObjC] Fix using selector names as macro arguments.

Before:
  [self aaaaa:MACRO(a, b :, c :)];

After:
  [self aaaaa:MACRO(a, b:, c:)];

llvm-svn: 220197