platform/upstream/llvm.git
10 years ago[asan] relax the test for long double
Kostya Serebryany [Thu, 22 May 2014 14:50:14 +0000 (14:50 +0000)]
[asan] relax the test for long double

llvm-svn: 209445

10 years ago[ASan/Win] Make sure the list of wrappers exported by the main module and imported...
Timur Iskhodzhanov [Thu, 22 May 2014 14:49:56 +0000 (14:49 +0000)]
[ASan/Win] Make sure the list of wrappers exported by the main module and imported by the DLL thunk always matches

llvm-svn: 209444

10 years agoARM64: remove '#' from annotation of add/sub immediate
Tim Northover [Thu, 22 May 2014 14:20:05 +0000 (14:20 +0000)]
ARM64: remove '#' from annotation of add/sub immediate

The full string used to be "// =#12" for example, which looks too
busy.

llvm-svn: 209443

10 years agoAdd support for missed and analysis optimization remarks.
Diego Novillo [Thu, 22 May 2014 14:19:46 +0000 (14:19 +0000)]
Add support for missed and analysis optimization remarks.

Summary:
This adds two new diagnostics: -pass-remarks-missed and
-pass-remarks-analysis. They take the same values as -pass-remarks but
are intended to be triggered in different contexts.

-pass-remarks-missed is used by LLVMContext::emitOptimizationRemarkMissed,
which passes call when they tried to apply a transformation but
couldn't.

-pass-remarks-analysis is used by LLVMContext::emitOptimizationRemarkAnalysis,
which passes call when they want to inform the user about analysis
results.

The patch also:

1- Adds support in the inliner for the two new remarks and a
   test case.

2- Moves emitOptimizationRemark* functions to the llvm namespace.

3- Adds an LLVMContext argument instead of making them member functions
   of LLVMContext.

Reviewers: qcolombet

Subscribers: llvm-commits

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

llvm-svn: 209442

10 years ago[ASan/Win] Thread more library functions from the DLL thunk to the main module
Timur Iskhodzhanov [Thu, 22 May 2014 13:57:22 +0000 (13:57 +0000)]
[ASan/Win] Thread more library functions from the DLL thunk to the main module

llvm-svn: 209441

10 years agoclang-format: Don't use Allman brace breaking for ObjC blocks.
Daniel Jasper [Thu, 22 May 2014 13:53:55 +0000 (13:53 +0000)]
clang-format: Don't use Allman brace breaking for ObjC blocks.

It just seems wrong. This fixes llvm.org/PR19736.

llvm-svn: 209440

10 years ago[ASan/Win] Add more tests for operator new[]
Timur Iskhodzhanov [Thu, 22 May 2014 13:28:27 +0000 (13:28 +0000)]
[ASan/Win] Add more tests for operator new[]

llvm-svn: 209439

10 years agoclang-format: Fix corner case in AllowShortBlocksOnASingleLine.
Daniel Jasper [Thu, 22 May 2014 13:25:26 +0000 (13:25 +0000)]
clang-format: Fix corner case in AllowShortBlocksOnASingleLine.

Before:
  template <int> struct A4 { A4() { }
  };

After:
  template <int i> struct A4 {
    A4() {}
  };

This fixes llvm.org/PR19813 (at least the part that isn't working as
intended).

llvm-svn: 209438

10 years agoMachO: look for nearby tools on all MachO platforms.
Tim Northover [Thu, 22 May 2014 13:12:14 +0000 (13:12 +0000)]
MachO: look for nearby tools on all MachO platforms.

This brings "-arch armv7m" (etc) behaviour more in line with what's expected
for developers on OS X, and allows Clang to find an "ld" (for example) in the
same directory instead of using the default /usr/bin/ld.

Unfortunately no test because it relies on the specific place Clang is running
from.

rdar://problem/16427320

llvm-svn: 209437

10 years agoSegmented stacks: omit __morestack call when there's no frame.
Tim Northover [Thu, 22 May 2014 13:03:43 +0000 (13:03 +0000)]
Segmented stacks: omit __morestack call when there's no frame.

Patch by Florian Zeitz

llvm-svn: 209436

10 years agoRevert "TMP"
Tim Northover [Thu, 22 May 2014 12:55:29 +0000 (12:55 +0000)]
Revert "TMP"

This reverts r209433. Sorry about that, it needs a test & better message.

llvm-svn: 209435

10 years agoMachO: perform ARM ABI detection even for non-Darwin triples.
Tim Northover [Thu, 22 May 2014 12:54:30 +0000 (12:54 +0000)]
MachO: perform ARM ABI detection even for non-Darwin triples.

When "-arch armv7m" is specified, we want "aapcs", for example.

rdar://problem/16581138

llvm-svn: 209434

10 years agoTMP
Tim Northover [Thu, 22 May 2014 12:54:24 +0000 (12:54 +0000)]
TMP

