oota-llvm.git
9 years agoFix llc path in MIR testcases committed in r237708.
Alex Lorenz [Tue, 19 May 2015 18:45:41 +0000 (18:45 +0000)]
Fix llc path in MIR testcases committed in r237708.

I've committed testcases with local llc path by mistake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237712 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agouse range-based for-loop
Sanjay Patel [Tue, 19 May 2015 18:24:33 +0000 (18:24 +0000)]
use range-based for-loop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237711 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove unused MCRelocationInfo.h include from MCDisassembler.h. NFC
Pete Cooper [Tue, 19 May 2015 18:18:49 +0000 (18:18 +0000)]
Remove unused MCRelocationInfo.h include from MCDisassembler.h.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237710 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoChange a reachable unreachable to a fatal error.
Filipe Cabecinhas [Tue, 19 May 2015 18:18:10 +0000 (18:18 +0000)]
Change a reachable unreachable to a fatal error.

Summary:
Also tagged a FIXME comment, and added information about why it breaks.

Bug found using AFL fuzz.

Reviewers: rafael, craig.topper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237709 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMIR Serialization: print and parse LLVM IR using MIR format.
Alex Lorenz [Tue, 19 May 2015 18:17:39 +0000 (18:17 +0000)]
MIR Serialization: print and parse LLVM IR using MIR format.

This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR
using the MIR format. This pass is then added as a last pass when a
'stop-after' option is used in llc. The new library adds the initial
functionality for parsing of MIR files as well. This commit also
extends the llc tool so that it can recognize and parse MIR input files.

Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237708 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove unused MachineLocation.h include from MCAsmInfo.h. NFC
Pete Cooper [Tue, 19 May 2015 17:59:09 +0000 (17:59 +0000)]
Remove unused MachineLocation.h include from MCAsmInfo.h.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237707 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRegisterCoalescer: Improve a comment.
Matthias Braun [Tue, 19 May 2015 17:52:32 +0000 (17:52 +0000)]
RegisterCoalescer: Improve a comment.

Explain the relation of the example to the variables in the code,
explain what bad behaviour the code avoids in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237706 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agouse range-based for loop
Sanjay Patel [Tue, 19 May 2015 17:49:14 +0000 (17:49 +0000)]
use range-based for loop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237705 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[RewriteStatepointsForGC] Fix up naming in "relocationViaAlloca" and run it through...
Igor Laevsky [Tue, 19 May 2015 16:29:43 +0000 (16:29 +0000)]
[RewriteStatepointsForGC] Fix up naming in "relocationViaAlloca" and run it through clang-format.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237703 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove the InstructionSimplifierPass immediately after InstructionCombiningPass.
Wei Mi [Tue, 19 May 2015 16:09:11 +0000 (16:09 +0000)]
Remove the InstructionSimplifierPass immediately after InstructionCombiningPass.

InstructionCombiningPass was added after LoopUnrollPass in r237395. Because
InstructionCombiningPass is strictly more powerful than InstructionSimplifierPass,
remove the unnecessary InstructionSimplifierPass.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237702 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[RewriteStatepointsForGC] For some values (like gep's and bitcasts) it's cheaper...
Igor Laevsky [Tue, 19 May 2015 15:59:05 +0000 (15:59 +0000)]
[RewriteStatepointsForGC] For some values (like gep's and bitcasts) it's cheaper to clone them after statepoint than to emit proper relocates for them. This change implements this logic. There is alredy similar optimization in CodeGenPrepare, but doing so during RewriteStatepointsForGC allows to capture more opprtunities such as relocates in loops and longer instruction chains.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237701 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPSr6] Implement NOR, OR, ORI, XOR and XORI instructions
Zoran Jovanovic [Tue, 19 May 2015 14:12:55 +0000 (14:12 +0000)]
[mips][microMIPSr6] Implement NOR, OR, ORI, XOR and XORI instructions
Differential Revision: http://reviews.llvm.org/D8800

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237697 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPSr6] Implement AND and ANDI instructions
Zoran Jovanovic [Tue, 19 May 2015 13:32:31 +0000 (13:32 +0000)]
[mips][microMIPSr6] Implement AND and ANDI instructions
Differential Revision: http://reviews.llvm.org/D8772

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237696 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRangify for loop in Cleanup(), NFC.
Yaron Keren [Tue, 19 May 2015 13:32:19 +0000 (13:32 +0000)]
Rangify for loop in Cleanup(), NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237695 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPrevent Cleanup() from running more than once.
Yaron Keren [Tue, 19 May 2015 13:31:25 +0000 (13:31 +0000)]
Prevent Cleanup() from running more than once.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237694 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse cat and not type Under MSYS, same as Cygwin.
Yaron Keren [Tue, 19 May 2015 12:59:23 +0000 (12:59 +0000)]
Use cat and not type Under MSYS, same as Cygwin.
type means something else under the MSYS shell.

