platform/upstream/llvm.git
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

9 years agoARM: Only enforce 4-byte alignment on Thumb-2 functions with constant pools.
Peter Collingbourne [Thu, 23 Apr 2015 20:31:22 +0000 (20:31 +0000)]
ARM: Only enforce 4-byte alignment on Thumb-2 functions with constant pools.

This appears to have been introduced back in r76698 as part of an unrelated
change. I can find no official ARM documentation stating that Thumb-2 functions
require 4-byte alignment; in fact, ARM documentation appears to contradict
this (see, e.g., ARM Architecture Reference Manual Thumb-2 Supplement,
section 2.6.1: "Thumb-2 enforces 16-bit alignment on all instructions.").

Also remove code that sets alignment for ARM functions, which is redundant
with code in the MachineFunction constructor, and remove the hidden
-arm-align-constant-islands flag, which has been enabled by default since
r146739 (Dec 2011) and has probably received sufficient testing by now.

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

llvm-svn: 235636

9 years ago[Hexagon] Fix compiler warnings in release build
Krzysztof Parzyszek [Thu, 23 Apr 2015 20:26:21 +0000 (20:26 +0000)]
[Hexagon] Fix compiler warnings in release build

Patch by Aditya Nandakumar.

llvm-svn: 235635

9 years ago[getUnderlyingOjbects] Analyze loop PHIs further to remove false positives
Adam Nemet [Thu, 23 Apr 2015 20:09:20 +0000 (20:09 +0000)]
[getUnderlyingOjbects] Analyze loop PHIs further to remove false positives

Specifically, if a pointer accesses different underlying objects in each
iteration, don't look through the phi node defining the pointer.

The motivating case is the underlyling-objects-2.ll testcase.  Consider
the loop nest:

  int **A;
  for (i)
    for (j)
       A[i][j] = A[i-1][j] * B[j]

This loop is transformed by Load-PRE to stash away A[i] for the next
iteration of the outer loop:

  Curr = A[0];          // Prev_0
  for (i: 1..N) {
    Prev = Curr;        // Prev = PHI (Prev_0, Curr)
    Curr = A[i];
    for (j: 0..N)
       Curr[j] = Prev[j] * B[j]
  }

Since A[i] and A[i-1] are likely to be independent pointers,
getUnderlyingObjects should not assume that Curr and Prev share the same
underlying object in the inner loop.

If it did we would try to dependence-analyze Curr and Prev and the
analysis of the corresponding SCEVs would fail with non-constant
distance.

To fix this, the getUnderlyingObjects API is extended with an optional
LoopInfo parameter.  This is effectively what controls whether we want
the above behavior or the original.  Currently, I only changed to use
this approach for LoopAccessAnalysis.

The other testcase is to guard the opposite case where we do want to
look through the loop PHI.  If we step through an array by incrementing
a pointer, the underlying object is the incoming value of the phi as the
loop is entered.

Fixes rdar://problem/19566729

llvm-svn: 235634

9 years agoFactor resolution of abbreviations and aliases so that they can be tested directly...
Adrian McCarthy [Thu, 23 Apr 2015 20:00:25 +0000 (20:00 +0000)]
Factor resolution of abbreviations and aliases so that they can be tested directly. reviews.llvm.org/D9033

llvm-svn: 235633

9 years ago[NVPTX] run SeparateConstOffsetFromGEP before SLSR
Jingyue Wu [Thu, 23 Apr 2015 20:00:04 +0000 (20:00 +0000)]
[NVPTX] run SeparateConstOffsetFromGEP before SLSR

Summary:
We pick this order because SeparateConstOffsetFromGEP may create more
opportunities for SLSR.

Test Plan:
reassociate-geps-and-slsr.ll
no performance regression on internal benchmarks

Reviewers: meheff

Subscribers: llvm-commits, jholewinski

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

llvm-svn: 235632

9 years agoFix build of lldb after clang r235614.
Richard Smith [Thu, 23 Apr 2015 19:36:34 +0000 (19:36 +0000)]
Fix build of lldb after clang r235614.

llvm-svn: 235631

9 years agoR600/SI: Add missing -mcpu=SI to assembler test
Tom Stellard [Thu, 23 Apr 2015 19:33:55 +0000 (19:33 +0000)]
R600/SI: Add missing -mcpu=SI to assembler test