llvm-svn: 209433

10 years agoUse stack protector strong by default on OpenBSD.
Rafael Espindola [Thu, 22 May 2014 12:52:35 +0000 (12:52 +0000)]
Use stack protector strong by default on OpenBSD.

Use stack protector strong by default to match the base OS and ports/packages
compiler policy.

Patch by Brad Smith.

llvm-svn: 209432

10 years agoclang-format: Fix braced list detection.
Daniel Jasper [Thu, 22 May 2014 12:46:38 +0000 (12:46 +0000)]
clang-format: Fix braced list detection.

Before:
  static_assert(std::is_integral<int> {} + 0, "");
  int a = std::is_integral<int> {}
  + 0;

After:
  static_assert(std::is_integral<int>{} + 0, "");
  int a = std::is_integral<int>{} + 0;

llvm-svn: 209431

10 years agoARM64: these work too
Tim Northover [Thu, 22 May 2014 12:14:49 +0000 (12:14 +0000)]
ARM64: these work too

llvm-svn: 209430

10 years agoYes they do
Tim Northover [Thu, 22 May 2014 12:14:02 +0000 (12:14 +0000)]
Yes they do

llvm-svn: 209429

10 years agoclang-format: Fix incorrect braced init identification.
Daniel Jasper [Thu, 22 May 2014 12:11:13 +0000 (12:11 +0000)]
clang-format: Fix incorrect braced init identification.

Before:
  int foo(int i) {
    return fo1 {}
    (i);
  }
  int foo(int i) {
    return fo1 {}
    (i);
  }

After:
  int foo(int i) { return fo1{}(i); }
  int foo(int i) { return fo1{}(i); }

This fixes llvm.org/PR19812.

llvm-svn: 209428

10 years ago[ASan/Win] Use the new function interception approach to handle function wrappers...
Timur Iskhodzhanov [Thu, 22 May 2014 12:03:40 +0000 (12:03 +0000)]
[ASan/Win] Use the new function interception approach to handle function wrappers too; wrap strlen() in DLLs

Reviewed at http://reviews.llvm.org/D3871

llvm-svn: 209427

10 years agoARM64: model pre/post-indexed operations properly.
Tim Northover [Thu, 22 May 2014 11:56:20 +0000 (11:56 +0000)]
ARM64: model pre/post-indexed operations properly.

We should be keeping track of the writeback on these instructions,
otherwise we're relying on LLVM's stupidity for correct code.

Fortunately, the MC layer can now handle all required constraints,
which means we can get rid of the CodeGen only PseudoInsts too.

llvm-svn: 209426

10 years agoARM64: separate load/store operands to simplify assembler
Tim Northover [Thu, 22 May 2014 11:56:09 +0000 (11:56 +0000)]
ARM64: separate load/store operands to simplify assembler

This changes ARM64 to use separate operands for each component of an
address, and look for separate '[', '$Rn, ..., ']' tokens when
parsing.

This allows us to do away with quite a bit of special C++ code to
handle monolithic "addressing modes" in the MC components. The more
incremental matching of the assembler operands also allows for better
diagnostics when LLVM is presented with invalid input.

Most of the complexity here is with the register-offset instructions,
which were extremely dodgy beforehand: even when the instruction used
wM, LLVM's model had xM as an operand. We papered over this
discrepancy before, but that approach doesn't work now so I split them
into separate X and W variants.

llvm-svn: 209425

10 years ago[mips] Make unalignedload.ll test stricter and easier to modify for MIPS32r6/MIPS64r6
Daniel Sanders [Thu, 22 May 2014 11:55:04 +0000 (11:55 +0000)]
[mips] Make unalignedload.ll test stricter and easier to modify for MIPS32r6/MIPS64r6

Summary:
* Split into two functions, one to test each struct.
* R0 and R2 must be defined by an lw with a %got reference to the correct
  symbol.
* Test for $4 (first argument) where appropriate instead of accepting any
  register.
* Test that the two lbu's are correctly combined into $4

Depends on D3844

Reviewers: jkolek, zoran.jovanovic, vmedic

Reviewed By: vmedic

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

llvm-svn: 209424

10 years ago[mips] Change lwl and lwr in inlineasm_constraint.ll to lw
Daniel Sanders [Thu, 22 May 2014 11:51:06 +0000 (11:51 +0000)]
[mips] Change lwl and lwr in inlineasm_constraint.ll to lw

Summary:
lwl and lwr are not available in MIPS32r6/MIPS64r6. The purpose of the test
is to check that the '$1' expands to '0($x)' rather than to test something related
to the lwl or lwr instructions so we can simply switch to lw.

Depends on D3842

Reviewers: jkolek, zoran.jovanovic, vmedic

Reviewed By: vmedic

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

llvm-svn: 209423

10 years agoclang-format: Store pointers to seen formatting states.
Daniel Jasper [Thu, 22 May 2014 11:47:01 +0000 (11:47 +0000)]
clang-format: Store pointers to seen formatting states.