Patch by Tzafrir Poupko!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237692 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Correct and improve special-case shuffle instructions.
Daniel Sanders [Tue, 19 May 2015 12:24:52 +0000 (12:24 +0000)]
[mips] Correct and improve special-case shuffle instructions.

Summary:
The documentation writes vectors highest-index first whereas LLVM-IR writes
them lowest-index first. As a result, instructions defined in terms of
left_half() and right_half() had the halves reversed.

In addition to correcting them, they have been improved to allow shuffles
that use the same operand twice or in reverse order. For example, ilvev
used to accept masks of the form:
  <0, n, 2, n+2, 4, n+4, ...>
but now accepts:
  <0, 0, 2, 2, 4, 4, ...>
  <n, n, n+2, n+2, n+4, n+4, ...>
  <0, n, 2, n+2, 4, n+4, ...>
  <n, 0, n+2, 2, n+4, 4, ...>

One further improvement is that splati.[bhwd] is now the preferred instruction
for splat-like operations. The other special shuffles are no longer used
for splats. This lead to the discovery that <0, 0, ...> would not cause
splati.[hwd] to be selected and this has also been fixed.

This fixes the enc-3des test from the test-suite on Mips64r6 with MSA.

Reviewers: vkalintiris

Reviewed By: vkalintiris

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237689 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAs r237678 was reverted, this is no longer needed.
Yaron Keren [Tue, 19 May 2015 11:46:27 +0000 (11:46 +0000)]
As r237678 was reverted, this is no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237687 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPSr6] Implement DIV, DIVU, MOD and MODU instructions
Zoran Jovanovic [Tue, 19 May 2015 11:21:37 +0000 (11:21 +0000)]
[mips][microMIPSr6] Implement DIV, DIVU, MOD and MODU instructions
Differential Revision: http://reviews.llvm.org/D8769

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237685 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix Visual C++ errors C2784, C2780, C2782 after r237678.
Yaron Keren [Tue, 19 May 2015 11:18:10 +0000 (11:18 +0000)]
Fix Visual C++ errors C2784, C2780, C2782 after r237678.
It does not like std::min(unsigned, uint32_t).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237683 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] ABI change for x86-32: pass 3 vector arguments in-register instead of 4, except...
Michael Kuperstein [Tue, 19 May 2015 11:06:56 +0000 (11:06 +0000)]
[X86] ABI change for x86-32: pass 3 vector arguments in-register instead of 4, except on Darwin.

This changes the ABI used on 32-bit x86 for passing vector arguments.
Historically, clang passes the first 4 vector arguments in-register, and additional vector arguments on the stack, regardless of platform. That is different from the behavior of gcc, icc, and msvc, all of which pass only the first 3 arguments in-register.
The 3-register convention is documented, unofficially, in Agner's calling convention guide, and, officially, in the recently released version 1.0 of the i386 psABI.

Darwin is kept as is because the OS X ABI Function Call Guide explicitly documents the current (4-register) behavior.

This fixes PR21510

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237682 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Avoid size_t -> unsigned conversion in MathExtras.h header. NFC".
Pawel Bylica [Tue, 19 May 2015 10:51:24 +0000 (10:51 +0000)]
Revert "Avoid size_t -> unsigned conversion in MathExtras.h header. NFC".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237680 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAvoid size_t -> unsigned conversion in MathExtras.h header. NFC.
Pawel Bylica [Tue, 19 May 2015 10:35:32 +0000 (10:35 +0000)]
Avoid size_t -> unsigned conversion in MathExtras.h header. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237678 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix documentation for Set-Like Containers
Artyom Skrobov [Tue, 19 May 2015 10:21:12 +0000 (10:21 +0000)]
Fix documentation for Set-Like Containers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237677 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix getSwappedBytes for double.
Pawel Bylica [Tue, 19 May 2015 08:44:15 +0000 (08:44 +0000)]
Fix getSwappedBytes for double.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237673 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBrainF.cpp: Update CreateCall() according to r237624.
NAKAMURA Takumi [Tue, 19 May 2015 06:50:19 +0000 (06:50 +0000)]
BrainF.cpp: Update CreateCall() according to r237624.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237669 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDrop unnecessary ';' after namespace
Tobias Grosser [Tue, 19 May 2015 06:25:19 +0000 (06:25 +0000)]
Drop unnecessary ';' after namespace

The ';' was introduced in 237642. With it in place, we get a large number of
warnings in -pedantic mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237667 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSelectionDAG: Cleanup and simplify FoldConstantArithmetic
Matthias Braun [Tue, 19 May 2015 01:40:21 +0000 (01:40 +0000)]
SelectionDAG: Cleanup and simplify FoldConstantArithmetic

This cleans up the FoldConstantArithmetic code by factoring out the case
of two ConstantSDNodes into an own function. This avoids unnecessary
complexity for many callers who already have ConstantSDNode arguments.

