platform/upstream/llvm.git
9 years ago[Refactor] Have getNonLocalPointerDependency take the query instruction
Philip Reames [Fri, 9 Jan 2015 00:04:22 +0000 (00:04 +0000)]
[Refactor] Have getNonLocalPointerDependency take the query instruction

Previously, MemoryDependenceAnalysis::getNonLocalPointerDependency was taking a list of properties about the instruction being queried. Since I'm about to need one more property to be passed down through the infrastructure - I need to know a query instruction is non-volatile in an inner helper - fix the interface once and for all.

I also added some assertions and behaviour clarifications around volatile and ordered field accesses. At the moment, this is mostly to document expected behaviour. The only non-standard instructions which can currently reach this are atomic, but unordered, loads and stores. Neither ordered or volatile accesses can reach here.

The call in GVN is protected by an isSimple check when it first considers the load. The calls in MemDepPrinter are protected by isUnordered checks. Both utilities also check isVolatile for loads and stores.

llvm-svn: 225481

9 years agoAdd experimental support for unsigned expressions
Tobias Grosser [Fri, 9 Jan 2015 00:01:33 +0000 (00:01 +0000)]
Add experimental support for unsigned expressions

This support is still incomplete and consequently hidden behind a switch that
needs to be enabled. One problem is ATM that we incorrectly interpret very large
unsigned values as negative values even if used in an unsigned comparision.

llvm-svn: 225480

9 years agoLangRef: Add usage points for distinct MDNodes
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 23:50:26 +0000 (23:50 +0000)]
LangRef: Add usage points for distinct MDNodes

Omission pointed out by Sean Silva!

llvm-svn: 225479

9 years ago[asan] make a test consume 2x less RAM (we observe flaky bot failures that seem like...
Kostya Serebryany [Thu, 8 Jan 2015 23:37:09 +0000 (23:37 +0000)]
[asan] make a test consume 2x less RAM (we observe flaky bot failures that seem like OOMs)

llvm-svn: 225478

9 years agoIR: Drop TODO now that PR22111 is finished
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:43:19 +0000 (22:43 +0000)]
IR: Drop TODO now that PR22111 is finished

llvm-svn: 225477

9 years agoUtils: Keep distinct MDNodes distinct in MapMetadata()
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:42:30 +0000 (22:42 +0000)]
Utils: Keep distinct MDNodes distinct in MapMetadata()

Create new copies of distinct `MDNode`s instead of following the
uniquing `MDNode` logic.

Just like self-references (or other cycles), `MapMetadata()` creates a
new node.  In practice most calls use `RF_NoModuleLevelChanges`, in
which case nothing is duplicated anyway.

Part of PR22111.

llvm-svn: 225476

9 years agoIR: Add 'distinct' MDNodes to bitcode and assembly (clang)
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:39:28 +0000 (22:39 +0000)]
IR: Add 'distinct' MDNodes to bitcode and assembly (clang)

Update testcases for LLVM change in r225474 to make `MDNode`s explicitly
distinct (when they aren't uniqued).

Part of PR22111.

llvm-svn: 225475

9 years agoIR: Add 'distinct' MDNodes to bitcode and assembly
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 22:38:29 +0000 (22:38 +0000)]
IR: Add 'distinct' MDNodes to bitcode and assembly

Propagate whether `MDNode`s are 'distinct' through the other types of IR
(assembly and bitcode).  This adds the `distinct` keyword to assembly.

Currently, no one actually calls `MDNode::getDistinct()`, so these nodes
only get created for:

  - self-references, which are never uniqued, and
  - nodes whose operands are replaced that hit a uniquing collision.

The concept of distinct nodes is still not quite first-class, since
distinct-ness doesn't yet survive across `MapMetadata()`.

Part of PR22111.

llvm-svn: 225474

9 years agoremove function names from comments; NFC
Sanjay Patel [Thu, 8 Jan 2015 22:36:56 +0000 (22:36 +0000)]
remove function names from comments; NFC

llvm-svn: 225473

9 years agoFix memory leaks in GetListOfModules() users.
Alexey Samsonov [Thu, 8 Jan 2015 22:31:14 +0000 (22:31 +0000)]
Fix memory leaks in GetListOfModules() users.

llvm-svn: 225472

9 years ago[PowerPC] Mark all instructions as non-cheap for MachineLICM
Hal Finkel [Thu, 8 Jan 2015 22:11:49 +0000 (22:11 +0000)]
[PowerPC] Mark all instructions as non-cheap for MachineLICM

MachineLICM uses a callback named hasLowDefLatency to determine if an
instruction def operand has a 'low' latency. If all relevant operands have a
'low' latency, the instruction is considered too cheap to hoist out of loops
even in low-register-pressure situations. On PowerPC cores, both the embedded
cores and the others, there is no reason to believe that this is a good choice:
all instructions have a cost inside a loop, and hoisting them when not limited
by register pressure is a reasonable default.

llvm-svn: 225471

9 years ago[MachineLICM] A command-line option to hoist even cheap instructions
Hal Finkel [Thu, 8 Jan 2015 22:10:48 +0000 (22:10 +0000)]
[MachineLICM] A command-line option to hoist even cheap instructions

Add a command-line option to enable hoisting even cheap instructions (in
low-register-pressure situations). This is turned off by default, but has
proved useful for testing purposes.

llvm-svn: 225470