llvm-svn: 235630

9 years agoR600/SI: Add assembler support for all CI and VI VOP1 instructions
Tom Stellard [Thu, 23 Apr 2015 19:33:54 +0000 (19:33 +0000)]
R600/SI: Add assembler support for all CI and VI VOP1 instructions

llvm-svn: 235629

9 years agoR600/SI: v_mov_fed_b32 does not exist on VI
Tom Stellard [Thu, 23 Apr 2015 19:33:52 +0000 (19:33 +0000)]
R600/SI: v_mov_fed_b32 does not exist on VI

llvm-svn: 235628

9 years agoR600/SI: Use a better error message for unsupported instructions in the assembler
Tom Stellard [Thu, 23 Apr 2015 19:33:51 +0000 (19:33 +0000)]
R600/SI: Use a better error message for unsupported instructions in the assembler

llvm-svn: 235627

9 years agoR600/SI: Improve AsmParser support for forced e64 encoding
Tom Stellard [Thu, 23 Apr 2015 19:33:48 +0000 (19:33 +0000)]
R600/SI: Improve AsmParser support for forced e64 encoding

We can now force e64 encoding even when the operands would be legal
for e32 encoding.

llvm-svn: 235626

9 years agoImplement fract builtin
Tom Stellard [Thu, 23 Apr 2015 18:50:14 +0000 (18:50 +0000)]
Implement fract builtin

This implementation was ported from the AMD builtin library
and has been tested with piglit, OpenCV, and the ocl conformance tests.

llvm-svn: 235620

9 years ago[ASan] Relax test modified in r235540 to pacify ARM buildbots.
Alexey Samsonov [Thu, 23 Apr 2015 18:43:08 +0000 (18:43 +0000)]
[ASan] Relax test modified in r235540 to pacify ARM buildbots.

llvm-svn: 235619

9 years ago[WinEH] Handle stubs for outlined functions that have only unreached terminators.
Andrew Kaylor [Thu, 23 Apr 2015 18:37:39 +0000 (18:37 +0000)]
[WinEH] Handle stubs for outlined functions that have only unreached terminators.

llvm-svn: 235618

9 years agoRevert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works"
Reid Kleckner [Thu, 23 Apr 2015 18:34:01 +0000 (18:34 +0000)]
Revert "[SEH] Remove the old __C_specific_handler code now that WinEHPrepare works"

We still have some "uses remain after removal" issues in -O0 builds.

This reverts commit r235557.

llvm-svn: 235617

9 years ago[PowerPC] Enable printing instructions using aliases
Hal Finkel [Thu, 23 Apr 2015 18:30:38 +0000 (18:30 +0000)]
[PowerPC] Enable printing instructions using aliases

TableGen had been nicely generating code to print a number of instructions using
shorter aliases (and PowerPC has plenty of short mnemonics), but we were not
calling it. For some of the aliases we support in the parser, TableGen can't
infer the "inverse" alias relationship, so there is still more to do.

Thus, after some hours of updating test cases...

llvm-svn: 235616

9 years agoFix TestFdLeak on Linux.
Chaoren Lin [Thu, 23 Apr 2015 18:28:04 +0000 (18:28 +0000)]
Fix TestFdLeak on Linux.

Summary:
LLGS leaks pipes (when launched by lldb), sockets (when launched by platform),
and/or log file to the inferior. This should prevent all possible leaks.

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 235615

9 years ago[modules] Determine the set of macros exported by a submodule at the end of that...
Richard Smith [Thu, 23 Apr 2015 18:18:26 +0000 (18:18 +0000)]
[modules] Determine the set of macros exported by a submodule at the end of that submodule.

Previously we'd defer this determination until writing the AST, which doesn't
allow us to use this information when building other submodules of the same
module. This change also allows us to use a uniform mechanism for writing
module macro records, independent of whether they are local or imported.

llvm-svn: 235614

9 years agoDon't emit lifetime markers when msan is enabled
Reid Kleckner [Thu, 23 Apr 2015 18:07:13 +0000 (18:07 +0000)]
Don't emit lifetime markers when msan is enabled