This also avoids an intermeidate SmallVector datastructure and a loop
over that datastructure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237651 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[BitcodeReader] Error out if we read an invalid function argument type
Filipe Cabecinhas [Tue, 19 May 2015 01:21:06 +0000 (01:21 +0000)]
[BitcodeReader] Error out if we read an invalid function argument type

Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237650 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[lib/Fuzzer] more efficient reload logic; also don't spam git too much
Kostya Serebryany [Tue, 19 May 2015 01:06:07 +0000 (01:06 +0000)]
[lib/Fuzzer] more efficient reload logic; also don't spam git too much

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237649 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[BitcodeReader] It's a malformed block if CodeLenWidth is too big
Filipe Cabecinhas [Tue, 19 May 2015 00:34:17 +0000 (00:34 +0000)]
[BitcodeReader] It's a malformed block if CodeLenWidth is too big

Bug found with AFL fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237646 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDAGCombiner: Factor common pattern into isOneConstant() function. NFC
Matthias Braun [Tue, 19 May 2015 00:25:21 +0000 (00:25 +0000)]
DAGCombiner: Factor common pattern into isOneConstant() function. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237645 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDAGCombiner: Factor common pattern into isAllOnesConstant() function. NFC
Matthias Braun [Tue, 19 May 2015 00:25:20 +0000 (00:25 +0000)]
DAGCombiner: Factor common pattern into isAllOnesConstant() function. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237644 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDAGCombiner: Use isNullConstant() where possible
Matthias Braun [Tue, 19 May 2015 00:25:17 +0000 (00:25 +0000)]
DAGCombiner: Use isNullConstant() where possible

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237643 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoStore intrinsic ID by value in Function instead of a string lookup. NFC.
Pete Cooper [Tue, 19 May 2015 00:24:26 +0000 (00:24 +0000)]
Store intrinsic ID by value in Function instead of a string lookup.  NFC.

On 64-bit targets, Function has 4-bytes of padding in its struct layout.

This uses the space for the intrinsic ID. It is set and recalculated whenever the function name is set.  This is similar to the current behavior which clears the function from the intrinsic ID cache when its renamed.

The intrinsic cache itself is removed as the only purpose was to speedup calls to getIntrinsicID() which now just reading the new field in the struct.

Reviewed by Duncan.  http://reviews.llvm.org/D9836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237642 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove Function::lookupIntrinsicID to a static method. NFC
Pete Cooper [Tue, 19 May 2015 00:02:25 +0000 (00:02 +0000)]
Move Function::lookupIntrinsicID to a static method.  NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237641 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-land r237175: [X86] Always return the sret parameter in eax/rax ...
Reid Kleckner [Mon, 18 May 2015 23:35:09 +0000 (23:35 +0000)]
Re-land r237175: [X86] Always return the sret parameter in eax/rax ...

This reverts commit r237210.

Also fix X86/complex-fca.ll to match the code that we used to generate
on win32 and now generate everwhere to conform to SysV.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237639 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert accidental change in r237633
Matthias Braun [Mon, 18 May 2015 23:18:13 +0000 (23:18 +0000)]
Revert accidental change in r237633

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237635 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPSr6] Implement LSA instruction
Jozef Kolek [Mon, 18 May 2015 23:12:10 +0000 (23:12 +0000)]
[mips][microMIPSr6] Implement LSA instruction

This patch implements LSA instruction using mapping.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237634 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDAGCombiner: Factor common pattern into isNullConstant() function. NFC
Matthias Braun [Mon, 18 May 2015 23:07:27 +0000 (23:07 +0000)]
DAGCombiner: Factor common pattern into isNullConstant() function. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237633 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[opaque pointer type] Provide a convenience for IRBuilder::CreateCall that...
David Blaikie [Mon, 18 May 2015 22:40:13 +0000 (22:40 +0000)]
Revert "[opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts a Function without needing to take an explicit callee Type"

Creates ambiguity in Clang callers. Reverting while I figure it out.

This reverts commit r237627.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237629 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[BitcodeReader] Make sure the type of the inserted value matches the type of the...
Filipe Cabecinhas [Mon, 18 May 2015 22:27:11 +0000 (22:27 +0000)]
[BitcodeReader] Make sure the type of the inserted value matches the type of the aggregate at those indices

Bug found with AFL-fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237628 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts...
David Blaikie [Mon, 18 May 2015 22:25:14 +0000 (22:25 +0000)]
[opaque pointer type] Provide a convenience for IRBuilder::CreateCall that accepts a Function without needing to take an explicit callee Type

The common case is a direct call, so don't make all those users have to
explicitly pass the result of llvm::Function::getFunctionType.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237627 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only
David Blaikie [Mon, 18 May 2015 22:13:54 +0000 (22:13 +0000)]
Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced init only

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237624 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago80-col fixup.
Eric Christopher [Mon, 18 May 2015 22:12:43 +0000 (22:12 +0000)]
80-col fixup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237623 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix grammar in comments.
Eric Christopher [Mon, 18 May 2015 22:12:41 +0000 (22:12 +0000)]
Fix grammar in comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237622 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAArch64: work around ld64 bug more aggressively.
Tim Northover [Mon, 18 May 2015 22:07:20 +0000 (22:07 +0000)]
AArch64: work around ld64 bug more aggressively.

