oota-llvm.git
9 years agoDon't own the buffer in object::Binary.
Rafael Espindola [Tue, 19 Aug 2014 18:44:46 +0000 (18:44 +0000)]
Don't own the buffer in object::Binary.

Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries
(like Archive) and we had to create dummy buffers just to handle that. It is
also a bad fit for IRObjectFile where the Module wants to own the buffer too.

Keeping this ownership would make supporting IR inside native objects
particularly painful.

This patch focuses in lib/Object. If something elsewhere used to own an Binary,
now it also owns a MemoryBuffer.

This patch introduces a few new types.

* MemoryBufferRef. This is just a pair of StringRefs for the data and name.
  This is to MemoryBuffer as StringRef is to std::string.
* OwningBinary. A combination of Binary and a MemoryBuffer. This is needed
  for convenience functions that take a filename and return both the
  buffer and the Binary using that buffer.

The C api now uses OwningBinary to avoid any change in semantics. I will start
a new thread to see if we want to change it and how.

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

9 years agoHide two different AlignMode enums in anonymous namespaces. This bug is reported...
Alexey Samsonov [Tue, 19 Aug 2014 18:40:39 +0000 (18:40 +0000)]
Hide two different AlignMode enums in anonymous namespaces. This bug is reported by UBSan.

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

9 years agoRevert "Small refactor on VectorizerHint for deduplication"
Renato Golin [Tue, 19 Aug 2014 18:08:50 +0000 (18:08 +0000)]
Revert "Small refactor on VectorizerHint for deduplication"

This reverts commit r215994 because MSVC 2012 can't cope with its C++11 goodness.

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

9 years ago[FastISel][AArch64] Fix a few BuildMI callsites where the result register was added...
Juergen Ributzka [Tue, 19 Aug 2014 17:41:53 +0000 (17:41 +0000)]
[FastISel][AArch64] Fix a few BuildMI callsites where the result register was added as an operand register.

This fixes a few BuildMI callsites where the result register was added by
using addReg, which is per default a use and therefore an operand register.

Also use the zero register as result register when emitting a compare
instruction (SUBS with unused result register).

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

9 years agoSmall refactor on VectorizerHint for deduplication
Renato Golin [Tue, 19 Aug 2014 17:30:43 +0000 (17:30 +0000)]
Small refactor on VectorizerHint for deduplication

Previously, the hint mechanism relied on clean up passes to remove redundant
metadata, which still showed up if running opt at low levels of optimization.
That also has shown that multiple nodes of the same type, but with different
values could still coexist, even if temporary, and cause confusion if the
next pass got the wrong value.

This patch makes sure that, if metadata already exists in a loop, the hint
mechanism will never append a new node, but always replace the existing one.
It also enhances the algorithm to cope with more metadata types in the future
by just adding a new type, not a lot of code.

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

9 years agoDocs: add documentation for the coverage mapping format.
Alex Lorenz [Tue, 19 Aug 2014 17:05:58 +0000 (17:05 +0000)]
Docs: add documentation for the coverage mapping format.

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

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

9 years agoModernize the .ll parsing interface.
Rafael Espindola [Tue, 19 Aug 2014 16:58:54 +0000 (16:58 +0000)]
Modernize the .ll parsing interface.

* Use StringRef instead of std::string&
* Return a std::unique_ptr<Module> instead of taking an optional module to write
  to (was not really used).
* Use current comment style.
* Use current naming convention.

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

9 years agoCodingStandards: Document std::equal misbehaviour
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 16:49:40 +0000 (16:49 +0000)]
CodingStandards: Document std::equal misbehaviour

I should have included this as part of r215986, which worked around this
corner by changing ArrayRef::equals() not to use std::equal.  Alas.

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

9 years agoReapply r215966, r215965, r215964, r215963, r215960, r215959, r215958, and r215957
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 16:39:58 +0000 (16:39 +0000)]
Reapply r215966, r215965, r215964, r215963, r215960, r215959, r215958, and r215957