In r235553, Clang started emitting lifetime markers more often. This
caused false negative in MSan, because MSan only poisons all allocas
once at function entry. Eventually, MSan should poison allocas at
lifetime start and probably also lifetime end, but until then, let's not
emit markers that aren't going to be useful.

llvm-svn: 235613

9 years agoMove DIContext.h to common DebugInfo location.
Zachary Turner [Thu, 23 Apr 2015 17:37:47 +0000 (17:37 +0000)]
Move DIContext.h to common DebugInfo location.

This will enable us to create a PDBContext so as to expose some
amount of debug info functionality through a common interace.

Differential Revision: http://reviews.llvm.org/D9205
Reviewed by: Alexey Samsonov

llvm-svn: 235612

9 years agoMove Value.isDereferenceablePointer to ValueTracking [NFC]
Philip Reames [Thu, 23 Apr 2015 17:36:48 +0000 (17:36 +0000)]
Move Value.isDereferenceablePointer to ValueTracking [NFC]

Move isDereferenceablePointer function to Analysis. This function recursively tracks dereferencability over a chain of values like other functions in ValueTracking.

This refactoring is motivated by further changes to support dereferenceable_or_null attribute (http://reviews.llvm.org/D8650). isDereferenceablePointer will be extended to perform context-sensitive analysis and IR is not a good place to have such functionality.

Patch by: Artur Pilipenko <apilipenko@azulsystems.com>
Differential Revision: reviews.llvm.org/D9075

llvm-svn: 235611

9 years ago[AArch64] Add nvcast patterns for v4f16 and v8f16
Pirama Arumuga Nainar [Thu, 23 Apr 2015 17:32:25 +0000 (17:32 +0000)]
[AArch64] Add nvcast patterns for v4f16 and v8f16

Summary:
Constant stores of f16 vectors can create NvCast nodes from various
operand types to v4f16 or v8f16 depending on patterns in the stored
constants.  This patch adds nvcast rules with v4f16 and v8f16 values.

AArchISelLowering::LowerBUILD_VECTOR has the details on which constant
patterns generate the nvcast nodes.

Reviewers: jmolloy, srhines, ab

Subscribers: rengolin, aemerson, llvm-commits

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

llvm-svn: 235610

9 years ago[AArch64] Handle vec4, vec8, vec16 *itofp for half
Pirama Arumuga Nainar [Thu, 23 Apr 2015 17:16:27 +0000 (17:16 +0000)]
[AArch64] Handle vec4, vec8, vec16 *itofp for half

Summary:
Set operation action for SINT_TO_FP and UINT_TO_FP nodes with v4i32,
v8i8, v8i16 inputs to allow promotion of v4f16 results.

Add tests for sitofp and uitofp for vec4, vec8, vec16, and i8, i16, i32,
and i64 vectors.  Only missing tests are for v16i8 and v16i16 as the
shift operations are too complicated to write a proper check sequence.

The conversions from v4i64 to v4f16 do not depend on this patch - v4i64
is split and the conversion gets handled while lowering v2i64.  I am
adding a test here for completeness.

Reviewers: aemerson, rengolin, ab, jmolloy, srhines

Subscribers: rengolin, aemerson, llvm-commits

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

llvm-svn: 235609

9 years agoRe-commit r235560: Switch lowering: extract jump tables and bit tests before building...
Hans Wennborg [Thu, 23 Apr 2015 16:45:24 +0000 (16:45 +0000)]
Re-commit r235560: Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)

Third time's the charm. The previous commit was reverted as a
reverse for-loop in SelectionDAGBuilder::lowerWorkItem did 'I--'
on an iterator at the beginning of a vector, causing asserts
when using debugging iterators. This commit fixes that.

llvm-svn: 235608

9 years agoFixed an 'extra tokens at end of #endif directive' warning in experimental/ratio
Marshall Clow [Thu, 23 Apr 2015 16:45:08 +0000 (16:45 +0000)]
Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio

llvm-svn: 235607

9 years agoExtend format specifier checking to include field function pointers in addition to...
Aaron Ballman [Thu, 23 Apr 2015 16:14:19 +0000 (16:14 +0000)]
Extend format specifier checking to include field function pointers in addition to variable function pointers. Addresses PR21082.