ld64 currently mishandles internal pointer relocations (i.e.
ARM64_RELOC_UNSIGNED referred to by section & offset rather than symbol). The
existing __cfstring clause was an early discovery and workaround for this, but
the problem is wider and we should avoid such relocations wherever possible for
now.

This code should be reverted to allowing internal relocations as soon as
possible.

PR23437.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237621 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix some odd whitespace and formatting errors while making
Eric Christopher [Mon, 18 May 2015 21:49:02 +0000 (21:49 +0000)]
Fix some odd whitespace and formatting errors while making
changes in ConstantsContext.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237620 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoExtract the load/store type verification to a separate function.
Filipe Cabecinhas [Mon, 18 May 2015 21:48:55 +0000 (21:48 +0000)]
Extract the load/store type verification to a separate function.

Summary:
Added isLoadableOrStorableType to PointerType.

We were doing some checks in some places, occasionally assert()ing instead
of telling the caller. With this patch, I'm putting all type checking in
the same place for load/store type instructions, and verifying the same
thing every time.

I also added a check for load/store of a function type.

Applied extracted check to Load, Store, and Cmpxcg.

I don't have exhaustive tests for all of these, but all Error() calls in
TypeCheckLoadStoreInst are being tested (in invalid.test).

Reviewers: dblaikie, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237619 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD CORPUS...
Kostya Serebryany [Mon, 18 May 2015 21:34:20 +0000 (21:34 +0000)]
[lib/Fuzzer] when -sync_command=<CMD> is given, periodically execute 'CMD CORPUS' to synchronize with other processes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237617 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[YAML] Plug a memory leak
Benjamin Kramer [Mon, 18 May 2015 21:11:27 +0000 (21:11 +0000)]
[YAML] Plug a memory leak

The destructor of BlockScalarNode is never called. Store the contained
string in BumpPtrAllocated memory instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237614 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMachineInstr: Change return value of getOpcode() to unsigned.
Matthias Braun [Mon, 18 May 2015 20:27:55 +0000 (20:27 +0000)]
MachineInstr: Change return value of getOpcode() to unsigned.

This was previously returning int. However there are no negative opcode
numbers and more importantly this was needlessly different from
MCInstrDesc::getOpcode() (which even is the value returned here) and
SDValue::getOpcode()/SDNode::getOpcode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237611 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Verifier] Assert gc_relocate always return a pointer type
Chen Li [Mon, 18 May 2015 19:50:14 +0000 (19:50 +0000)]
[Verifier] Assert gc_relocate always return a pointer type

Summary: Add an assertion in verifier.cpp to make sure gc_relocate relocate a gc pointer, and its return type has the same address space with the relocated pointer.

Reviewers: reames, AndyAyers, sanjoy, pgavlin

Reviewed By: pgavlin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237605 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[PlaceSafepoints] Assertion on that gc_result can not have preceding phis should...
Chen Li [Mon, 18 May 2015 19:02:25 +0000 (19:02 +0000)]
[PlaceSafepoints] Assertion on that gc_result can not have preceding phis should only apply to invoke statepoint

Summary: When PlaceSafepoints pass replaces old return result with gc_result from statepoint, it asserts that gc_result can not have preceding phis in its parent block. This is only true on invoke statepoint, which terminates the block and puts its result at the beginning of the normal successor block. Call statepoint does not terminate the block and thus its result is in the same block with it. There should be no restriction on whether there are phis or not.

Reviewers: reames, igor-laevsky

Reviewed By: igor-laevsky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237597 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMC: clang-format MCContext. NFC.
Jim Grosbach [Mon, 18 May 2015 18:43:23 +0000 (18:43 +0000)]
MC: clang-format MCContext. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237595 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMC: Clean up method names in MCContext.
Jim Grosbach [Mon, 18 May 2015 18:43:14 +0000 (18:43 +0000)]
MC: Clean up method names in MCContext.

The naming was a mish-mash of old and new style. Update to be consistent
with the new. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237594 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoExploit dereferenceable_or_null attribute in LICM pass
Sanjoy Das [Mon, 18 May 2015 18:07:00 +0000 (18:07 +0000)]
Exploit dereferenceable_or_null attribute in LICM pass

Summary:
Allow hoisting of loads from values marked with dereferenceable_or_null
attribute. For values marked with the attribute perform
context-sensitive analysis to determine whether it's known-non-null or
not.

Patch by Artur Pilipenko!

Reviewers: hfinkel, sanjoy, reames

Reviewed By: reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237593 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoARM: allow jump tables to be placed as constant islands.
Tim Northover [Mon, 18 May 2015 17:10:40 +0000 (17:10 +0000)]
ARM: allow jump tables to be placed as constant islands.