As the memory ownership is handled by the SpecificBumpPtrAllocator
anyway, there is no need to duplicate states when inserting them into
the Seen-set. This leads to an improvement of ~10% on the benchmark
formatting file.

No functional changes intended.

llvm-svn: 209422

10 years ago[mips] Use addiu in inline assembly tests since addi is not available in all ISA's
Daniel Sanders [Thu, 22 May 2014 11:46:58 +0000 (11:46 +0000)]
[mips] Use addiu in inline assembly tests since addi is not available in all ISA's

Summary:
This patch is necessary so that they do not fail on MIPS32r6/MIPS64r6 when
-integrated-as is enabled by default and we correctly detect the host CPU.

No functional change since these tests are testing the behaviour of the
constraint used for the third operand rather than the mnemonic.

Depends on D3842

Reviewers: zoran.jovanovic, jkolek, vmedic

Reviewed By: vmedic

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

llvm-svn: 209421

10 years agoExtend sys::getHostCPUFeatures to work on AArch64 platforms
Bradley Smith [Thu, 22 May 2014 11:44:34 +0000 (11:44 +0000)]
Extend sys::getHostCPUFeatures to work on AArch64 platforms

llvm-svn: 209420

10 years ago[mips][mips64r6] addi is not available on MIPS32r6/MIPS64r6
Daniel Sanders [Thu, 22 May 2014 11:42:31 +0000 (11:42 +0000)]
[mips][mips64r6] addi is not available on MIPS32r6/MIPS64r6

Summary: Depends on D3787. Tablegen will raise an assertion without it.

Reviewers: zoran.jovanovic, jkolek, vmedic

Reviewed By: vmedic

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

llvm-svn: 209419

10 years ago[mips][mips64r6] Test that paired single instructions are invalid
Daniel Sanders [Thu, 22 May 2014 11:37:38 +0000 (11:37 +0000)]
[mips][mips64r6] Test that paired single instructions are invalid

Summary:
These emit the 'unknown instruction' instead of the correct error
because they have not been implemented in LLVM for any MIPS ISA.

Reviewers: jkolek, zoran.jovanovic, vmedic

Reviewed By: vmedic

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

llvm-svn: 209418

10 years agoclang-format: Fix vim-integration for empty files.
Daniel Jasper [Thu, 22 May 2014 11:37:05 +0000 (11:37 +0000)]
clang-format: Fix vim-integration for empty files.

Discovered by Ahmed Charles in http://reviews.llvm.org/D3018.

llvm-svn: 209417

10 years ago[ASan/Win] Don't use INTERCEPTOR_ATTRIBUTE for operator new/delete on Windows
Timur Iskhodzhanov [Thu, 22 May 2014 11:31:21 +0000 (11:31 +0000)]
[ASan/Win] Don't use INTERCEPTOR_ATTRIBUTE for operator new/delete on Windows

Reviewed at http://reviews.llvm.org/D3870

llvm-svn: 209416

10 years ago[mips][mips64r6] Add b[on]vc
Daniel Sanders [Thu, 22 May 2014 11:23:21 +0000 (11:23 +0000)]
[mips][mips64r6] Add b[on]vc

Summary:
This required me to implement the disassembler for MIPS64r6 since the encodings
are ambiguous with other instructions. This in turn revealed a few
assembly/disassembly bugs which I have fixed.

* da[ht]i only take two operands according to the spec, not three.
* DecodeBranchTarget2[16] correctly handles wider immediates than simm16
  * Also made non-functional change to DecodeBranchTarget and
    DecodeBranchTargetMM to keep implementation style consistent between
    them.
* Difficult encodings are handled by a custom decode method on the most
  general encoding in the group. This method will convert the MCInst to a
  different opcode if necessary.

DecodeBranchTarget is not currently the inverse of getBranchTargetOpValue
so disassembling some branch instructions emit incorrect output. This seems
to affect branches with delay slots on all MIPS ISA's. I've left this bug
for now and temporarily removed the check for the immediate on
bc[12]eqz/bc[12]nez in the MIPS32r6/MIPS64r6 tests.

jialc and jic crash the disassembler for some reason. I've left these
instructions commented out for the moment.

Depends on D3760

Reviewers: jkolek, zoran.jovanovic, vmedic

Reviewed By: vmedic

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

llvm-svn: 209415

10 years ago[ASan/Win] Add a comment about DCL-using-static vs threads
Timur Iskhodzhanov [Thu, 22 May 2014 10:24:48 +0000 (10:24 +0000)]
[ASan/Win] Add a comment about DCL-using-static vs threads

llvm-svn: 209414

10 years agoclang-format: [JS] Understand line breaks in concatenated strings.
Daniel Jasper [Thu, 22 May 2014 09:10:04 +0000 (09:10 +0000)]
clang-format: [JS] Understand line breaks in concatenated strings.