9 years ago[Sanitizer] Remove the hardcoded limit of address ranges in LoadedModule.
Alexey Samsonov [Thu, 8 Jan 2015 22:03:05 +0000 (22:03 +0000)]
[Sanitizer] Remove the hardcoded limit of address ranges in LoadedModule.

This should fix https://code.google.com/p/address-sanitizer/issues/detail?id=368.

llvm-svn: 225469

9 years agoCodeGen: Use handy new-fangled post-increment, NFC
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 21:07:55 +0000 (21:07 +0000)]
CodeGen: Use handy new-fangled post-increment, NFC

Drive-by cleanup; I noticed this when reviewing the patch that became
r225466.

llvm-svn: 225468

9 years ago[ARM] Fix a bug in constant island pass that was triggering an assertion.
Akira Hatanaka [Thu, 8 Jan 2015 20:44:50 +0000 (20:44 +0000)]
[ARM] Fix a bug in constant island pass that was triggering an assertion.

The assert was being triggered when the distance between a constant pool entry
and its user exceeded the maximally allowed distance after thumb2 branch
shortening. A padding was inserted after a thumb2 branch instruction was shrunk,
which caused the user to be out of range. This is wrong as the padding should
have been inserted by the layout algorithm so that the distance between two
instructions doesn't grow later during thumb2 instruction optimization.

This commit fixes the code in ARMConstantIslands::createNewWater to call
computeBlockSize and set BasicBlock::Unalign when a branch instruction is
inserted to create new water after a basic block. A non-zero Unalign causes
the worst-case padding to be inserted when adjustBBOffsetsAfter is called to
recompute the basic block offsets.

rdar://problem/19130476

llvm-svn: 225467

9 years agoCodeGen: Use range-based for loops, NFC
Duncan P. N. Exon Smith [Thu, 8 Jan 2015 20:44:33 +0000 (20:44 +0000)]
CodeGen: Use range-based for loops, NFC

Patch by Ramkumar Ramachandra!

llvm-svn: 225466

9 years agoFix fcmp + fabs instcombines when using the intrinsic
Matt Arsenault [Thu, 8 Jan 2015 20:09:34 +0000 (20:09 +0000)]
Fix fcmp + fabs instcombines when using the intrinsic

This was only handling the libcall. This is another example
of why only the intrinsic should ever be used when it exists.

llvm-svn: 225465

9 years agoAdd support for pointer types in expressions
Tobias Grosser [Thu, 8 Jan 2015 19:26:53 +0000 (19:26 +0000)]
Add support for pointer types in expressions

llvm-svn: 225464

9 years agoThis patch fixes my think-o in ValueObject::UpdateValueIfNeeded() about the right...
Enrico Granata [Thu, 8 Jan 2015 19:11:43 +0000 (19:11 +0000)]
This patch fixes my think-o in ValueObject::UpdateValueIfNeeded() about the right thing to assert()

It also comes with a (rudimentary) test case that gets itself in a failed update scenario, and checks that we don't crash
This is the easiest case I could think of that forces the failed update case Zachary was seeing

llvm-svn: 225463

9 years agoThe Kaleidoscope tutorial should be using "mcjit" for the library,
Eric Christopher [Thu, 8 Jan 2015 19:07:01 +0000 (19:07 +0000)]
The Kaleidoscope tutorial should be using "mcjit" for the library,
"jit" doesn't exist anymore.

llvm-svn: 225462

9 years agoFix a crash in our error reporting
Tobias Grosser [Thu, 8 Jan 2015 19:03:10 +0000 (19:03 +0000)]
Fix a crash in our error reporting

AF = dyn_cast<SCEVAddRecExpr>(Pair.second) may be NULL for some SCEVs that we do
not support. When reporting the error we still want to pass a pointer that is
known to always be non-NULL.

I do not yet have a test case for this, unfortunately.

llvm-svn: 225461

9 years ago[MCJIT] Remove a few redundant MCJIT tests, and drop the extraneous datalayout
Lang Hames [Thu, 8 Jan 2015 18:52:15 +0000 (18:52 +0000)]
[MCJIT] Remove a few redundant MCJIT tests, and drop the extraneous datalayout
strings from the copies that remain.

llvm-svn: 225460

9 years agoMake the TargetMachine in MipsSubtarget a reference rather
Eric Christopher [Thu, 8 Jan 2015 18:18:57 +0000 (18:18 +0000)]
Make the TargetMachine in MipsSubtarget a reference rather
than a pointer to make unifying code a bit easier.

llvm-svn: 225459

9 years agoUpdate include - this class doesn't use the target machine, but
Eric Christopher [Thu, 8 Jan 2015 18:18:54 +0000 (18:18 +0000)]
Update include - this class doesn't use the target machine, but
only the subtarget.

llvm-svn: 225458

9 years agoFix a couple of odd formatting issues.
Eric Christopher [Thu, 8 Jan 2015 18:18:53 +0000 (18:18 +0000)]
Fix a couple of odd formatting issues.

llvm-svn: 225457

9 years agoThis routine is in InstrInfo, there's no need to access it again.
Eric Christopher [Thu, 8 Jan 2015 18:18:50 +0000 (18:18 +0000)]
This routine is in InstrInfo, there's no need to access it again.

llvm-svn: 225456

9 years ago[X86] Reflow comment. NFC.
Ahmed Bougacha [Thu, 8 Jan 2015 17:49:48 +0000 (17:49 +0000)]
[X86] Reflow comment. NFC.