llvm-svn: 235606

9 years agoDiagnose variadic main() as an extension; addresses PR17905.
Aaron Ballman [Thu, 23 Apr 2015 16:12:42 +0000 (16:12 +0000)]
Diagnose variadic main() as an extension; addresses PR17905.

llvm-svn: 235605

9 years agouse update_llc_test_checks.py to tighten checking; remove unnecessary CPU param
Sanjay Patel [Thu, 23 Apr 2015 16:07:50 +0000 (16:07 +0000)]
use update_llc_test_checks.py to tighten checking; remove unnecessary CPU param

llvm-svn: 235604

9 years ago[Hexagon] Shrink-wrap stack frame (Hexagon-specific)
Krzysztof Parzyszek [Thu, 23 Apr 2015 16:05:39 +0000 (16:05 +0000)]
[Hexagon] Shrink-wrap stack frame (Hexagon-specific)

llvm-svn: 235603

9 years ago[Hexagon] Add testcases for stack alignment and variable-sized objects
Krzysztof Parzyszek [Thu, 23 Apr 2015 15:12:49 +0000 (15:12 +0000)]
[Hexagon] Add testcases for stack alignment and variable-sized objects

llvm-svn: 235602

9 years ago[mips] [IAS] Move NOP emission after pseudo-instruction expansion. NFC.
Toma Tabacu [Thu, 23 Apr 2015 14:48:38 +0000 (14:48 +0000)]
[mips] [IAS] Move NOP emission after pseudo-instruction expansion. NFC.

As suggested in the review for http://reviews.llvm.org/D8537.

llvm-svn: 235601

9 years agoclang-format: Properly detect variable declarations with ObjC.
Daniel Jasper [Thu, 23 Apr 2015 13:58:40 +0000 (13:58 +0000)]
clang-format: Properly detect variable declarations with ObjC.

Before:
  LoooooooooooooooooooooooooooooooooooooooongType
  LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

After:
  LoooooooooooooooooooooooooooooooooooooooongType
      LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

llvm-svn: 235599

9 years agoReplace use of %zu with PRIu64 in DYDL logging message.
Aidan Dodds [Thu, 23 Apr 2015 13:57:30 +0000 (13:57 +0000)]
Replace use of %zu with PRIu64 in DYDL logging message.

llvm-svn: 235598

9 years agoRevert r235560; this commit was causing several failed assertions in Debug builds...
Aaron Ballman [Thu, 23 Apr 2015 13:41:59 +0000 (13:41 +0000)]
Revert r235560; this commit was causing several failed assertions in Debug builds using MSVC's STL. The iterator is being used outside of its valid range.

llvm-svn: 235597

9 years agoBe more strict about the operand for the array type in BitcodeReader
Filipe Cabecinhas [Thu, 23 Apr 2015 13:38:21 +0000 (13:38 +0000)]
Be more strict about the operand for the array type in BitcodeReader

Summary: Bug found with AFL fuzz.

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 235596

9 years agoVerify sizes when trying to read a BitcodeAbbrevOp
Filipe Cabecinhas [Thu, 23 Apr 2015 13:25:35 +0000 (13:25 +0000)]
Verify sizes when trying to read a BitcodeAbbrevOp

Summary:
Make sure the abbrev operands are valid and that we can read/skip them
afterwards.

Bug found with AFL fuzz.

Reviewers: rafael

Subscribers: llvm-commits

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

llvm-svn: 235595

9 years ago[asan] debug_mapping.cc should also pass when the leading digit of SHADOW_SCALE is...
Daniel Sanders [Thu, 23 Apr 2015 13:23:21 +0000 (13:23 +0000)]
[asan] debug_mapping.cc should also pass when the leading digit of SHADOW_SCALE is hexadecimal.

Summary:
Previously the CHECK directive for SHADOW_SCALE only matched decimal digits
causing it to match '7' on x86_64 instead of the whole value.

This fixes a failure on mips-linux-gnu targets where the leading digit is 'a'.

Reviewers: kcc, sagar, timurrrr

Reviewed By: timurrrr

Subscribers: llvm-commits

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

llvm-svn: 235594