Before:
  var literal = 'hello ' + 'world';

After:
  var literal = 'hello ' +
                'world';

There is no reason to concatenated two string literals with a '+' unless
the line break is intended.

llvm-svn: 209413

10 years agoclang-format: Correctly identify multiplications in braces init lists.
Daniel Jasper [Thu, 22 May 2014 09:00:33 +0000 (09:00 +0000)]
clang-format: Correctly identify multiplications in braces init lists.

Before:
  int i{a *b};

After:
  int i{a * b};

Also fix unrelated issue where braced init lists were counted as blocks
and prevented single-line functions.

llvm-svn: 209412

10 years agoThis patch adds a helper class (CGLoopInfo) for marking memory instructions with...
Alexander Musman [Thu, 22 May 2014 08:54:05 +0000 (08:54 +0000)]
This patch adds a helper class (CGLoopInfo) for marking memory instructions with llvm.mem.parallel_loop_access metadata.
It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses).

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

llvm-svn: 209411

10 years agoclang-format: Correctly calculate line lenghts for nest blocks.
Daniel Jasper [Thu, 22 May 2014 08:36:53 +0000 (08:36 +0000)]
clang-format: Correctly calculate line lenghts for nest blocks.

If simple (one-statement) blocks can be inlined, the length needs to be
calculated correctly.

Before (in JavaScript but this also affects lambdas, etc.):
  var x = {
    valueOf: function() { return 1; }
  };

After:
  var x = {valueOf: function() { return 1; }};

llvm-svn: 209410

10 years agoARM64: assert if we see i64 -> i64 extend in the DAG.
Tim Northover [Thu, 22 May 2014 07:41:37 +0000 (07:41 +0000)]
ARM64: assert if we see i64 -> i64 extend in the DAG.

Should be no change in behaviour, but it makes the intended
functionality a bit clearer and means we only have to reason about
real extend operations.

llvm-svn: 209409

10 years agoAArch64/ARM64: enable more AArch64 tests.
Tim Northover [Thu, 22 May 2014 07:40:55 +0000 (07:40 +0000)]
AArch64/ARM64: enable more AArch64 tests.

llvm-svn: 209408

10 years agoFrontend: Propagate ASTReaderListener API in ChainedASTReaderListener
Justin Bogner [Thu, 22 May 2014 06:04:59 +0000 (06:04 +0000)]
Frontend: Propagate ASTReaderListener API in ChainedASTReaderListener

ASTReaderListener's documentation states that visitInputFile will be
called based on the return values of needsInputFileVisitation and
needsSystemInputFileVisitation, but ChainedASTReaderListener may call
these methods on a child listener based on the values returned by the
other child.

Even worse, the calls to visitInputFile may be short-circuited due to
the use of the boolean or, so the calls to visit may not occur at all
for the second listener.

This updates ChainedASTReaderListener::visitInputFile to propagate the
ASTReaderListener behaviour to both children.

llvm-svn: 209394

10 years agoMC: initialise MCAsmParser variable
Saleem Abdulrasool [Thu, 22 May 2014 06:02:59 +0000 (06:02 +0000)]
MC: initialise MCAsmParser variable

Properly initialise HadError to false during construction.  Detected as
use-of-uninitialised variable by MSan!

llvm-svn: 209393

10 years ago[C++11] Use 'nullptr'. Serialization edition.
Craig Topper [Thu, 22 May 2014 05:54:18 +0000 (05:54 +0000)]
[C++11] Use 'nullptr'. Serialization edition.

llvm-svn: 209392

10 years agoRemove unused variable.
Eric Christopher [Thu, 22 May 2014 05:33:03 +0000 (05:33 +0000)]
Remove unused variable.

llvm-svn: 209391

10 years agoARM: introduce llvm.arm.undefined intrinsic
Saleem Abdulrasool [Thu, 22 May 2014 04:46:46 +0000 (04:46 +0000)]
ARM: introduce llvm.arm.undefined intrinsic

This intrinsic permits the emission of platform specific undefined sequences.
ARM has reserved the 0xde opcode which takes a single integer parameter (ignored
by the CPU).  This permits the operating system to implement custom behaviour on
this trap.  The llvm.arm.undefined intrinsic is meant to provide a means for
generating the target specific behaviour from the frontend.  This is
particularly useful for Windows on ARM which has made use of a series of these
special opcodes.

llvm-svn: 209390

10 years ago[C++11] Use 'nullptr'. Frontend edition.
Craig Topper [Thu, 22 May 2014 04:46:25 +0000 (04:46 +0000)]
[C++11] Use 'nullptr'. Frontend edition.

llvm-svn: 209389

10 years agoR600/SI: Match fp_to_uint / uint_to_fp for f64
Matt Arsenault [Thu, 22 May 2014 03:20:30 +0000 (03:20 +0000)]
R600/SI: Match fp_to_uint / uint_to_fp for f64