llvm-svn: 225455

9 years agoclang-format. NFC.
Rafael Espindola [Thu, 8 Jan 2015 16:25:01 +0000 (16:25 +0000)]
clang-format. NFC.

llvm-svn: 225454

9 years agoMake this test a bit stricter.
Rafael Espindola [Thu, 8 Jan 2015 16:11:18 +0000 (16:11 +0000)]
Make this test a bit stricter.

It now checks for the end of the line or the opening '{'.
While at it, remove empty comments.

llvm-svn: 225451

9 years agoAdd saving and restoring of r30 to the prologue and epilogue, respectively
Justin Hibbits [Thu, 8 Jan 2015 15:47:19 +0000 (15:47 +0000)]
Add saving and restoring of r30 to the prologue and epilogue, respectively

Summary: The PIC additions didn't update the prologue and epilogue code to save and restore r30 (PIC base register).  This does that.

Test Plan: Tests updated.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: llvm-commits

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

llvm-svn: 225450

9 years agoExplicitly handle LinkOnceODRAutoHideLinkage. NFC. We already have a test.
Rafael Espindola [Thu, 8 Jan 2015 15:39:50 +0000 (15:39 +0000)]
Explicitly handle LinkOnceODRAutoHideLinkage. NFC. We already have a test.

llvm-svn: 225449

9 years agoUpdate naming style and clang-format. NFC.
Rafael Espindola [Thu, 8 Jan 2015 15:36:32 +0000 (15:36 +0000)]
Update naming style and clang-format. NFC.

llvm-svn: 225448

9 years agoImprove clang-format.el.
Manuel Klimek [Thu, 8 Jan 2015 15:29:03 +0000 (15:29 +0000)]
Improve clang-format.el.

- includes header/footer as required by MELPA
- correctly handles buffers that are not associated with a file
- displays stderr and exit code of clang-format process
- customizable via the emacs customization interface and file-/directory-
  local variables

Patch by Johann Klähn.

llvm-svn: 225447

9 years agoFix large stack alignment codegen for ARM and Thumb2 targets
Kristof Beyls [Thu, 8 Jan 2015 15:09:14 +0000 (15:09 +0000)]
Fix large stack alignment codegen for ARM and Thumb2 targets

This partially fixes PR13007 (ARM CodeGen fails with large stack
alignment): for ARM and Thumb2 targets, but not for Thumb1, as it
seems stack alignment for Thumb1 targets hasn't been supported at
all.

Producing an aligned stack pointer is done by zero-ing out the lower
bits of the stack pointer. The BIC instruction was used for this.
However, the immediate field of the BIC instruction only allows to
encode an immediate that can zero out up to a maximum of the 8 lower
bits. When a larger alignment is requested, a BIC instruction cannot
be used; llvm was silently producing incorrect code in this case.

This commit fixes code generation for large stack aligments by
using the BFC instruction instead, when the BFC instruction is
available.  When not, it uses 2 instructions: a right shift,
followed by a left shift to zero out the lower bits.

The lowering of ARM::Int_eh_sjlj_dispatchsetup still has code
that unconditionally uses BIC to realign the stack pointer, so it
very likely has the same problem. However, I wasn't able to
produce a test case for that. This commit adds an assert so that
the compiler will fail the assert instead of silently generating
wrong code if this is ever reached.

llvm-svn: 225446

9 years agoR600/SI: Remove SIISelLowering::legalizeOperands()
Tom Stellard [Thu, 8 Jan 2015 15:08:17 +0000 (15:08 +0000)]
R600/SI: Remove SIISelLowering::legalizeOperands()

Its functionality has been replaced by calling
SIInstrInfo::legalizeOperands() from
SIISelLowering::AdjstInstrPostInstrSelection() and running the
SIFoldOperands and SIShrinkInstructions passes.

llvm-svn: 225445

9 years agoclang-format: Force line break between "endl" and "<<".
Daniel Jasper [Thu, 8 Jan 2015 13:56:57 +0000 (13:56 +0000)]
clang-format: Force line break between "endl" and "<<".

This makes piped output easier to read in many instances.

Before:
  llvm::errs() << aaaa << std::endl << bbbb << std::endl;

After:
  llvm::errs() << aaaa << std::endl
               << bbbb << std::endl;

Also fix a few instance of "don't use else after return" as per the
coding standards.

llvm-svn: 225444

9 years ago[Sanitizers] Fix internal_lseek() to work on FreeBSD
Viktor Kutuzov [Thu, 8 Jan 2015 13:28:22 +0000 (13:28 +0000)]
[Sanitizers] Fix internal_lseek() to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D6825

llvm-svn: 225443

9 years agoFrontend: Fix SourceColumnMap assertion failure on non-ascii characters.
Logan Chien [Thu, 8 Jan 2015 13:19:07 +0000 (13:19 +0000)]
Frontend: Fix SourceColumnMap assertion failure on non-ascii characters.

If there are some non-ascii character in the input source code, the
column index might be smallar than the byte index.  This will result
in two possible assertion failures.  This CL fixes the computation of
the column index and byte index.

1. The assertion in startOfNextColumn() and startOfPreviousColumn()
   should not be raised when the byte index is greater than the column
   index since the non-ascii characters may use more than one bytes to
   store a character in a column.

2. The length of the caret line should be equal to the number of columns
   of source line, instead of the length of the source line.  Otherwise,
   the assertion in selectInterestingSourceRegion will be raised because
   the removed columns plus the kept columns are not greater than the max
   column, which means that we should not remove any column at all.