Previously, they were forced to immediately follow the actual branch
instruction. This was usually OK (the LEAs actually accessing them got emitted
nearby, and weren't usually separated much afterwards). Unfortunately, a
sufficiently nasty phi elimination dumps many instructions right before the
basic block terminator, and this can increase the range too much.

This patch frees them up to be placed as usual by the constant islands pass,
and consequently has to slightly modify the form of TBB/TBH tables to refer to
a PC-relative label at the final jump. The other jump table formats were
already position-independent.

rdar://20813304

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237590 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ScalarEvolution] refactor: extract interface getGEPExpr
Jingyue Wu [Mon, 18 May 2015 17:03:25 +0000 (17:03 +0000)]
[ScalarEvolution] refactor: extract interface getGEPExpr

Summary:
This allows other passes (such as SLSR) to compute the SCEV expression for an
imaginary GEP.

Test Plan: no regression

Reviewers: atrick, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237589 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix llvm::BumpPtrAllocatorImpl::Reset()
Hans Wennborg [Mon, 18 May 2015 16:54:17 +0000 (16:54 +0000)]
Fix llvm::BumpPtrAllocatorImpl::Reset()

BumpPtrAllocator's Reset wouldn't clear CustomSizedSlabs if Slabs.size() == 0.

Patch by Kal <b17c0de@gmail.com>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237588 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoindvars cruft: don't replace phi nodes for no reason.
Andrew Trick [Mon, 18 May 2015 16:49:34 +0000 (16:49 +0000)]
indvars cruft: don't replace phi nodes for no reason.

Don't replace a phi with an identical phi. This was done long ago to
"preserve" IVUsers analysis. The code has already called
SE->forgetValue(PN) so I see no purpose in creating a new value for
the phi.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237587 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplifyIV comments and dead argument cleanup.
Andrew Trick [Mon, 18 May 2015 16:49:31 +0000 (16:49 +0000)]
SimplifyIV comments and dead argument cleanup.

Remove crufty comments. IVUsers hasn't been used here for a long time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237586 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSparc: support the "set" synthetic instruction.
James Y Knight [Mon, 18 May 2015 16:43:33 +0000 (16:43 +0000)]
Sparc: support the "set" synthetic instruction.

This pseudo-instruction expands into 'sethi' and 'or' instructions,
or, just one of them, if the other isn't necessary for a given value.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237585 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPreserve the order of READ_REGISTER and WRITE_REGISTER
Hal Finkel [Mon, 18 May 2015 16:42:10 +0000 (16:42 +0000)]
Preserve the order of READ_REGISTER and WRITE_REGISTER

At the present time, we don't have a way to represent general dependency
relationships, so everything is represented using memory dependency. In order
to preserve the data dependency of a READ_REGISTER on WRITE_REGISTER, we need
to model WRITE_REGISTER as writing (which we had been doing) and model
READ_REGISTER as reading (which we had not been doing). Fix this, and also the
way that the chain operands were generated at the SDAG level.

Patch by Nicholas Paul Johnson, thanks! Test case by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237584 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r237579, as it broke windows buildbots
Oliver Stannard [Mon, 18 May 2015 16:39:16 +0000 (16:39 +0000)]
Revert r237579, as it broke windows buildbots

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237583 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSparc: Support PSR, TBR, WIM read/write instructions.
James Y Knight [Mon, 18 May 2015 16:38:47 +0000 (16:38 +0000)]
Sparc: Support PSR, TBR, WIM read/write instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237582 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSparc: Add the "alternate address space" load/store instructions.
James Y Knight [Mon, 18 May 2015 16:35:04 +0000 (16:35 +0000)]
Sparc: Add the "alternate address space" load/store instructions.

- Adds support for the asm syntax, which has an immediate integer
  "ASI" (address space identifier) appearing after an address, before
  a comma.

- Adds the various-width load, store, and swap in alternate address
  space instructions. (ldsba, ldsha, lduba, lduha, lda, stba, stha,
  sta, swapa)

This does not attempt to hook these instructions up to pointer address
spaces in LLVM, although that would probably be a reasonable thing to
do in the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237581 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd support for the Sparc implementation-defined "ASR" registers.
James Y Knight [Mon, 18 May 2015 16:29:48 +0000 (16:29 +0000)]
Add support for the Sparc implementation-defined "ASR" registers.

(Note that register "Y" is essentially just ASR0).

Also added some test cases for divide and multiply, which had none before.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237580 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LLVM - ARM/AArch64] Add ACLE special register intrinsics
Oliver Stannard [Mon, 18 May 2015 16:23:33 +0000 (16:23 +0000)]
[LLVM - ARM/AArch64] Add ACLE special register intrinsics

This patch implements LLVM support for the ACLE special register intrinsics in
section 10.1, __arm_{w,r}sr{,p,64}.