llvm-svn: 209388

10 years agoMC: formalise some assertions into proper errors
Saleem Abdulrasool [Thu, 22 May 2014 02:18:10 +0000 (02:18 +0000)]
MC: formalise some assertions into proper errors

Now that clang can be used as an assembler via the IAS, invalid assembler inputs
would cause the assertions to trigger.  Although we cannot recover from the
errors here, nor provide caret diagnostics, attempt to handle them slightly more
gracefully by reporting a fatal error.

llvm-svn: 209387

10 years agoOverride runOnMachineFunction for ARMISelDAGToDAG so that we can
Eric Christopher [Thu, 22 May 2014 02:00:27 +0000 (02:00 +0000)]
Override runOnMachineFunction for ARMISelDAGToDAG so that we can
reset the subtarget on each function.

llvm-svn: 209386

10 years ago[mach-o] Remove MachOFormat.hpp, everything now uses llvm/Support/MachO.h
Nick Kledzik [Thu, 22 May 2014 01:56:40 +0000 (01:56 +0000)]
[mach-o] Remove MachOFormat.hpp, everything now uses llvm/Support/MachO.h

llvm-svn: 209385

10 years agoOverride runOnMachineFunction for X86ISelDAGToDAG so that we can
Eric Christopher [Thu, 22 May 2014 01:53:26 +0000 (01:53 +0000)]
Override runOnMachineFunction for X86ISelDAGToDAG so that we can
reset the subtarget on each function.

llvm-svn: 209384

10 years ago[mach-o] Use lit.local.cfg to enable mach-o test cases to be run
Nick Kledzik [Thu, 22 May 2014 01:47:17 +0000 (01:47 +0000)]
[mach-o] Use lit.local.cfg to enable mach-o test cases to be run

llvm-svn: 209383

10 years agoAvoid using subtarget features when adding X86 specific passes to
Eric Christopher [Thu, 22 May 2014 01:46:02 +0000 (01:46 +0000)]
Avoid using subtarget features when adding X86 specific passes to
the pass pipeline.

llvm-svn: 209382

10 years agoRemove extra local variable.
Eric Christopher [Thu, 22 May 2014 01:45:59 +0000 (01:45 +0000)]
Remove extra local variable.

llvm-svn: 209381

10 years agoRename createGlobalBaseRegPass -> createX86GlobalBaseRegPass to make
Eric Christopher [Thu, 22 May 2014 01:45:57 +0000 (01:45 +0000)]
Rename createGlobalBaseRegPass -> createX86GlobalBaseRegPass to make
it obvious that it's a target specific pass.

llvm-svn: 209380

10 years ago[mach-o] parse literal sections into atoms
Nick Kledzik [Thu, 22 May 2014 01:42:06 +0000 (01:42 +0000)]
[mach-o] parse literal sections into atoms

llvm-svn: 209379

10 years agoAdd hasSameType overload to ASTContext for Type pointers. Switch a type
Richard Trieu [Thu, 22 May 2014 01:39:16 +0000 (01:39 +0000)]
Add hasSameType overload to ASTContext for Type pointers.  Switch a type
comparison check to use this instead of calling Type::getCanonicalTypeInternal

llvm-svn: 209378

10 years agoFix typo.
Eric Christopher [Thu, 22 May 2014 01:21:44 +0000 (01:21 +0000)]
Fix typo.

llvm-svn: 209377

10 years agoAvoid using subtarget features when initializing the pass pipeline
Eric Christopher [Thu, 22 May 2014 01:21:35 +0000 (01:21 +0000)]
Avoid using subtarget features when initializing the pass pipeline
on PPC.

llvm-svn: 209376

10 years agoReset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.
Eric Christopher [Thu, 22 May 2014 01:07:24 +0000 (01:07 +0000)]
Reset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.
This required updating the generated functions and TD file accordingly
to be pointers rather than const references.

llvm-svn: 209375

10 years agoReset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.
Eric Christopher [Thu, 22 May 2014 01:07:21 +0000 (01:07 +0000)]
Reset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.

llvm-svn: 209374

10 years agoSort includes.
Eric Christopher [Thu, 22 May 2014 01:07:18 +0000 (01:07 +0000)]
Sort includes.

llvm-svn: 209373

10 years agoDebugInfo: Simplify dead variable collection slightly.
David Blaikie [Thu, 22 May 2014 00:48:36 +0000 (00:48 +0000)]
DebugInfo: Simplify dead variable collection slightly.

constructSubprogramDIE was already called for every subprogram in every
CU when the module was started - there's no need to call it again at
module finalization.

llvm-svn: 209372

10 years agoFix a bug in SCEV's backedge taken count computation from my prior fix in Jan.
Andrew Trick [Thu, 22 May 2014 00:37:03 +0000 (00:37 +0000)]
Fix a bug in SCEV's backedge taken count computation from my prior fix in Jan.