llvm-svn: 225442

9 years agoMasked Load/Store - fixed a bug in type legalization.
Elena Demikhovsky [Thu, 8 Jan 2015 12:29:19 +0000 (12:29 +0000)]
Masked Load/Store - fixed a bug in type legalization.

llvm-svn: 225441

9 years agoFix a think-o in the test for r225438.
Michael Kuperstein [Thu, 8 Jan 2015 12:05:02 +0000 (12:05 +0000)]
Fix a think-o in the test for r225438.

llvm-svn: 225440

9 years agoFix include ordering, NFC.
Michael Kuperstein [Thu, 8 Jan 2015 11:59:43 +0000 (11:59 +0000)]
Fix include ordering, NFC.

llvm-svn: 225439

9 years ago[X86] Don't try to generate direct calls to TLS globals
Michael Kuperstein [Thu, 8 Jan 2015 11:50:58 +0000 (11:50 +0000)]
[X86] Don't try to generate direct calls to TLS globals

The call lowering assumes that if the callee is a global, we want to emit a direct call.
This is correct for regular globals, but not for TLS ones.

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

llvm-svn: 225438

9 years agoMove SPAdj logic from PEI into the targets (NFC)
Michael Kuperstein [Thu, 8 Jan 2015 11:04:38 +0000 (11:04 +0000)]
Move SPAdj logic from PEI into the targets (NFC)

PEI tries to keep track of how much starting or ending a call sequence adjusts the stack pointer by, so that it can resolve frame-index references. Currently, it takes a very simplistic view of how SP adjustments are done - both FrameStartOpcode and FrameDestroyOpcode adjust it exactly by the amount written in its first argument.

This view is in fact incorrect for some targets (e.g. due to stack re-alignment, or because it may want to adjust the stack pointer in multiple steps). However, that doesn't cause breakage, because most targets (the only in-tree exception appears to be 32-bit ARM) rely on being able to simplify the call frame pseudo-instructions earlier, so this code is never hit.

Moving the computation into TargetInstrInfo allows targets to override the way the adjustment is computed if they need to have a non-zero SPAdj.

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

llvm-svn: 225437

9 years ago[LLDB][MIPS] Adding SoftwareBreakpointTrapOpcode and RelocationJumpSlotType for MIPS
Mohit K. Bhakkad [Thu, 8 Jan 2015 09:46:29 +0000 (09:46 +0000)]
[LLDB][MIPS] Adding SoftwareBreakpointTrapOpcode and RelocationJumpSlotType for MIPS

Patch by Bhushan Attarde

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: petarj, dsanders, mohit.bhakkad, lldb-commits

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

llvm-svn: 225436

9 years agoclang-format: Improve template parameter detection.
Daniel Jasper [Thu, 8 Jan 2015 08:48:21 +0000 (08:48 +0000)]
clang-format: Improve template parameter detection.

Before:
  struct A < std::enable_if<sizeof(T2) <sizeof(int32)>::type>;

After:
  struct A<std::enable_if<sizeof(T2) < sizeof(int32)>::type>;

llvm-svn: 225435

9 years agoFix test case I missed in r225432.
Craig Topper [Thu, 8 Jan 2015 07:57:27 +0000 (07:57 +0000)]
Fix test case I missed in r225432.

llvm-svn: 225434

9 years ago[llgo] irgen: generate switch instructions
Andrew Wilkins [Thu, 8 Jan 2015 07:49:28 +0000 (07:49 +0000)]
[llgo] irgen: generate switch instructions

Summary:
    With this patch, llgo uses ssautil.Switches
    to reconstitute (and synthesise) switches,
    which can then be lowered to lookup tables,
    trees, etc.

    We currently only handle integer const case
    switches. We erase the comparison blocks (other
    than the initial block), and generate a switch
    instruction at the end of the block starting
    the if-else-if chain. ssautil.Switches does
    not remove duplicate const cases (e.g. same
    operands for "||"), so we do this in llgo for
    now.

Test Plan: lit test added

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 225433