9 years ago[Sanitizer coverage] Print out the error number if OpenFile fails
Timur Iskhodzhanov [Thu, 23 Apr 2015 13:18:50 +0000 (13:18 +0000)]
[Sanitizer coverage] Print out the error number if OpenFile fails

llvm-svn: 235593

9 years agoclang-format: Allow splitting "= default" and "= delete".
Daniel Jasper [Thu, 23 Apr 2015 12:59:09 +0000 (12:59 +0000)]
clang-format: Allow splitting "= default" and "= delete".

Otherwise, this can violate the column limit.

llvm-svn: 235592

9 years ago[ASan/Win] Initialize sandbox-related stuff when asked to
Timur Iskhodzhanov [Thu, 23 Apr 2015 12:58:11 +0000 (12:58 +0000)]
[ASan/Win] Initialize sandbox-related stuff when asked to

llvm-svn: 235591

9 years ago[ASan/Win] Don't forget to set *last_error if OpenFile fails
Timur Iskhodzhanov [Thu, 23 Apr 2015 12:57:29 +0000 (12:57 +0000)]
[ASan/Win] Don't forget to set *last_error if OpenFile fails

llvm-svn: 235590

9 years agoMI fix allowing multiple logging instances of lldb-mi to run simultaneously.
Ilia K [Thu, 23 Apr 2015 12:48:42 +0000 (12:48 +0000)]
MI fix allowing multiple logging instances of lldb-mi to run simultaneously.

Summary:
Currently if two instances of lldb-mi are running with logging enabled using '--log' the log file conflicts. This produces the following error
MI: Error: File Handler. Error Permission denied opening 'C:\Users\Ewan\LLVM\build\Debug\bin\lldb-mi-log.txt'

Fixed in this patch by renaming lldb-mi-log.txt based on the date, e.g. lldb-mi-log.txt-20150316163631.log, and moving the file into the temp directory by using the --log-dir option.

Regrading previous review comments the P_tmpdir macro is defined in Windows but always points to "\", which doesn't help much. Also when using the Windows API for GetTempPath() dynamic memory seems much more messy.

Patch from ewan@codeplay.com

Reviewers: abidh, EwanCrawford

Subscribers: zturner, lldb-commits, deepak2427

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

llvm-svn: 235589

9 years agoJScoP Import/Export: Ensure parameters have the same isl_id
Tobias Grosser [Thu, 23 Apr 2015 12:23:56 +0000 (12:23 +0000)]
JScoP Import/Export: Ensure parameters have the same isl_id

When reading parameters from a JSON file parameters with identical names
may be related to different isl_ids, which then causes isl to treat them
as differnet objects. This does not cause issues at the moment, but has
shown problematic in subsequent schedule tree changes.

This commit will be tested by the following changes.

llvm-svn: 235588

9 years agoUpdate cpsr register in BLX instruction emulation
Tamas Berghammer [Thu, 23 Apr 2015 10:56:51 +0000 (10:56 +0000)]
Update cpsr register in BLX instruction emulation

Write the new cpsr value into the cpsr register if the BL or the BLX
instruction change the instruction set on arm.

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

llvm-svn: 235585

9 years agoFix test expectation in TestNoreturnUnwind
Tamas Berghammer [Thu, 23 Apr 2015 10:54:27 +0000 (10:54 +0000)]
Fix test expectation in TestNoreturnUnwind

The test case lookinhg for the abort function in the stack trace.
Previously it lookd for a function which ends with "abort" but on some
system there are multiple such functions (e.g.: on android abort calls
__libc_android_abort) what made the test fail. This CL change the
behaviour to look for the abort function based on a fix list of names.

llvm-svn: 235584

9 years agoclang-format: Don't add unwanted space when creating new arrays.
Daniel Jasper [Thu, 23 Apr 2015 10:23:53 +0000 (10:23 +0000)]
clang-format: Don't add unwanted space when creating new arrays.

Before:
  char** newargv = new char* [argc];

After:
  char** newargv = new char*[argc];

llvm-svn: 235583

9 years agoclang-format: [Proto] Don't linewrap top-level options.
Daniel Jasper [Thu, 23 Apr 2015 09:54:10 +0000 (09:54 +0000)]
clang-format: [Proto] Don't linewrap top-level options.