This has to do with the trip count computation for loops with multiple
exits, which is quite subtle. Most passes just ask for a single trip
count number, so we must be conservative assuming any exit could be
taken.  Normally, we rely on the "exact" trip count, which was
correctly given as "unknown". However, SCEV also gives a "max"
back-edge taken count. The loops max BE taken count is conservatively
a maximum over the max of each exit's non-exiting iterations
count. Note that some exit tests can be skipped so the max loop
back-edge taken count can actually exceed the max non-exiting
iterations for some exits. However, when we know the loop *latch*
cannot be skipped, we can directly use its max taken count
disregarding other exits. I previously took the minimum here without
checking whether the other exit could be skipped. The correct, and
simpler thing to do here is just to directly use the loop latch's max
non-exiting iterations as the loops max back-edge count.

In the problematic test case, the first loop exit had a max of zero
non-exiting iterations, but could be skipped. The loop latch was known
not to be skipped but had max of one non-exiting iteration. We
incorrectly claimed the loop back-edge could be taken zero times, when
it is actually taken one time.

Fixes Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count.
Loop %for.body.i: max backedge-taken count is 1.

llvm-svn: 209358

10 years agoSimplify nullptr check.
Rui Ueyama [Thu, 22 May 2014 00:36:36 +0000 (00:36 +0000)]
Simplify nullptr check.

llvm-svn: 209357

10 years agoSimilar to bitcast, treat addrspacecast as a foldable operand.
Eli Bendersky [Thu, 22 May 2014 00:02:52 +0000 (00:02 +0000)]
Similar to bitcast, treat addrspacecast as a foldable operand.

Added a test sink-addrspacecast.ll to verify this change.

Patch by Jingyue Wu.

llvm-svn: 209343

10 years agoFix compilation issues.
Eric Christopher [Wed, 21 May 2014 23:51:57 +0000 (23:51 +0000)]
Fix compilation issues.

llvm-svn: 209342

10 years agoChange ProcessKDP::DoReadMemory() to break up large memory
Jason Molenda [Wed, 21 May 2014 23:44:02 +0000 (23:44 +0000)]
Change ProcessKDP::DoReadMemory() to break up large memory
read requests into smaller chunks; some remote kdp stubs
cannot handle memory reads larger than a KB or two & will
error out.
<rdar://problem/16983125>

llvm-svn: 209341

10 years agoMake early if conversion dependent upon the subtarget and add
Eric Christopher [Wed, 21 May 2014 23:40:26 +0000 (23:40 +0000)]
Make early if conversion dependent upon the subtarget and add
a subtarget hook to enable. Unconditionally add to the pass pipeline
for targets that might want to use it. No functional change.

llvm-svn: 209340

10 years agoGroup the scheduling functions together.
Eric Christopher [Wed, 21 May 2014 23:40:18 +0000 (23:40 +0000)]
Group the scheduling functions together.

llvm-svn: 209339

10 years agoRevert "DebugInfo: Don't put fission type units in comdat sections."
David Blaikie [Wed, 21 May 2014 23:27:41 +0000 (23:27 +0000)]
Revert "DebugInfo: Don't put fission type units in comdat sections."

This reverts commit r208930, r208933, and r208975.

It seems not all fission consumers are ready to handle this behavior.
Reverting until tools are brought up to spec.

llvm-svn: 209338

10 years agoMC: correct IMAGE_REL_ARM_MOV32T relocation emission
Saleem Abdulrasool [Wed, 21 May 2014 23:17:56 +0000 (23:17 +0000)]
MC: correct IMAGE_REL_ARM_MOV32T relocation emission

This corrects the emission of IMAGE_REL_ARM_MOV32T relocations.  Previously, we
were avoiding the high portion of the relocation too early.  If there was a
section-relative relocation with an offset greater than 16-bits (65535), you
would end up truncating the high order bits of the offset.  Allow the current
relocation representation to flow through out the MC layer to the object writer.
Use the new ability to restrict recorded relocations to avoid emitting the
relocation into the final object.

llvm-svn: 209337

10 years agoMC: introduce ability to restrict recorded relocations
Saleem Abdulrasool [Wed, 21 May 2014 23:17:50 +0000 (23:17 +0000)]
MC: introduce ability to restrict recorded relocations

Add support to allow a target specific COFF object writer to restrict the
recorded resolutions in the emitted object files.  This is motivated by the need
in Windows on ARM, where an intermediate relocation needs to be prevented from
being emitted in the object file.

llvm-svn: 209336

10 years agoDebugInfo: Use the SPMap to find the parent CU of inlined functions as they may not...
David Blaikie [Wed, 21 May 2014 23:14:12 +0000 (23:14 +0000)]
DebugInfo: Use the SPMap to find the parent CU of inlined functions as they may not be in the current CU