9 years ago[X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA varian...
Craig Topper [Thu, 8 Jan 2015 07:41:30 +0000 (07:41 +0000)]
[X86] Don't print 'dword ptr' or 'qword ptr' on the operand to some of the LEA variants in Intel syntax. The memory operand is inherently unsized.

llvm-svn: 225432

9 years agoHave AssemblyParse_x86::get_non_call_site_unwind_plan track
Jason Molenda [Thu, 8 Jan 2015 06:41:12 +0000 (06:41 +0000)]
Have AssemblyParse_x86::get_non_call_site_unwind_plan track
which registers have been spilled (saved to the stack) - and
if we see that same register being saved to the stack again,
don't record that, it's something specific to this stack frame.

I found a code sequence for i386 where clang did a push %esi
and then later in the function it did movl %esi, -0x7c(%ebp)
and that second save of a scratch value overrode the original
push location.

<rdar://problem/19171178>

llvm-svn: 225431

9 years agoIn early C++11 standard drafts, std::function derived from std::unary_function or...
Marshall Clow [Thu, 8 Jan 2015 06:36:41 +0000 (06:36 +0000)]
In early C++11 standard drafts, std::function derived from std::unary_function or std::binary_function if there was only one (or two) parameters. Before C++11 shipped, this restiction was lifted, but libc++ still does this (which is fine). However, the tests still check for this outdated requiremnt. Change then to check for the nested typedefs instead (which are still required by the standard). No change to the library.

llvm-svn: 225430

9 years agoAdd checks to make sure the hash functor has the right typedefs
Marshall Clow [Thu, 8 Jan 2015 06:18:59 +0000 (06:18 +0000)]
Add checks to make sure the hash functor has the right typedefs

llvm-svn: 225429

9 years agoPE/COFF: add support to import functions in ARM NT
Saleem Abdulrasool [Thu, 8 Jan 2015 04:19:08 +0000 (04:19 +0000)]
PE/COFF: add support to import functions in ARM NT

This is necessary to support linking a basic program which references symbols
outside of the module itself.  Add the import thunk for ARM NT style imports.
This allows us to create the reference.  However, it is still insufficient to
generate executables that will run due to base relocations not being emitted for
the import.

llvm-svn: 225428

9 years agoRearrange RegisterContextLLDB::SavedLocationForRegister a tiny bit
Jason Molenda [Thu, 8 Jan 2015 03:57:48 +0000 (03:57 +0000)]
Rearrange RegisterContextLLDB::SavedLocationForRegister a tiny bit
so that we will use the UnwindPlan's rule for providing the stack
pointer BEFORE we use the trick of using the callee's CFA address
as the stack pointer.  When we're in a _sigtramp frame, the CFA of
the _sigtramp stack frame is not the same as the stack pointer value
when the async interrupt occurred -- we need to use the eh_frame
rules for retrieving the correct value.

<rdar://problem/18913548>

llvm-svn: 225427

9 years agoAttempt to fix test from r225423 to get build bots green.
Richard Trieu [Thu, 8 Jan 2015 02:40:08 +0000 (02:40 +0000)]
Attempt to fix test from r225423 to get build bots green.

llvm-svn: 225426

9 years agoAdded documentation for test timeout
Vince Harron [Thu, 8 Jan 2015 02:11:26 +0000 (02:11 +0000)]
Added documentation for test timeout

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

Submitted for Chaoren Lin

llvm-svn: 225425

9 years agoRevert "Reapply: Teach SROA how to update debug info for fragmented variables."
Adrian Prantl [Thu, 8 Jan 2015 02:02:00 +0000 (02:02 +0000)]
Revert "Reapply: Teach SROA how to update debug info for fragmented variables."

This reverts commit r225379 while investigating an assertion failure reported
by Alexey.

llvm-svn: 225424

9 years agoWhen the diagnostic text is simply "%0", sanitize the string for any
Richard Trieu [Thu, 8 Jan 2015 01:27:03 +0000 (01:27 +0000)]
When the diagnostic text is simply "%0", sanitize the string for any
unprintable characters.  Fixes PR22048.

llvm-svn: 225423

9 years ago[RegAllocGreedy] Introduce a late pass to repair broken hints.
Quentin Colombet [Thu, 8 Jan 2015 01:16:39 +0000 (01:16 +0000)]
[RegAllocGreedy] Introduce a late pass to repair broken hints.

A broken hint is a copy where both ends are assigned different colors. When a
variable gets evicted in the neighborhood of such copies, it is likely we can
reconcile some of them.

** Context **

Copies are inserted during the register allocation via splitting. These split
points are required to relax the constraints on the allocation problem. When
such a point is inserted, both ends of the copy would not share the same color
with respect to the current allocation problem. When variables get evicted,
the allocation problem becomes different and some split point may not be
required anymore. However, the related variables may already have been colored.

This usually shows up in the assembly with pattern like this:
def A
...
save A to B
def A
use A
restore A from B
...
use B

Whereas we could simply have done:
def B
...
def A
use A
...
use B

** Proposed Solution **

A variable having a broken hint is marked for late recoloring if and only if
selecting a register for it evict another variable. Indeed, if no eviction
happens this is pointless to look for recoloring opportunities as it means the
situation was the same as the initial allocation problem where we had to break
the hint.

Finally, when everything has been allocated, we look for recoloring
opportunities for all the identified candidates.
The recoloring is performed very late to rely on accurate copy cost (all
involved variables are allocated).
The recoloring is simple unlike the last change recoloring. It propagates the
color of the broken hint to all its copy-related variables. If the color is
available for them, the recoloring uses it, otherwise it gives up on that hint
even if a more complex coloring would have worked.

The recoloring happens only if it is profitable. The profitability is evaluated
using the expected frequency of the copies of the currently recolored variable
with a) its current color and b) with the target color. If a) is greater or
equal than b), then it is profitable and the recoloring happen.

** Example **

Consider the following example:
BB1:
  a =
  b =
BB2:
  ...
   = b
   = a
Let us assume b gets split:
BB1:
  a =
  b =
BB2:
  c = b
  ...
  d = c
  = d
  = a
Because of how the allocation work, b, c, and d may be assigned different
colors. Now, if a gets evicted to make room for c, assuming b and d were
assigned to something different than a.
We end up with:
BB1:
  a =
  st a, SpillSlot
  b =
BB2:
  c = b
  ...
  d = c
  = d
  e = ld SpillSlot
  = e
This is likely that we can assign the same register for b, c, and d,
getting rid of 2 copies.

** Performances **

Both ARM64 and x86_64 show performance improvements of up to 3% for the
llvm-testsuite + externals with Os and O3. There are a few regressions too that
comes from the (in)accuracy of the block frequency estimate.