This patch is intended to lower the read/write_register instrinsics, used to
implement the special register intrinsics in the clang patch for special
register intrinsics (see http://reviews.llvm.org/D9697), to ARM specific
instructions MRC,MCR,MSR etc. to allow reading an writing of coprocessor
registers in AArch32 and AArch64. This is done by inspecting the register
string passed to the intrinsic and then lowering to the appropriate
instruction.

Patch by Luke Cheeseman.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237579 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[DAGCombine] Be more pedantic about use iteration in CombineToPreIndexedLoadStore
Hal Finkel [Mon, 18 May 2015 15:46:02 +0000 (15:46 +0000)]
[DAGCombine] Be more pedantic about use iteration in CombineToPreIndexedLoadStore

In CombineToPreIndexedLoadStore, when the offset is a constant, we have code
that looks for other uses of the pointer which are constant offset computations
so that they can be rewritten in terms of the updated pointer so that we don't
need to keep a copy of the base pointer to compute these constant offsets.

Unfortunately, when it iterated over the uses, it did so by SDNodes, and so we
could confuse ourselves if the base pointer was produced by a node that had
multiple results (because we would not immediately exclude uses of the other
node results). This was reported as PR22755. Unfortunately, we don't have a
test case (and I've also been unable to produce one thus far), but at least the
mistake is clear. The right way to fix this problem is to make use of the information
contained in the use iterators to filter out any uses of other results of the
node producing the base pointer.

This should be mostly NFC, but should also fix PR22755 (for which,
unfortunately, we have no in-tree test case).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237576 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LoopAccesses] If shouldRetryWithRuntimeCheck, reset InterestingDependences
Adam Nemet [Mon, 18 May 2015 15:37:03 +0000 (15:37 +0000)]
[LoopAccesses] If shouldRetryWithRuntimeCheck, reset InterestingDependences

When dependence analysis encounters a non-constant distance between
memory accesses it aborts the analysis and falls back to run-time checks
only.  In this case we weren't resetting the array of dependences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237574 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LoopAccesses] Rearrange printed lines in -analyze
Adam Nemet [Mon, 18 May 2015 15:36:57 +0000 (15:36 +0000)]
[LoopAccesses] Rearrange printed lines in -analyze

"Store to invariant address..." is moved as the last line.  This is not
the prime result of the analysis.  Plus it simplifies some of the tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237573 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LoopAccesses] Debug improvement
Adam Nemet [Mon, 18 May 2015 15:36:52 +0000 (15:36 +0000)]
[LoopAccesses] Debug improvement

Report pointers with unknown bounds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237572 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPSr6] Implement ALIGN and AUI instructions
Jozef Kolek [Mon, 18 May 2015 11:44:30 +0000 (11:44 +0000)]
[mips][microMIPSr6] Implement ALIGN and AUI instructions

This patch implements ALIGN and AUI instructions using mapping.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237563 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: Added intrinsics for ADDSS/D, MULSS/D, SUBSS/D, DIVSS/D
Elena Demikhovsky [Mon, 18 May 2015 07:24:19 +0000 (07:24 +0000)]
AVX-512: Added intrinsics for ADDSS/D, MULSS/D, SUBSS/D, DIVSS/D
instructions. These intrinsics are comming with rounding mode.
Added intrinsics for MAXSS/D, MINSS/D - with and without  sae.

By Asaf Badouh (asaf.badouh@intel.com)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237560 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agofixed compilation warning/error
Elena Demikhovsky [Mon, 18 May 2015 07:10:25 +0000 (07:10 +0000)]
fixed compilation warning/error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237559 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: Added patterns for scalar-to-vector broadcast
Elena Demikhovsky [Mon, 18 May 2015 07:06:23 +0000 (07:06 +0000)]
AVX-512: Added patterns for scalar-to-vector broadcast

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237558 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: Added VBROADCASTF64X4, VBROADCASTF64X2, VBROADCASTI32X8, and other instructi...
Elena Demikhovsky [Mon, 18 May 2015 06:42:57 +0000 (06:42 +0000)]
AVX-512: Added VBROADCASTF64X4, VBROADCASTF64X2, VBROADCASTI32X8, and other instructions from this set
Added encoding tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237557 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[PowerPC] Add extra r2 read deps on @toc@l relocations
Hal Finkel [Mon, 18 May 2015 06:25:59 +0000 (06:25 +0000)]
[PowerPC] Add extra r2 read deps on @toc@l relocations

If some commits are happy, and some commits are sad, this is a sad commit. It
is sad because it restricts instruction scheduling to work around a binutils
linker bug, and moreover, one that may never be fixed. On 2012-05-21, GCC was
updated not to produce code triggering this bug, and now we'll do the same...

When resolving an address using the ELF ABI TOC pointer, two relocations are
generally required: one for the high part and one for the low part. Only
the high part generally explicitly depends on r2 (the TOC pointer). And, so,
we might produce code like this:

.Ltmp526:
        addis 3, 2, .LC12@toc@ha