Committed in r209178 then reverted in r209251 due to LTO breakage,
here's a proper fix for the case of the missing subprogram DIE. The DIEs
were there, just in other compile units. Using the SPMap we can find the
right compile unit to search for and produce cross-unit references to
describe this kind of inlining.

One existing test case needed to be updated because it had a function
that wasn't in the CU's subprogram list, so it didn't appear in the
SPMap.

llvm-svn: 209335

10 years agoFix comment.
Rui Ueyama [Wed, 21 May 2014 23:07:16 +0000 (23:07 +0000)]
Fix comment.

llvm-svn: 209334

10 years agoR600: Add comment describing problems with LowerConstantInitializer
Matt Arsenault [Wed, 21 May 2014 22:59:17 +0000 (22:59 +0000)]
R600: Add comment describing problems with LowerConstantInitializer

llvm-svn: 209333

10 years agoVirtualFileSystem: Fix a few directory traversal bugs in VFSWriter
Justin Bogner [Wed, 21 May 2014 22:46:51 +0000 (22:46 +0000)]
VirtualFileSystem: Fix a few directory traversal bugs in VFSWriter

There are a couple of issues with writing VFS maps that are awkward to
fix within the current mutually recursive approach. Instead, replace
the algorithm with an iterative version that uses an explicit stack of
directories.

Includes tests for cases the old approach was tripping on.

llvm-svn: 209332

10 years agoR600: Partially fix constant initializers for structs and vectors.
Matt Arsenault [Wed, 21 May 2014 22:42:42 +0000 (22:42 +0000)]
R600: Partially fix constant initializers for structs and vectors.

This should extend the current workaround to work with structs
that only contain legal, scalar types.

llvm-svn: 209331

10 years agoR600: Add failing testcases for constant initializers.
Matt Arsenault [Wed, 21 May 2014 22:42:38 +0000 (22:42 +0000)]
R600: Add failing testcases for constant initializers.

Constant initializers involving illegal types hit an assertion.

Patch by: Jan Vesely <jan.vesely@rutgers.edu>

llvm-svn: 209330

10 years agoRemove getTargetLowering from TargetPassConfig as the target lowering
Eric Christopher [Wed, 21 May 2014 22:42:07 +0000 (22:42 +0000)]
Remove getTargetLowering from TargetPassConfig as the target lowering
can change depending upon subtarget/subtarget features for a function.

llvm-svn: 209329

10 years agoRemove unused member variable from hexagon pass.
Eric Christopher [Wed, 21 May 2014 22:42:02 +0000 (22:42 +0000)]
Remove unused member variable from hexagon pass.

llvm-svn: 209328

10 years agoDebugInfo: Ensure concrete out of line variables from inlined functions reference...
David Blaikie [Wed, 21 May 2014 22:41:17 +0000 (22:41 +0000)]
DebugInfo: Ensure concrete out of line variables from inlined functions reference their abstract origins.

llvm-svn: 209327

10 years ago[X86] Fix a bug in the lowering of BLENDI introduced in r209043.
Quentin Colombet [Wed, 21 May 2014 22:00:39 +0000 (22:00 +0000)]
[X86] Fix a bug in the lowering of BLENDI introduced in r209043.
ISD::VSELECT mask uses 1 to identify the first argument and 0 to identify the
second argument.
On the other hand, BLENDI uses 0 to identify the first argument and 1 to
identify the second argument.
Fix the generation of the blend mask to account for this difference.

The bug did not show up with r209043, because we were not checking for the
actual arguments of the blend instruction!
This commit also fixes the test cases.

Note: The same mask works for the BLENDr variant because the arguments are
swapped during instruction selection (see the BLENDXXrr patterns).

<rdar://problem/16975435>

llvm-svn: 209324

10 years ago[PECOFF] Fix unsafe memory access.
Rui Ueyama [Wed, 21 May 2014 21:51:11 +0000 (21:51 +0000)]
[PECOFF] Fix unsafe memory access.

llvm-svn: 209323

10 years agoProvide an aka for the C++ operator name macro diagnostic
Alp Toker [Wed, 21 May 2014 21:23:39 +0000 (21:23 +0000)]
Provide an aka for the C++ operator name macro diagnostic

llvm-svn: 209322

10 years agoMove MCOptions that aren't shared between programs into their specific
Eric Christopher [Wed, 21 May 2014 21:05:09 +0000 (21:05 +0000)]
Move MCOptions that aren't shared between programs into their specific
program and have them initialize the MCOptions struct explicitly.

llvm-svn: 209321

10 years agoMake a couple of command lines static and remove an unnecessary
Eric Christopher [Wed, 21 May 2014 21:05:05 +0000 (21:05 +0000)]
Make a couple of command lines static and remove an unnecessary
initialization.

llvm-svn: 209320

10 years agoSema: Implement DR244
David Majnemer [Wed, 21 May 2014 20:19:59 +0000 (20:19 +0000)]
Sema: Implement DR244