<rdar://problem/18312047>

llvm-svn: 225422

9 years ago[SelectionDAG] Allow targets to specify legality of extloads' result
Ahmed Bougacha [Thu, 8 Jan 2015 00:51:32 +0000 (00:51 +0000)]
[SelectionDAG] Allow targets to specify legality of extloads' result
type (in addition to the memory type).

The *LoadExt* legalization handling used to only have one type, the
memory type.  This forced users to assume that as long as the extload
for the memory type was declared legal, and the result type was legal,
the whole extload was legal.

However, this isn't always the case.  For instance, on X86, with AVX,
this is legal:
    v4i32 load, zext from v4i8
but this isn't:
    v4i64 load, zext from v4i8
Whereas v4i64 is (arguably) legal, even without AVX2.

Note that the same thing was done a while ago for truncstores (r46140),
but I assume no one needed it yet for extloads, so here we go.

Calls to getLoadExtAction were changed to add the value type, found
manually in the surrounding code.

Calls to setLoadExtAction were mechanically changed, by wrapping the
call in a loop, to match previous behavior.  The loop iterates over
the MVT subrange corresponding to the memory type (FP vectors, etc...).
I also pulled neighboring setTruncStoreActions into some of the loops;
those shouldn't make a difference, as the additional types are illegal.
(e.g., i128->i1 truncstores on PPC.)

No functional change intended.

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

llvm-svn: 225421

9 years agoRemove empty statement. No functionality change.
Nick Lewycky [Thu, 8 Jan 2015 00:47:03 +0000 (00:47 +0000)]
Remove empty statement. No functionality change.

llvm-svn: 225420

9 years agoX86: VZeroUpperInserter: shortcut should not trigger if we have any function live...
Matthias Braun [Thu, 8 Jan 2015 00:33:48 +0000 (00:33 +0000)]
X86: VZeroUpperInserter: shortcut should not trigger if we have any function live-ins.

llvm-svn: 225419

9 years agoFix a problem where a ValueObject could fail to update itself, but since it was previ...
Enrico Granata [Thu, 8 Jan 2015 00:29:12 +0000 (00:29 +0000)]
Fix a problem where a ValueObject could fail to update itself, but since it was previously valid, we'd have an old checksum to compare aginst no new checksum (because failure to update), and assert() and die. Fix the problem by only caring about this assertion logic if updates succeed

llvm-svn: 225418

9 years agoRun clang-format on tools/llvm-objdump/MachODump.cpp again as some of my
Kevin Enderby [Thu, 8 Jan 2015 00:25:24 +0000 (00:25 +0000)]
Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my
previous changes got in with incorrect formatting. No functional change.

llvm-svn: 225417

9 years agoRegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges.
Matthias Braun [Thu, 8 Jan 2015 00:21:23 +0000 (00:21 +0000)]
RegisterCoalescer: Do not remove IMPLICIT_DEFS if they are required for subranges.

The register coalescer used to remove implicit_defs when they are
covered by the main range anyway. With subreg liveness tracking we can't
do that anymore in places where the IMPLICIT_DEF is required as begin of
a subregister liverange.

llvm-svn: 225416

9 years agoRegisterCoalescer: Fix valuesIdentical() in some subrange merge cases.
Matthias Braun [Wed, 7 Jan 2015 23:58:38 +0000 (23:58 +0000)]
RegisterCoalescer: Fix valuesIdentical() in some subrange merge cases.

I got confused and assumed SrcIdx/DstIdx of the CoalescerPair is a
subregister index in SrcReg/DstReg, but they are actually subregister
indices of the coalesced register that get you back to SrcReg/DstReg
when applied.

Fixed the bug, improved comments and simplified code accordingly.

Testcase by Tom Stellard!