.Ltmp1628:
        std 2, 40(1)
        ld 5, 0(27)
        ld 2, 8(27)
        ld 11, 16(27)
        ld 3, .LC12@toc@l(3)
        rldicl 4, 4, 0, 32
        mtctr 5
        bctrl
        ld 2, 40(1)

And there is nothing wrong with this code, as such, but there is a linker bug
in binutils (https://sourceware.org/bugzilla/show_bug.cgi?id=18414) that will
misoptimize this code sequence to this:
        nop
        std     r2,40(r1)
        ld      r5,0(r27)
        ld      r2,8(r27)
        ld      r11,16(r27)
        ld      r3,-32472(r2)
        clrldi  r4,r4,32
        mtctr   r5
        bctrl
        ld      r2,40(r1)
because the linker does not know (and does not check) that the value in r2
changed in between the instruction using the .LC12@toc@ha (TOC-relative)
relocation and the instruction using the .LC12@toc@l(3) relocation.
Because it finds these instructions using the relocations (and not by
scanning the instructions), it has been asserted that there is no good way
to detect the change of r2 in between. As a result, this bug may never be
fixed (i.e. it may become part of the definition of the ABI). GCC was
updated to add extra dependencies on r2 to instructions using the @toc@l
relocations to avoid this problem, and we'll do the same here.

This is done as a separate pass because:
 1. These extra r2 dependencies are not really properties of the
    instructions, but rather due to a linker bug, and maybe one day we'll be
    able to get rid of them when targeting linkers without this bug (and,
    thus, keeping the logic centralized here will make that
    straightforward).
 2. There are ISel-level peephole optimizations that propagate the @toc@l
    relocations to some user instructions, and so the exta dependencies do
    not apply only to a fixed set of instructions (without undesirable
    definition replication).

The test case was reduced with the help of bugpoint, with minimal cleaning. I'm
looking forward to our upcoming MI serialization support, and with that, much
better tests can be created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237556 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMachineScheduler debug output clarity.
Andrew Trick [Sun, 17 May 2015 23:40:31 +0000 (23:40 +0000)]
MachineScheduler debug output clarity.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237545 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRegisterPressureTracker: reword stale comments.
Andrew Trick [Sun, 17 May 2015 23:40:27 +0000 (23:40 +0000)]
RegisterPressureTracker: reword stale comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237544 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReapply r237520 with another fix for infinite looping
James Molloy [Sun, 17 May 2015 08:27:27 +0000 (08:27 +0000)]
Reapply r237520 with another fix for infinite looping

SimplifyDemandedBits was "simplifying" a constant by removing just sign bits.
This caused a canonicalization race between different parts of instcombine.

Fix and regression test added - third time lucky?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237539 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: fixed extended load to 512-bit register
Elena Demikhovsky [Sun, 17 May 2015 08:08:06 +0000 (08:08 +0000)]
AVX-512: fixed extended load to 512-bit register

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237537 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: fixed a bug in mask operations - (i1 1) pattern
Elena Demikhovsky [Sun, 17 May 2015 07:28:51 +0000 (07:28 +0000)]
AVX-512: fixed a bug in mask operations - (i1 1) pattern
Filling k-reg with all-ones value was wrong,
(i1 1) should switch on only one bit in mask register

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237536 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCode cleanup: Reindent Fuzzer::MutateAndTestOne.
Logan Chien [Sun, 17 May 2015 02:44:31 +0000 (02:44 +0000)]
Code cleanup: Reindent Fuzzer::MutateAndTestOne.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237533 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert commits r237521 and r237520.
James Molloy [Sat, 16 May 2015 21:27:14 +0000 (21:27 +0000)]
Revert commits r237521 and r237520.

The AArch64 LNT bot is unhappy - I've found that the problem is in
SimpliftDemandedBits, but that's going to require another code review
so reverting in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237528 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove Pass into anonymous namespace. NFC.
Benjamin Kramer [Sat, 16 May 2015 16:16:35 +0000 (16:16 +0000)]
Move Pass into anonymous namespace. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237526 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Push unique_ptr through the Action interface.
Benjamin Kramer [Sat, 16 May 2015 15:40:03 +0000 (15:40 +0000)]
[WinEH] Push unique_ptr through the Action interface.

This was the source of many leaks in the past, this should fix them once and
for all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237524 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDenseMap: Remove poisoning of unused memory.
Benjamin Kramer [Sat, 16 May 2015 14:19:54 +0000 (14:19 +0000)]
DenseMap: Remove poisoning of unused memory.

DenseMap has great support for catching invalidated iterators now so we can get
rid of this crude hack. Use after frees are covered by asan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237523 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMC: Lower the default alignment of MCContext's operator new to 8
Benjamin Kramer [Sat, 16 May 2015 13:54:08 +0000 (13:54 +0000)]
MC: Lower the default alignment of MCContext's operator new to 8

This is more than sufficient for all MC types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237522 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate to r237520 - swap order of CHECK-NEXT lines.
James Molloy [Sat, 16 May 2015 13:26:25 +0000 (13:26 +0000)]
Update to r237520 - swap order of CHECK-NEXT lines.

... I'd copied the check-next lines from a previous test so they were
slightly wrong, and had managed to test the wrong source tree. D'oh!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237521 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReapply r237453 with a fix for the test timeouts.
James Molloy [Sat, 16 May 2015 13:10:45 +0000 (13:10 +0000)]
Reapply r237453 with a fix for the test timeouts.

The test timeouts were due to instcombine fighting itself. Regression test added.
Original log message:

Canonicalize min/max expressions correctly.

This patch introduces a canonical form for min/max idioms where one operand
is extended or truncated. This often happens when the other operand is a
constant. For example:

  %1 = icmp slt i32 %a, i32 0
    %2 = sext i32 %a to i64
      %3 = select i1 %1, i64 %2, i64 0

Would now be canonicalized into:

  %1 = icmp slt i32 %a, i32 0
    %2 = select i1 %1, i32 %a, i32 0
      %3 = sext i32 %2 to i64

This builds upon a patch posted by David Majenemer
(https://www.marc.info/?l=llvm-commits&m=143008038714141&w=2). That pass
passively stopped instcombine from ruining canonical patterns. This
patch additionally actively makes instcombine canonicalize too.

Canonicalization of expressions involving a change in type from int->fp
or fp->int are not yet implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237520 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Distinguish the 'o', 'v', 'X', and 'i' inline assembly memory constraints.
Daniel Sanders [Sat, 16 May 2015 12:09:54 +0000 (12:09 +0000)]
[x86] Distinguish the 'o', 'v', 'X', and 'i' inline assembly memory constraints.

Summary:
But still handle them the same way since I don't know how they differ on
this target.

Of these, 'o' and 'v' are not tested but were already implemented.

I'm not sure why 'i' is required for X86 since it's supposed to be an
immediate constraint rather than a memory constraint. A test asserts
without it so I've included it for now.

No functional change intended.

Reviewers: nadav

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237517 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImprove check on git-svnrevert, better error message
Renato Golin [Sat, 16 May 2015 10:23:48 +0000 (10:23 +0000)]
Improve check on git-svnrevert, better error message

When the commit is not in the tree at all, find-rev returns 0
and prints an empty string. We need to catch that problem too,
when trying to revert.

Adding a list of possible problems, so that you can easily and
quickly correct without having to edit the script again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237516 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[TableGen] Change 'car' to 'head' and 'cdr' to 'tail' in assert comments. These were...
Craig Topper [Sat, 16 May 2015 05:42:13 +0000 (05:42 +0000)]
[TableGen] Change 'car' to 'head' and 'cdr' to 'tail' in assert comments. These were the old names for these operations long ago. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237514 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[TableGen] Remove !! that I can't really explain why I wrote. Also remove some unnece...
Craig Topper [Sat, 16 May 2015 05:42:11 +0000 (05:42 +0000)]
[TableGen] Remove !! that I can't really explain why I wrote. Also remove some unnecessary curly braces from the same area.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237513 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCorrect indentation. NFC
Craig Topper [Sat, 16 May 2015 05:42:08 +0000 (05:42 +0000)]
Correct indentation. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237512 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[TableGen] Restructure a loop to make it exit early instead of skipping a portion...
Craig Topper [Sat, 16 May 2015 05:42:03 +0000 (05:42 +0000)]
[TableGen] Restructure a loop to make it exit early instead of skipping a portion of the body based on what will also be the terminating condition. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237511 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMachineSink: Collect registers before clearing their killflags.
Matthias Braun [Sat, 16 May 2015 03:11:07 +0000 (03:11 +0000)]
MachineSink: Collect registers before clearing their killflags.

Currently whenever we sink any instruction, we do clearKillFlags for
every use of every use operand for that instruction, apparently there
are a lot of duplication, therefore compile time penalties.

This patch collect all the interested registers first, do clearKillFlags
for it all together at once at the end, so we only need to do
clearKillFlags once for one register, duplication is avoided.

Patch by Lawrence Hu!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237510 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MemCpyOpt] Turn memcpy from just-memset'd source into memset.
Ahmed Bougacha [Sat, 16 May 2015 01:32:26 +0000 (01:32 +0000)]
[MemCpyOpt] Turn memcpy from just-memset'd source into memset.

There's no point in copying around constants, so, when all else fails,
we can still transform memcpy of memset into two independent memsets.

To quote the example, we can turn:
  memset(dst1, c, dst1_size);
  memcpy(dst2, dst1, dst2_size);
into:
  memset(dst1, c, dst1_size);
  memset(dst2, c, dst2_size);
When dst2_size <= dst1_size.

Like r235232 for copy constructors, this can occur in move constructors.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237506 91177308-0d34-0410-b5e6-96231b3b80d8