Summary:
Naming the destructor using a typedef-name for the class-name is
well-formed.

This fixes PR19620.

Reviewers: rsmith, doug.gregor

Subscribers: cfe-commits

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

llvm-svn: 209319

10 years agoAdded tests for q{f,s}ThreadInfo for attached processes.
Todd Fiala [Wed, 21 May 2014 20:12:01 +0000 (20:12 +0000)]
Added tests for q{f,s}ThreadInfo for attached processes.

Added helper methods:
prep_debug_monitor_and_inferior(): properly handles
the two cases of running the stub against an inferior process
launched by the stub, and one attached to by the stub.  See
docs for function: simplifies test creation for tests that want
to test the same operations against a launched and attached inferior.

Added the q{f,s}ThreadInfo and $qC response comparison test (verifies
they both return the same thing) when the process is attached rather
than launched by the stub.

Modified the previous two tests added to make use of the new
prep_debug_monitor_and_inferior() facility.

llvm-svn: 209318

10 years ago[PECOFF] Check for a Characteristics field of a .debug section.
Rui Ueyama [Wed, 21 May 2014 19:44:08 +0000 (19:44 +0000)]
[PECOFF] Check for a Characteristics field of a .debug section.

llvm-svn: 209317

10 years agocindex/test_cursor.py: no need to skip implicit decls in tests
Alp Toker [Wed, 21 May 2014 19:17:38 +0000 (19:17 +0000)]
cindex/test_cursor.py: no need to skip implicit decls in tests

clang was fixed some time ago to always skip "builtins and other cruft" so
tools no longer need hacks like this.

Passes nosetests.

llvm-svn: 209316

10 years ago[Mips] Simplify handling of R_MIPS_LO16 / R_MIPS_HI16 relocations
Simon Atanasyan [Wed, 21 May 2014 18:23:46 +0000 (18:23 +0000)]
[Mips] Simplify handling of R_MIPS_LO16 / R_MIPS_HI16 relocations
against _gp_disp symbol.

llvm-svn: 209315

10 years agoAdded gdb-remote tests for q{f,s}ThreadInfo.
Todd Fiala [Wed, 21 May 2014 18:12:14 +0000 (18:12 +0000)]
Added gdb-remote tests for q{f,s}ThreadInfo.

The First test verifies that qThreadInfo queries work for stub-launched processes.

The second test verifies that $qC after stub-launched inferior returns the same
thread as the qThreadInfo queries.

llvm-svn: 209314

10 years agoFix clang-query on Windows: flush llvm::outs() after each command.
Manuel Klimek [Wed, 21 May 2014 18:10:47 +0000 (18:10 +0000)]
Fix clang-query on Windows: flush llvm::outs() after each command.

llvm-svn: 209313

10 years agoImplement Host::GetThreadName for FreeBSD
Ed Maste [Wed, 21 May 2014 18:09:55 +0000 (18:09 +0000)]
Implement Host::GetThreadName for FreeBSD

llvm-svn: 209312

10 years agoDebugInfo: Simplify subprogram declaration creation/references and accidentally refix...
David Blaikie [Wed, 21 May 2014 18:04:33 +0000 (18:04 +0000)]
DebugInfo: Simplify subprogram declaration creation/references and accidentally refix PR11300.

Also simplifies the linkage name handling a little too.

llvm-svn: 209311

10 years agoUse cast<> instead of unchecked dyn_cast
Matt Arsenault [Wed, 21 May 2014 18:03:59 +0000 (18:03 +0000)]
Use cast<> instead of unchecked dyn_cast

llvm-svn: 209310

10 years agoMC: loosen an overzealous assertion
Saleem Abdulrasool [Wed, 21 May 2014 17:53:18 +0000 (17:53 +0000)]
MC: loosen an overzealous assertion

Permit active macro expansions when terminating the assembler if there were
errors during the expansion.  This would only trigger on invalid input when
built with assertions.

llvm-svn: 209309

10 years agoUse llvm-lit if LLVM source tree is unavailable.
Greg Fitzgerald [Wed, 21 May 2014 16:44:03 +0000 (16:44 +0000)]
Use llvm-lit if LLVM source tree is unavailable.

llvm-svn: 209308

10 years agoFix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'
Marshall Clow [Wed, 21 May 2014 16:29:50 +0000 (16:29 +0000)]
Fix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'

llvm-svn: 209307

10 years agoTest comment commit.
Dave Estes [Wed, 21 May 2014 16:19:51 +0000 (16:19 +0000)]
Test comment commit.

llvm-svn: 209306

10 years agoFix bug 19740; round-tripping a pointer through a stream doesn't work
Marshall Clow [Wed, 21 May 2014 16:02:20 +0000 (16:02 +0000)]
Fix bug 19740; round-tripping a pointer through a stream doesn't work

llvm-svn: 209305