llvm-svn: 225415

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Wed, 7 Jan 2015 23:50:05 +0000 (23:50 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 225414

9 years agoLiveInterval: Implement feedback by Quentin Colombet.
Matthias Braun [Wed, 7 Jan 2015 23:35:11 +0000 (23:35 +0000)]
LiveInterval: Implement feedback by Quentin Colombet.

llvm-svn: 225413

9 years ago[GC] improve testing around gc.relocate and fix a test
Philip Reames [Wed, 7 Jan 2015 22:48:01 +0000 (22:48 +0000)]
[GC] improve testing around gc.relocate and fix a test

Patch by: Ramkumar Ramachandra <artagnon@gmail.com>

"This patch started out as an exploration of gc.relocate, and an attempt
to write a simple test in call-lowering. I then noticed that the
arguments of gc.relocate were not checked fully, so I went in and fixed
a few things. Finally, the most important outcome of this patch is that
my new error handling code caught a bug in a callsite in
stackmap-format."

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

llvm-svn: 225412

9 years ago[CodeGen] Add MVT::isValid to replace manual validity checks. NFC.
Ahmed Bougacha [Wed, 7 Jan 2015 22:47:46 +0000 (22:47 +0000)]
[CodeGen] Add MVT::isValid to replace manual validity checks. NFC.

Now that we have MVT::FIRST_VALUETYPE (r225362), we can provide a method
checking that the MVT is valid, that is, it's in
  [FIRST_VALUETYPE, LAST_VALUETYPE[.
This commit also uses it in a few asserts, that would previously accept
invalid MVTs, such as the default constructed -1.  In that case,
the code following those asserts would do an out-of-bounds array access.
Using MVT::isValid, those assertions fail as expected when passed
invalid MVTs.
It feels clunky to have such a validity checking function, but it's
at least better than the alternative of broken manual checks.

llvm-svn: 225411

9 years agoR600/SI: Commute instructions to enable more folding opportunities
Tom Stellard [Wed, 7 Jan 2015 22:44:19 +0000 (22:44 +0000)]
R600/SI: Commute instructions to enable more folding opportunities

llvm-svn: 225410

9 years agoAdd help text for mmacosx-version-min=, mios-version-min=.
Nico Weber [Wed, 7 Jan 2015 22:40:55 +0000 (22:40 +0000)]
Add help text for mmacosx-version-min=, mios-version-min=.

I keep forgetting the exact spelling of -macosx-version-min=, and now I can
run `bin/clang --help | grep version -A 2` to remind myself.  While here,
also document -mios-version-min=.  Don't document -mios-simulator-version-min=
as it's just an alias for -mios-version-min= these days.

llvm-svn: 225409

9 years agoMissed a typename
Marshall Clow [Wed, 7 Jan 2015 22:26:48 +0000 (22:26 +0000)]
Missed a typename

llvm-svn: 225408

9 years agoFix inlined test cases so they print out the correct command to run when they fail...
Greg Clayton [Wed, 7 Jan 2015 22:25:50 +0000 (22:25 +0000)]
Fix inlined test cases so they print out the correct command to run when they fail instead of printing out incorrect information.

To fix this I added a new method to TestBase:

    def getRerunArgs(self):
        return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)

The InlineTest which inherits from TestBase then overrides this function with a custom version which does the right thing.

llvm-svn: 225407

9 years agoIR: Add MDNode::getDistinct()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 22:24:46 +0000 (22:24 +0000)]
IR: Add MDNode::getDistinct()

Allow distinct `MDNode`s to be explicitly created.  There's no way (yet)
of representing their distinctness in assembly/bitcode, however, so this
still isn't first-class.

Part of PR22111.

llvm-svn: 225406

9 years agoR600/SI: Only fold immediates that have one use
Tom Stellard [Wed, 7 Jan 2015 22:18:27 +0000 (22:18 +0000)]
R600/SI: Only fold immediates that have one use

Folding the same immediate into multiple instruction will increase
program size, which can hurt performance.

llvm-svn: 225405

9 years agoTest commit.
Sean Silva [Wed, 7 Jan 2015 22:07:33 +0000 (22:07 +0000)]
Test commit.

Hopefully this one won't kill the git mirror...

llvm-svn: 225404

9 years agolibc++ implements its' hash objects as deriving from std::unary_function, and the...
Marshall Clow [Wed, 7 Jan 2015 21:53:23 +0000 (21:53 +0000)]
libc++ implements its' hash objects as deriving from std::unary_function, and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library.

llvm-svn: 225403

9 years agoIn C++03, a bunch of the arithmetic/logical/comparison functors (such as negate/bit_n...
Marshall Clow [Wed, 7 Jan 2015 21:51:30 +0000 (21:51 +0000)]
In C++03, a bunch of the arithmetic/logical/comparison functors (such as negate/bit_not.pass/logical_not) were defined as deriving from unary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion.

llvm-svn: 225402

9 years agoIR: Add MDNode::isDistinct()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 21:35:38 +0000 (21:35 +0000)]
IR: Add MDNode::isDistinct()

Add API to indicate whether an `MDNode` is distinct.  A distinct node is
not stored in the MDNode uniquing tables, and will never be returned by
`MDNode::get()`.

Although distinct nodes are only currently created by uniquing
collisions (when operands change), PR22111 will allow these nodes to be
explicitly created.

llvm-svn: 225401

9 years ago[LangRef] PR22118: Hyphen is allowed in IR identifiers.
Sean Silva [Wed, 7 Jan 2015 21:35:14 +0000 (21:35 +0000)]
[LangRef] PR22118: Hyphen is allowed in IR identifiers.

E.g. %-foo and %fo-o.

Thanks to eagle-eyed reporter Tomas Brukner.

llvm-svn: 225400

9 years agoUpdate a comment.
Adrian Prantl [Wed, 7 Jan 2015 21:35:13 +0000 (21:35 +0000)]
Update a comment.

llvm-svn: 225399

9 years agolldb-platform - static link all llvm dependencies
Vince Harron [Wed, 7 Jan 2015 21:35:07 +0000 (21:35 +0000)]
lldb-platform - static link all llvm dependencies

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

lldb-gdbserver statically links all llvm dependencies. This allows
dead stripping code and reduces total binary size.

This change modifies lldb-plaform to static link llvm dependencies
like lldb-gdbserver.

llvm-svn: 225398

9 years agoLinker: Don't use MDNode::replaceOperandWith()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 21:32:27 +0000 (21:32 +0000)]
Linker: Don't use MDNode::replaceOperandWith()

`MDNode::replaceOperandWith()` changes all instances of metadata.  Stop
using it when linking module flags, since (due to uniquing) the flag
values could be used by other metadata.

Instead, use new API `NamedMDNode::setOperand()` to update the reference
directly.

llvm-svn: 225397

9 years agotodo: Remove some redundant topics
Tobias Grosser [Wed, 7 Jan 2015 21:28:44 +0000 (21:28 +0000)]
todo: Remove some redundant topics

llvm-svn: 225395

9 years agoTest commit to check the new git mirror.
Chandler Carruth [Wed, 7 Jan 2015 21:28:10 +0000 (21:28 +0000)]
Test commit to check the new git mirror.

llvm-svn: 225394

9 years agoXFAIL several MCJIT EH tests under ASan and MSan bootstrap.
Alexey Samsonov [Wed, 7 Jan 2015 21:27:26 +0000 (21:27 +0000)]
XFAIL several MCJIT EH tests under ASan and MSan bootstrap.

llvm-svn: 225393

9 years ago[CodeGen] Use MVT iterator_ranges in legality loops. NFC intended.
Ahmed Bougacha [Wed, 7 Jan 2015 21:27:10 +0000 (21:27 +0000)]
[CodeGen] Use MVT iterator_ranges in legality loops. NFC intended.

A few loops do trickier things than just iterating on an MVT subset,
so I'll leave them be for now.
Follow-up of r225387.

llvm-svn: 225392

9 years agowww: Make sure the main content pane does not overlap with the menu
Tobias Grosser [Wed, 7 Jan 2015 21:21:55 +0000 (21:21 +0000)]
www: Make sure the main content pane does not overlap with the menu

llvm-svn: 225391

9 years agotodo: Adding native OpenSCoP support to Polly does not seem desirable
Tobias Grosser [Wed, 7 Jan 2015 21:18:35 +0000 (21:18 +0000)]
todo: Adding native OpenSCoP support to Polly does not seem desirable

This would add another library dependency to Polly. In many cases the
JSCoP interface we have should be enough and an external JSCoP <> OpenSCoP
converter could be written. We can reconsider this if new use cases show up.

llvm-svn: 225390

9 years agoHandle OpaqueValueExprs more intelligently in the TransformTypos tree
Kaelyn Takata [Wed, 7 Jan 2015 21:16:39 +0000 (21:16 +0000)]
Handle OpaqueValueExprs more intelligently in the TransformTypos tree
transform.

Also diagnose typos in the initializer of an invalid C++ declaration.
Both issues were hit using the same line of test code, depending on
whether the code was treated as C or C++.

Fixes PR22092.

llvm-svn: 225389

9 years agoAdd updated TODO list
Tobias Grosser [Wed, 7 Jan 2015 21:16:33 +0000 (21:16 +0000)]
Add updated TODO list

llvm-svn: 225388

9 years ago[CodeGen] Add iterator_range for the MVT::SimpleValueType enum.
Ahmed Bougacha [Wed, 7 Jan 2015 21:15:38 +0000 (21:15 +0000)]
[CodeGen] Add iterator_range for the MVT::SimpleValueType enum.

This commit adds a simple iterator over that enum, and a few
functions to create iterator ranges over the most common types.

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

llvm-svn: 225387

9 years agoFix uninitialized memory read in llvm-dsymutil for the second time.
Alexey Samsonov [Wed, 7 Jan 2015 21:13:30 +0000 (21:13 +0000)]
Fix uninitialized memory read in llvm-dsymutil for the second time.

This was already fixed by r224481, but apparently was accidentally
reverted in r225207.

llvm-svn: 225386

9 years agoAdd a test that would have found the issue in r224935.
Rafael Espindola [Wed, 7 Jan 2015 21:10:25 +0000 (21:10 +0000)]
Add a test that would have found the issue in r224935.

llvm-svn: 225385

9 years ago[git] Mark the llgo directory in the LLVM gitignore.
Chandler Carruth [Wed, 7 Jan 2015 21:08:54 +0000 (21:08 +0000)]
[git] Mark the llgo directory in the LLVM gitignore.

llvm-svn: 225384

9 years agoSlightly refactor things for llvm-objdump and the -macho option so it can be used...
Kevin Enderby [Wed, 7 Jan 2015 21:02:18 +0000 (21:02 +0000)]
Slightly refactor things for llvm-objdump and the -macho option so it can be used with
options other than just -disassemble so that universal files can be used with other
options combined with -arch options.

No functional change to existing options and use.  One test case added for the
additional functionality with a universal file an a -arch option.

llvm-svn: 225383

9 years agoR600/SI: Remove VReg_32 register class
Tom Stellard [Wed, 7 Jan 2015 20:59:25 +0000 (20:59 +0000)]
R600/SI: Remove VReg_32 register class

Use VGPR_32 register class instead.  These two register classes were
identical and having separate classes was causing
SIInstrInfo::isLegalOperands() to be overly conservative in some cases.

This change is necessary to prevent future paches from missing a folding
opportunity in fneg-fabs.ll.

llvm-svn: 225382

9 years agoAdd tests to check the typedefs from the result of std::owner_less
Marshall Clow [Wed, 7 Jan 2015 20:54:51 +0000 (20:54 +0000)]
Add tests to check the typedefs from the result of std::owner_less

llvm-svn: 225381

9 years agoMore FMA folding opportunities.
Olivier Sallenave [Wed, 7 Jan 2015 20:54:17 +0000 (20:54 +0000)]
More FMA folding opportunities.

llvm-svn: 225380

9 years agoReapply: Teach SROA how to update debug info for fragmented variables.
Adrian Prantl [Wed, 7 Jan 2015 20:52:22 +0000 (20:52 +0000)]
Reapply: Teach SROA how to update debug info for fragmented variables.

The two buildbot failures were addressed in LLVM r225378 and CFE r225359.

This rapplies commit 225272 without modifications.

llvm-svn: 225379