They are very similar to import statements.

llvm-svn: 235582

9 years agotsan: support setuid call
Dmitry Vyukov [Thu, 23 Apr 2015 09:33:27 +0000 (09:33 +0000)]
tsan: support setuid call

Currently the call hangs because the background thread
does not handle SIGSETXID signal.

llvm-svn: 235581

9 years agoclang-format: Support nested block formatting with ColumnLimit=0.
Daniel Jasper [Thu, 23 Apr 2015 09:23:17 +0000 (09:23 +0000)]
clang-format: Support nested block formatting with ColumnLimit=0.

llvm-svn: 235580

9 years ago[NativeProcessLinux] Fix race condition during inferior thread creation
Pavel Labath [Thu, 23 Apr 2015 09:04:35 +0000 (09:04 +0000)]
[NativeProcessLinux] Fix race condition during inferior thread creation

The following situation occured if we were stopping a process (due to breakpoint, watchpoint, ...
hit) while a new thread was being created.
- process has two threads: A and B.
- thread A hits a breakpoint: we send a STOP signal to thread B and register a callback with
  ThreadStateCoordinator to send a stop notification after the thread stops.
- thread B stops, but not due to the SIGSTOP, but on a thread creation event (of a new thread C).
  We are unaware of our desire to stop, so we queue ThreadStopped and RequestResume operations
  with TSC, so the thread can continue running.
- TSC receives the ThreadStopped event, sees that all threads are stopped and fires the delayed
  stop notification.
- immediately after that TSC gets the RequestResume operation, so it resumes the thread.

At this point the state is inconsistent because LLDB thinks the process is stopped and will start
issuing commands to it, but one of the threads is in fact running. Things eventually break.

I address this problem by omitting the two TSC events altogether and Resuming the thread B
directly. This way the short stop is invisible to the TSC and the delayed notification will not
fire. We will fire the notification when we actually process the SIGSTOP on thread B.

When we get the initial SIGSTOP for thread C, we also resume the thread and send a
ThreadWasCreated message (is_stopped = false) to the TSC. This way, the TSC can stop the thread
on its own and handle the stop event later. This way the state of the new thread is correctly
handled as well (thanks Chaoren for the idea).

This patch also removes the synchronisation between the thread creation notifications on threads
B and C. The need for this synchronisation is unclear (the comments seem to hint that the new
thread is "fully created" only after we process both events, but I have noticed no regressions in
treating it as "created" even after just processing the initial C event), but it is a source for
many kinds of obscure races, since it introduces a new thread state "Launching" and the rest of
the code does not handle this state at all (what happens if we get a resume request from LLDB
while this thread is launching? what happens if we get a stop request? etc.).

This fixes the "spurious $O packet" problem in TestPrintStackTraces.py. However, the test remains
disabled on i386 due to the VDSO issue.

Test Plan:
TestPrintStackTraces works on x86_64. No regressions in the rest of the test suite.

Reviewers: vharron, chaoren

Subscribers: lldb-commits

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

llvm-svn: 235579

9 years ago[DAGCombiner] Remove extra bitcasts surrounding vector shuffles
Simon Pilgrim [Thu, 23 Apr 2015 08:43:13 +0000 (08:43 +0000)]
[DAGCombiner] Remove extra bitcasts surrounding vector shuffles

Patch to remove extra bitcasts from shuffles, this is often a legacy of XformToShuffleWithZero being used to combine bitmaskings (of float vectors bitcast to integer vectors) into shuffles: bitcast(shuffle(bitcast(s0),bitcast(s1))) -> shuffle(s0,s1)

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

llvm-svn: 235578

9 years agoMove common loop utility function isInductionPHI into LoopUtils.cpp
Karthik Bhat [Thu, 23 Apr 2015 08:29:20 +0000 (08:29 +0000)]
Move common loop utility function isInductionPHI into LoopUtils.cpp

This patch refactors the definition of common utility function "isInductionPHI" to LoopUtils.cpp.
This fixes compilation error when configured with -DBUILD_SHARED_LIBS=ON

llvm-svn: 235577

9 years ago[OPENMP] Fix for failed tests for 'omp atomic write' construct.
Alexey Bataev [Thu, 23 Apr 2015 07:56:25 +0000 (07:56 +0000)]
[OPENMP] Fix for failed tests for 'omp atomic write' construct.