This reverts commit r215981, which reverted the above commits because
MSVC std::equal asserts on nullptr iterators, and thes commits
introduced an `ArrayRef::equals()` on empty ArrayRefs.

ArrayRef was changed not to use std::equal in r215986.

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

9 years agoADT: Avoid using std::equal in ArrayRef::equals
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 16:36:21 +0000 (16:36 +0000)]
ADT: Avoid using std::equal in ArrayRef::equals

MSVC's STL has a bug in `std::equal()`: it asserts on nullptr iterators,
causing a block revert in r215981.  This works around that by re-writing
`ArrayRef::equals()` to do the work itself.

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

9 years agoReverting r215966, r215965, r215964, r215963, r215960, r215959, r215958, and r215957...
Aaron Ballman [Tue, 19 Aug 2014 14:59:02 +0000 (14:59 +0000)]
Reverting r215966, r215965, r215964, r215963, r215960, r215959, r215958, and r215957 (these commits all rely on previous commits) due to build breakage. These commits cause failed assertions when testing Clang using MSVC 2013. The asserts are triggered from the std::equal call within ArrayRef::equals due to being passed invalid input (ArrayRef.begin() is returning a nullptr which is problematic).

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

9 years ago[mips] Add assembler support for .set arch=x directive.
Toma Tabacu [Tue, 19 Aug 2014 14:22:52 +0000 (14:22 +0000)]
[mips] Add assembler support for .set arch=x directive.

Summary:
This directive is similar to ".set mipsX".
It is used to change the CPU target of the assembler, enabling it to accept instructions for a specific CPU.

This patch only implements the r4000 CPU (which is treated internally as generic mips3) and the generic ISAs.

Contains work done by Matheus Almeida.

Reviewers: dsanders

Reviewed By: dsanders

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

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

9 years agoInstCombine: ((A & ~B) ^ (~A & B)) to A ^ B
Mayur Pandey [Tue, 19 Aug 2014 08:19:19 +0000 (08:19 +0000)]
InstCombine:  ((A & ~B) ^ (~A & B)) to A ^ B

Proof using CVC3 follows:
$ cat t.cvc
A, B : BITVECTOR(32);
QUERY BVXOR((A & ~B),(~A & B)) = BVXOR(A,B);
$ cvc3 t.cvc
Valid.

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

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

9 years agoConst-correct and prevent a copy of a SmallPtrSet.
Craig Topper [Tue, 19 Aug 2014 07:44:27 +0000 (07:44 +0000)]
Const-correct and prevent a copy of a SmallPtrSet.

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

9 years agoPrevent use of the implicit copy constructor on SmallPtrSetImpl. An accidental copy...
Craig Topper [Tue, 19 Aug 2014 06:57:14 +0000 (06:57 +0000)]
Prevent use of the implicit copy constructor on SmallPtrSetImpl. An accidental copy caused my SmallPtrSet->SmallPtrSetImpl conversion commit to fail the other day.

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

9 years agotest commit (spelling correction)
Mayur Pandey [Tue, 19 Aug 2014 06:41:55 +0000 (06:41 +0000)]
test commit (spelling correction)

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

9 years agoMake it explicit that ExecutionEngine takes ownership of the modules.
Rafael Espindola [Tue, 19 Aug 2014 04:04:25 +0000 (04:04 +0000)]
Make it explicit that ExecutionEngine takes ownership of the modules.

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

9 years agoIR: Reduce RAUW traffic in ConstantVector
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 02:24:46 +0000 (02:24 +0000)]
IR: Reduce RAUW traffic in ConstantVector

Avoid creating a new `ConstantVector` on an RAUW of one of its members.
This reduces RAUW traffic on any containing constant.

This is part of PR20515.

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

9 years agoIR: Fix ConstantArray::replaceUsesOfWithOnConstant()
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 02:21:00 +0000 (02:21 +0000)]
IR: Fix ConstantArray::replaceUsesOfWithOnConstant()

Previously, `ConstantArray::replaceUsesOfWithOnConstant()` neglected to
check whether it becomes a `ConstantDataArray`.  Call
`ConstantArray::getImpl()` to check for that.

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