llvm-svn: 235576

9 years ago[MS ABI] Add support for mangling VLA types
David Majnemer [Thu, 23 Apr 2015 07:42:08 +0000 (07:42 +0000)]
[MS ABI] Add support for mangling VLA types

Treat a VLA type like an incomplete array type.

llvm-svn: 235575

9 years ago[LLDB][MIPS] Add MIPS32 and MIPS64 core revisions
Mohit K. Bhakkad [Thu, 23 Apr 2015 06:36:20 +0000 (06:36 +0000)]
[LLDB][MIPS] Add MIPS32 and MIPS64 core revisions
Patch by Jaydeep Patil

Added MIPS32 and MIPS64 core revisions. This would be followed by register context and emulate-instruction for MIPS32.

DYLDRendezvous.cpp:
On Linux link map struct does not contain extra load offset field.

Reviewers: clayborg
Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D9190

llvm-svn: 235574

9 years ago[OPENMP] Codegen for 'atomic capture'.
Alexey Bataev [Thu, 23 Apr 2015 06:35:10 +0000 (06:35 +0000)]
[OPENMP] Codegen for 'atomic capture'.

Adds codegen for 'atomic capture' constructs with the following forms of expressions/statements:

v = x binop= expr;
v = x++;
v = ++x;
v = x--;
v = --x;
v = x = x binop expr;
v = x = expr binop x;
{v = x; x = binop= expr;}
{v = x; x++;}
{v = x; ++x;}
{v = x; x--;}
{v = x; --x;}
{x = x binop expr; v = x;}
{x binop= expr; v = x;}
{x++; v = x;}
{++x; v = x;}
{x--; v = x;}
{--x; v = x;}
{x = x binop expr; v = x;}
{x = expr binop x; v = x;}
{v = x; x = expr;}
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted.
Update of 'v' is not required to be be atomic with respect to the read or write of the 'x'.

bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
atomic store <old/new x>, <v>
...
Differential Revision: http://reviews.llvm.org/D9049

llvm-svn: 235573

9 years ago[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args
David Majnemer [Thu, 23 Apr 2015 05:21:20 +0000 (05:21 +0000)]
[MS ABI] Treat ConstantArrayType like IncompleteArrayType in args

Type backreferences for arguments use the DecayedType's original type.
Because of this, arguments with the same canonical type with the same
mangling would not backreference each other if one was a
ConstantArrayType while the other was an IncompleteArrayType.  Solve
this by canonicalizing the ConstantArrayType to a suitable
IncompleteArrayType.

This fixes PR23325.

llvm-svn: 235572

9 years agoAdd support to interchange loops with reductions.
Karthik Bhat [Thu, 23 Apr 2015 04:51:44 +0000 (04:51 +0000)]
Add support to interchange loops with reductions.
This patch enables interchanging of tightly nested loops with reductions.
Differential Revision: http://reviews.llvm.org/D8314

llvm-svn: 235571

9 years ago[modules] Actually allocate the extra space we use for the tail-allocated array
Richard Smith [Thu, 23 Apr 2015 04:13:52 +0000 (04:13 +0000)]
[modules] Actually allocate the extra space we use for the tail-allocated array
in this class.

llvm-svn: 235570

9 years ago[UBSan] Unify the way we report overflow in increment/decrement operator.
Alexey Samsonov [Thu, 23 Apr 2015 01:50:56 +0000 (01:50 +0000)]
[UBSan] Unify the way we report overflow in increment/decrement operator.

llvm-svn: 235569

9 years agoUnify the way we report overflow in increment/decrement operator.
Alexey Samsonov [Thu, 23 Apr 2015 01:50:45 +0000 (01:50 +0000)]
Unify the way we report overflow in increment/decrement operator.

Summary:
Make sure signed overflow in "x--" is checked with
llvm.ssub.with.overflow intrinsic and is reported as:
  "-2147483648 - 1 cannot be represented in type 'int'"
instead of:
  "-2147483648 + -1 cannot be represented in type 'int'"
, like we do for unsigned overflow.

Test Plan: clang + compiler-rt regression test suite

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 235568