9 years agoIR: Factor out replaceUsesOfWithOnConstantImpl(), NFC
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 02:16:51 +0000 (02:16 +0000)]
IR: Factor out replaceUsesOfWithOnConstantImpl(), NFC

Factor out common code, and take advantage of the new function to
add early returns to the callers.

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

9 years agoIR: Split up Constant{Array,Vector}::get(), NFC
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 02:11:30 +0000 (02:11 +0000)]
IR: Split up Constant{Array,Vector}::get(), NFC

Introduce `getImpl()` that tries the simplification logic from `get()`
and then gives up.  This allows the logic to be reused elsewhere in a
follow-up commit.

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

9 years ago[X86, X87 stackifier] Do not mark an operand of a debug instruction as kill.
Akira Hatanaka [Tue, 19 Aug 2014 02:09:57 +0000 (02:09 +0000)]
[X86, X87 stackifier] Do not mark an operand of a debug instruction as kill.

<rdar://problem/16952634>

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

9 years agoIR: Reduce RAUW traffic in ConstantExpr
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 01:12:53 +0000 (01:12 +0000)]
IR: Reduce RAUW traffic in ConstantExpr

Avoid RAUW-ing `ConstantExpr` when an operand changes unless the new
`ConstantExpr` already has users.  This prevents the RAUW from rippling
up the expression tree unnecessarily.

This commit indirectly adds test coverage for r215953 (this is how I
came across the bug).

This is part of PR20515.

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

9 years agoIR: Replace uses of ConstantAggrUniqueMap with ConstantUniqueMap
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 01:02:18 +0000 (01:02 +0000)]
IR: Replace uses of ConstantAggrUniqueMap with ConstantUniqueMap

Now that `ConstantAggrUniqueMap` and `ConstantUniqueMap` work the same
way, change the aggregates to use the new one.

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

9 years agoRemove extraneous typenames from r215957
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:55:34 +0000 (00:55 +0000)]
Remove extraneous typenames from r215957

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

9 years agoIR: Rewrite ConstantUniqueMap
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:42:32 +0000 (00:42 +0000)]
IR: Rewrite ConstantUniqueMap

Rewrite `ConstantUniqueMap` to be more similar to
`ConstantAggrUniqueMap`.

  - Use a `DenseMap` with custom MapInfo instead of a `std::map` with
    linear lookups and deletion.
  - Don't waste memory explicitly storing (heavyweight) keys.

Only `ConstantExpr` and `InlineAsm` actually use this data structure, so
I also updated them to use it.

This code cleanup is a precursor to reducing RAUW traffic on
`ConstantExpr` -- I felt badly adding a new (linear) call to
`ConstantUniqueMap::FindExistingKey`, so this designs away the concern.

A follow-up commit will transition the users of `ConstantAggrUniqueMap`
over.

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

9 years agoIR: Declare LookupKey right before its use, NFC
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:24:26 +0000 (00:24 +0000)]
IR: Declare LookupKey right before its use, NFC

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

9 years agoIR: ArrayRef-ize {Insert,Extract}ValueConstantExpr constructors
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:23:17 +0000 (00:23 +0000)]
IR: ArrayRef-ize {Insert,Extract}ValueConstantExpr constructors

No functionality change.

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

9 years agoPrevent clang-format from moving the namespace closing brace, NFC
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:21:04 +0000 (00:21 +0000)]
Prevent clang-format from moving the namespace closing brace, NFC

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

9 years agoNVPTX: Use RAUW instead of reinventing the wheel
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:20:02 +0000 (00:20 +0000)]
NVPTX: Use RAUW instead of reinventing the wheel

This code had a homemade RAUW that was incorrect when a user was a
constant: instead of calling `replaceUsersWithOnConstant()` it would
incorrectly update the operand in-place, invalidating
`LLVMContextImpl::ExprConstants`.  RAUW does the job better.

The ValueHandle that `GVMap` is holding onto needs to be removed first,
so this commit also removes each variable from the map on-the-fly.

Since deletions from `ExprConstants` use a linear search that compares
directly on the pointer value (instead of using the key), there isn't an
obvious way to expose this with a testcase.

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

9 years agoLLParser: Handle BlockAddresses on-the-fly
Duncan P. N. Exon Smith [Tue, 19 Aug 2014 00:13:19 +0000 (00:13 +0000)]
LLParser: Handle BlockAddresses on-the-fly

Previously all `blockaddress()` constants were treated as forward
references.  They were resolved twice:  once at the end of the function
in question, and again at the end of the module.  Furthermore, if the
same blockaddress was referenced N times, the parser created N distinct
`GlobalVariable`s (one for each reference).

Instead, resolve all block addresses at the beginning of the function,
creating the standard `BasicBlock` forward references used for all other
basic block references.  After the function, all references can be
resolved immediately.  To check for the condition of parsing block
addresses from within the same function, I created a reference to the
current per-function-state in `BlockAddressPFS`.

Also, create only one forward-reference per basic block.  Because
forward references to block addresses are rare, the data structure here
shouldn't matter.  If somehow it does someday, this can be pretty easily
changed to a `DenseMap<std::pair<ValID, ValID>, GV>`.

This is part of PR20515.

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

9 years agoverify-uselistorder: Call verifyModule() and improve output
Duncan P. N. Exon Smith [Mon, 18 Aug 2014 23:44:14 +0000 (23:44 +0000)]
verify-uselistorder: Call verifyModule() and improve output

Call `verifyModule()` after parsing and after every transformation.
Also convert some `DEBUG(dbgs())` to `errs()` to increase visibility
into what's going on.

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

9 years agoUse a range loop. NFC.
Rafael Espindola [Mon, 18 Aug 2014 23:15:59 +0000 (23:15 +0000)]
Use a range loop. NFC.

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

9 years agoThese classes only need a StringRef, not a MemoryBuffer.
Rafael Espindola [Mon, 18 Aug 2014 22:28:28 +0000 (22:28 +0000)]
These classes only need a StringRef, not a MemoryBuffer.

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

9 years agoDelete unused method.
Rafael Espindola [Mon, 18 Aug 2014 22:20:18 +0000 (22:20 +0000)]
Delete unused method.

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

9 years agoAnswer to Philip Reames comments
Robin Morisset [Mon, 18 Aug 2014 22:18:14 +0000 (22:18 +0000)]
Answer to Philip Reames comments

- add check for volatile (probably unneeded, but I agree that we should be conservative about it).
- strengthen condition from isUnordered() to isSimple(), as I don't understand well enough Unordered semantics (and it also matches the comment better this way) to be confident in the previous behaviour (thanks for catching that one, I had missed the case Monotonic/Unordered).
- separate a condition in two.
- lengthen comment about aliasing and loads
- add tests in GVN/atomic.ll

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

9 years agoWeak relaxing of the constraints on atomics in MemoryDependencyAnalysis
Robin Morisset [Mon, 18 Aug 2014 22:18:11 +0000 (22:18 +0000)]
Weak relaxing of the constraints on atomics in MemoryDependencyAnalysis

Monotonic accesses do not have to kill the analysis, as long as the QueryInstr is not
itself atomic.

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

9 years ago[MCJIT] Respect target endianness in RuntimeDyldMachO and RuntimeDyldChecker.
Lang Hames [Mon, 18 Aug 2014 21:43:16 +0000 (21:43 +0000)]
[MCJIT] Respect target endianness in RuntimeDyldMachO and RuntimeDyldChecker.

This patch may address some of the issues described in http://llvm.org/PR20640.

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

9 years agoMake llvm-objdump handle both arm and thumb disassembly from the same Mach-O
Kevin Enderby [Mon, 18 Aug 2014 20:21:02 +0000 (20:21 +0000)]
Make llvm-objdump handle both arm and thumb disassembly from the same Mach-O
file with -macho, the Mach-O specific object file parser option.

After some discussion I chose to do this implementation contained in the logic
of llvm-objdump’s MachODump.cpp using a second disassembler for thumb when
needed and with updates mostly contained in the MachOObjectFile class.

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

9 years ago[X86][Haswell][SchedModel] Tidy up.
Quentin Colombet [Mon, 18 Aug 2014 17:56:01 +0000 (17:56 +0000)]
[X86][Haswell][SchedModel] Tidy up.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:59 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Other instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:56 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Logic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:53 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Math instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:51 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Arithmetic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:49 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Conversion instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:46 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point XMM and YMM instructions.
Sub-group: Move instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:43 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer MMX and XMM instructions.
Sub-group: Other instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:41 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer MMX and XMM instructions.
Sub-group: Logic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:39 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer MMX and XMM instructions.
Sub-group: Arithmetic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:36 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer MMX and XMM instructions.
Sub-group: Move instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:32 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point x87 instructions.
Sub-group: Math instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:29 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point x87 instructions.
Sub-group: Arithmetic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:26 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Floating Point x87 instructions.
Sub-group: Move instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:23 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Other instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:21 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Synchronization instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:19 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: String instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:16 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Control transfer instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:13 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Logic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:11 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Arithmetic instructions.

<rdar://problem/15607571>

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

9 years ago[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Quentin Colombet [Mon, 18 Aug 2014 17:55:08 +0000 (17:55 +0000)]
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
Group: Integer instructions.
Sub-group: Move instructions.

<rdar://problem/15607571>

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

9 years agoMake use of isAtLeastRelease/Acquire in the ARM/AArch64 backends
Robin Morisset [Mon, 18 Aug 2014 16:48:58 +0000 (16:48 +0000)]
Make use of isAtLeastRelease/Acquire in the ARM/AArch64 backends

Summary:
Make use of isAtLeastRelease/Acquire in the ARM/AArch64 backends
These helper functions are introduced in D4844.
Depends D4844

Test Plan: make check-all passes

Reviewers: jfb

Subscribers: aemerson, llvm-commits, mcrosier, reames

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

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

9 years agoDisabling an MSVC warning ('var' : definition from the for loop is ignored; the defin...
Aaron Ballman [Mon, 18 Aug 2014 14:54:22 +0000 (14:54 +0000)]
Disabling an MSVC warning ('var' : definition from the for loop is ignored; the definition from the enclosing scope is used) which will trigger false positives more than true positives.

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

9 years agoTeach the AArch64 backend to handle f16
Oliver Stannard [Mon, 18 Aug 2014 14:22:39 +0000 (14:22 +0000)]
Teach the AArch64 backend to handle f16

This allows the AArch64 backend to handle fadd, fsub, fmul and fdiv
operations on f16 (half-precision) types by promoting to f32.

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

9 years ago[ARM,AArch64] Do not tail-call to an externally-defined function with weak linkage
Oliver Stannard [Mon, 18 Aug 2014 12:42:15 +0000 (12:42 +0000)]
[ARM,AArch64] Do not tail-call to an externally-defined function with weak linkage

Externally-defined functions with weak linkage should not be
tail-called on ARM or AArch64, as the AAELF spec requires normal calls
to undefined weak functions to be replaced with a NOP or jump to the
next instruction. The behaviour of branch instructions in this
situation (as used for tail calls) is implementation-defined, so we
cannot rely on the linker replacing the tail call with a return.

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

9 years agoAVX-512: Fixed a bug in emitting compare for MVT:i1 type.
Elena Demikhovsky [Mon, 18 Aug 2014 11:59:06 +0000 (11:59 +0000)]
AVX-512: Fixed a bug in emitting compare for MVT:i1 type.
Added a test.

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

9 years agoSilencing an MSVC warning about loop variable conflicting with a variable from an...
Aaron Ballman [Mon, 18 Aug 2014 11:51:41 +0000 (11:51 +0000)]
Silencing an MSVC warning about loop variable conflicting with a variable from an outer scope. NFC.

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

9 years agoTableGen: allow use of uint64_t for available features mask.
Tim Northover [Mon, 18 Aug 2014 11:49:42 +0000 (11:49 +0000)]
TableGen: allow use of uint64_t for available features mask.

ARM in particular is getting dangerously close to exceeding 32 bits worth of
possible subtarget features. When this happens, various parts of MC start to
fail inexplicably as masks get truncated to "unsigned".

Mostly just refactoring at present, and there's probably no way to test.

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

9 years agoAdded forgotten noexcept.
Abramo Bagnara [Mon, 18 Aug 2014 07:48:18 +0000 (07:48 +0000)]
Added forgotten noexcept.

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

9 years agoRevert "Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needin...
Craig Topper [Mon, 18 Aug 2014 00:24:38 +0000 (00:24 +0000)]
Revert "Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size."

Getting a weird buildbot failure that I need to investigate.

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

9 years agoRepace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to...
Craig Topper [Sun, 17 Aug 2014 23:47:00 +0000 (23:47 +0000)]
Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.

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

9 years agoUse copy initialization to initialize std::unique_ptr.
Rafael Espindola [Sun, 17 Aug 2014 23:38:08 +0000 (23:38 +0000)]
Use copy initialization to initialize std::unique_ptr.

Thanks to David Blaikie for the suggestion.

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

9 years agoARM: mark missing functions from RTABI
Saleem Abdulrasool [Sun, 17 Aug 2014 22:51:04 +0000 (22:51 +0000)]
ARM: mark missing functions from RTABI

Simply indicate the functions that are part of the runtime library that we do
not setup libcalls for.  This is merely for ease of identification.  NFC.

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

9 years agoARM: improve RTABI 4.2 conformance on Linux
Saleem Abdulrasool [Sun, 17 Aug 2014 22:51:02 +0000 (22:51 +0000)]
ARM: improve RTABI 4.2 conformance on Linux

The set of functions defined in the RTABI was separated for no real reason.
This brings us closer to proper utilisation of the functions defined by the
RTABI.  It also sets the ground for correctly emitting function calls to AEABI
functions on all AEABI conforming platforms.

The previously existing lie on the behaviour of __ldivmod and __uldivmod is
propagated as it is beyond the scope of the change.

The changes to the test are due to the fact that we now use the divmod functions
which return both the quotient and remainder and thus we no longer need to
invoke two functions on Linux (making it closer to EABI's behaviour).

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

9 years agoARM: whitespace
Saleem Abdulrasool [Sun, 17 Aug 2014 22:50:59 +0000 (22:50 +0000)]
ARM: whitespace

Whitespace fix, NFC.

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

9 years agoRemove unused member variable.
Rafael Espindola [Sun, 17 Aug 2014 22:48:55 +0000 (22:48 +0000)]
Remove unused member variable.

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

9 years agoReturn a std::uinque_ptr. Every caller was already using one.
Rafael Espindola [Sun, 17 Aug 2014 22:37:39 +0000 (22:37 +0000)]
Return a std::uinque_ptr. Every caller was already using one.

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

9 years agoConvert an ownership comment with std::uinque_ptr.
Rafael Espindola [Sun, 17 Aug 2014 22:20:33 +0000 (22:20 +0000)]
Convert an ownership comment with std::uinque_ptr.

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

9 years agoPass a std::uinque_ptr to ParseAssembly to make the ownership explicit. NFC.
Rafael Espindola [Sun, 17 Aug 2014 21:36:47 +0000 (21:36 +0000)]
Pass a std::uinque_ptr to ParseAssembly to make the ownership explicit. NFC.

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

9 years agogetLazyIRModule always takes ownership. Make that explicit.
Rafael Espindola [Sun, 17 Aug 2014 21:22:19 +0000 (21:22 +0000)]
getLazyIRModule always takes ownership. Make that explicit.

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

9 years agoReturn a std::unique_ptr to make the ownership explicit.
Rafael Espindola [Sun, 17 Aug 2014 21:11:31 +0000 (21:11 +0000)]
Return a std::unique_ptr to make the ownership explicit.

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

9 years agoDon't repeat the function name in comments. NFC.
Rafael Espindola [Sun, 17 Aug 2014 21:05:08 +0000 (21:05 +0000)]
Don't repeat the function name in comments. NFC.

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

9 years agoDon't repeat names in comments. NFC.
Rafael Espindola [Sun, 17 Aug 2014 20:57:50 +0000 (20:57 +0000)]
Don't repeat names in comments. NFC.

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

9 years agoRevert: r215698 - Current implementation of c.cond.fmt instructions only accept defau...
Daniel Sanders [Sun, 17 Aug 2014 19:47:47 +0000 (19:47 +0000)]
Revert: r215698 - Current implementation of c.cond.fmt instructions only accept default cc0 register...

It causes a number of regressions when -fintegrated-as is enabled. This happens
because there are codegen-only instructions that incorrectly uses the first
operand as the encoding for the $fcc register. The regressions do not occur when
-via-file-asm is also given.

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

9 years agoARM: correct toggling behaviour
Saleem Abdulrasool [Sun, 17 Aug 2014 19:20:38 +0000 (19:20 +0000)]
ARM: correct toggling behaviour

This was a thinko.  The intent was to flip the explicit bits that need toggling
rather than all bits.  This would result in incorrect behaviour (which now is
tested).

Thanks to Nico Weber for pointing this out!

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

9 years agollvm-objdump: don't print relocations in non-relocatable files.
Rafael Espindola [Sun, 17 Aug 2014 19:09:37 +0000 (19:09 +0000)]
llvm-objdump: don't print relocations in non-relocatable files.

This matches the behavior of GNU objdump.

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

9 years agoRemove a redundant "public:". NFC.
Rafael Espindola [Sun, 17 Aug 2014 18:33:17 +0000 (18:33 +0000)]
Remove a redundant "public:". NFC.

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

9 years agoBumpPtrAllocator: remove 'no slabs allocated yet' check
Hans Wennborg [Sun, 17 Aug 2014 18:31:18 +0000 (18:31 +0000)]
BumpPtrAllocator: remove 'no slabs allocated yet' check

We already handle the no-slabs case when checking whether the current slab
is large enough: if no slabs have been allocated, CurPtr and End are both 0.
alignPtr(0), will still be 0, and so "if (Ptr + Size <= End)" fails.

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

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

9 years agoAdd a non-templated ELFObjectFileBase class.
Rafael Espindola [Sun, 17 Aug 2014 17:52:10 +0000 (17:52 +0000)]
Add a non-templated ELFObjectFileBase class.

Use it to implement some ELF only virtual interfaces instead of using error
prone series of dyn_casts.

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

9 years agoFix an off-by-one bug in the target independent llvm-objdump.
Rafael Espindola [Sun, 17 Aug 2014 16:31:39 +0000 (16:31 +0000)]
Fix an off-by-one bug in the target independent llvm-objdump.

It would prevent the display of a single byte instruction before a label.

Patch by Steve King!

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

9 years agoReverted last commit
Elena Demikhovsky [Sun, 17 Aug 2014 09:39:48 +0000 (09:39 +0000)]
Reverted last commit

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

9 years agoReverted last commit
Elena Demikhovsky [Sun, 17 Aug 2014 09:36:07 +0000 (09:36 +0000)]
Reverted last commit

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

9 years agoAdded a table for intrinsics on X86.
Elena Demikhovsky [Sun, 17 Aug 2014 09:00:20 +0000 (09:00 +0000)]
Added a table for intrinsics on X86.
It should remove dosens of lines in handling instrinsics (in a huge switch) and give an easy way to add new intrinsics.
I did not completed to move al intrnsics to the table, I'll do this in the upcomming commits.

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

9 years agoRemove an InstCombine that transformed patterns like (x * uitofp i1 y) to (select...
Owen Anderson [Sun, 17 Aug 2014 03:51:29 +0000 (03:51 +0000)]
Remove an InstCombine that transformed patterns like (x * uitofp i1 y) to (select y, x, 0.0) when the multiply has fast math flags set.
While this might seem like an obvious canonicalization, there is one subtle problem with it.  The result of the original expression
is undef when x is NaN (remember, fast math flags), but the result of the select is always defined when x is NaN.  This means that the
new expression is strictly more defined than the original one.  One unfortunate consequence of this is that the transform is not reversible!
It's always legal to make increase the defined-ness of an expression, but it's not legal to reduce it.  Thus, targets that prefer the original
form of the expression cannot reverse the transform to recover it.  Another way to think of it is that the transform has lost source-level
information (the fast math flags), which is undesirable.

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

9 years ago[x86] Fix an indentation goof in a prior commit. Should have re-run
Chandler Carruth [Sun, 17 Aug 2014 00:40:34 +0000 (00:40 +0000)]
[x86] Fix an indentation goof in a prior commit. Should have re-run
clang-format.

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

9 years ago[shuffle] Teach the shufflevector fuzzer to support fixed element types.
Chandler Carruth [Sun, 17 Aug 2014 00:40:31 +0000 (00:40 +0000)]
[shuffle] Teach the shufflevector fuzzer to support fixed element types.

I'm using this to try to find more minimal test cases by re-fuzzing
within a specific domain once errors are found.

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

9 years agollvm/test/CodeGen/X86/fmul-combines.ll: Appease Windows x64. <4 x float> is passed...
NAKAMURA Takumi [Sat, 16 Aug 2014 22:28:37 +0000 (22:28 +0000)]
llvm/test/CodeGen/X86/fmul-combines.ll: Appease Windows x64. <4 x float> is passed by stack.

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

9 years agoFix fmul combines with constant splat vectors
Matt Arsenault [Sat, 16 Aug 2014 10:14:19 +0000 (10:14 +0000)]
Fix fmul combines with constant splat vectors

Fixes things like fmul x, 2 -> fadd x, x

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

9 years ago[x86] Teach lots of the new vector shuffle lowering to use UNPCK
Chandler Carruth [Sat, 16 Aug 2014 09:42:15 +0000 (09:42 +0000)]
[x86] Teach lots of the new vector shuffle lowering to use UNPCK
instructions for blend operations at 128 bits. This was a serious hole
in our prior blend lowering.

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

9 years agoInstCombine: Fix a potential bug in 0 - (X sdiv C) -> (X sdiv -C)
David Majnemer [Sat, 16 Aug 2014 09:23:42 +0000 (09:23 +0000)]
InstCombine: Fix a potential bug in 0 - (X sdiv C)  -> (X sdiv -C)

While *most* (X sdiv 1) operations will get caught by InstSimplify, it
is still possible for a sdiv to appear in the worklist which hasn't been
simplified yet.

This means that it is possible for 0 - (X sdiv 1) to get transformed
into (X sdiv -1); dividing by -1 can make the transform produce undef
values instead of the proper result.

Sorry for the lack of testcase, it's a bit problematic because it relies
on the exact order of operations in the worklist.

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

9 years agoInstCombine: Combine mul with div.
David Majnemer [Sat, 16 Aug 2014 08:55:06 +0000 (08:55 +0000)]
InstCombine: Combine mul with div.

We can combne a mul with a div if one of the operands is a multiple of
the other:

%mul = mul nsw nuw %a, C1
%ret = udiv %mul, C2
  =>
%ret = mul nsw %a, (C1 / C2)

This can expose further optimization opportunities if we end up
multiplying or dividing by a power of 2.

Consider this small example:

define i32 @f(i32 %a) {
  %mul = mul nuw i32 %a, 14
  %div = udiv exact i32 %mul, 7
  ret i32 %div
}

which gets CodeGen'd to:

    imull       $14, %edi, %eax
    imulq       $613566757, %rax, %rcx
    shrq        $32, %rcx
    subl        %ecx, %eax
    shrl        %eax
    addl        %ecx, %eax
    shrl        $2, %eax
    retq

We can now transform this into:
define i32 @f(i32 %a) {
  %shl = shl nuw i32 %a, 1
  ret i32 %shl
}

which gets CodeGen'd to:

    leal        (%rdi,%rdi), %eax
    retq

This fixes PR20681.

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