Benjamin Kramer [Wed, 29 Aug 2012 22:57:04 +0000 (22:57 +0000)]
Add some __builtin_expect magic to StringMap.
Tombstones and full hash collisions are rare, mark the "empty"
and "no collision" paths as likely. The bug in simplifycfg
that prevented the hints from being picked during selfhost
up was fixed recently :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162874
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 29 Aug 2012 22:57:00 +0000 (22:57 +0000)]
Replace the BUILTIN_EXPECT macro with a less horrible LLVM_LIKELY/LLVM_UNLIKELY interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162873
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Wed, 29 Aug 2012 22:18:56 +0000 (22:18 +0000)]
Allow targets to specify a minimum supported NOP size when performing NOP padding. If the desired padding is smaller than the supported NOP size,
we will enlarge the padding to make it work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162870
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 22:02:00 +0000 (22:02 +0000)]
Set the isTied flags when building INLINEASM MachineInstrs.
For normal instructions, isTied() is set automatically by addOperand(),
based on MCInstrDesc, but inline asm has tied operands outside the
descriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162869
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 21:46:38 +0000 (21:46 +0000)]
Preserve branch profile metadata during switch formation.
Patch by Michael Ilseman!
This fixes SimplifyCFGOpt::FoldValueComparisonIntoPredecessors to preserve metata when folding conditional branches into switches.
void foo(int x) {
if (x == 0)
bar(1);
else if (__builtin_expect(x == 10, 1))
bar(2);
else if (x == 20)
bar(3);
}
CFG:
B0
| \
| X0
B10
| \
| X10
B20
| \
E X20
Merge B0-B10:
w(B0-X0) = w(B0-X0)*sum-weights(B10) = w(B0-X0) * (w(B10-X10) + w(B10-B20))
w(B0-X10) = w(B0-B10) * w(B10-X10)
w(B0-B20) = w(B0-B10) * w(B10-B20)
B0 __
| \ \
| X10 X0
B20
| \
E X20
Merge B0-B20:
w(B0-X0) = w(B0-X0) * sum-weights(B20) = w(B0-X0) * (w(B20-E) + w(B20-X20))
w(B0-X10) = w(B0-X10) * sum-weights(B20) = ...
w(B0-X20) = w(B0-B20) * w(B20-X20)
w(B0-E) = w(B0-B20) * w(B20-E)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162868
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 21:46:36 +0000 (21:46 +0000)]
whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162867
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 21:19:21 +0000 (21:19 +0000)]
Rename hasVolatileMemoryRef() to hasOrderedMemoryRef().
Ordered memory operations are more constrained than volatile loads and
stores because they must be ordered with respect to all other memory
operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162861
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 21:08:52 +0000 (21:08 +0000)]
Add MachineMemOperand::isUnordered().
This means the same as LoadInst/StoreInst::isUnordered(), and implies
!isVolatile().
Atomic loads and stored are also ordered, and this is the right method
to check if it is safe to reorder memory operations. Ordered atomics
can't be reordered wrt normal loads and stores, which is a stronger
constraint than volatile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162859
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 20:48:45 +0000 (20:48 +0000)]
Don't move normal loads across volatile/atomic loads.
It is technically allowed to move a normal load across a volatile load,
but probably not a good idea.
It is not allowed to move a load across an atomic load with
Ordering > Monotonic, and we model those with MOVolatile as well.
I recently removed the mayStore flag from atomic load instructions, so
they don't need a pseudo-opcode. This patch makes up for the difference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162857
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Wed, 29 Aug 2012 20:32:13 +0000 (20:32 +0000)]
fix C++ comment in C header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162856
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Wed, 29 Aug 2012 20:30:44 +0000 (20:30 +0000)]
Use the full path to output the .gcda file.
This lets the user run the program from a different directory and still have the
.gcda files show up in the correct place.
<rdar://problem/
12179524>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162855
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Wed, 29 Aug 2012 20:22:24 +0000 (20:22 +0000)]
Reserve space for the mandatory traceback fields on PPC64.
We need to reserve space for the mandatory traceback fields,
though leaving them as zero is appropriate for now.
Although the ABI calls for these fields to be filled in fully, no
compiler on Linux currently does this, and GDB does not read these
fields. GDB uses the first word of zeroes during exception handling to
find the end of the function and the size field, allowing it to compute
the beginning of the function. DWARF information is used for everything
else. We need the extra 8 bytes of pad so the size field is found in
the right place.
As a comparison, GCC fills in a few of the fields -- language, number
of saved registers -- but ignores the rest. IBM's proprietary OSes do
make use of the full traceback table facility.
Patch by Bill Schmidt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162854
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Wed, 29 Aug 2012 18:45:41 +0000 (18:45 +0000)]
Use ArrayRef instead of SmallVector when passing vector into function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162851
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 18:11:05 +0000 (18:11 +0000)]
Verify the consistency of inline asm operands.
The operands on an INLINEASM machine instruction are divided into groups
headed by immediate flag operands. Verify this structure.
Extract verifyTiedOperands(), and only call it for non-inlineasm
instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162849
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Wed, 29 Aug 2012 17:59:32 +0000 (17:59 +0000)]
Clean this up slightly, doesn't really fall through.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162848
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Wed, 29 Aug 2012 16:36:07 +0000 (16:36 +0000)]
Refactor setExecutionDomain to be clearer about what it's doing and more robust.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162844
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 29 Aug 2012 16:17:01 +0000 (16:17 +0000)]
Make helper function static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162843
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Wed, 29 Aug 2012 15:32:21 +0000 (15:32 +0000)]
Make MemoryBuiltins aware of TargetLibraryInfo.
This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
is specified. This has been a problem for a long time but became more severe
with the recent memory builtin improvements.
Since the memory builtin functions are used everywhere, this required passing
TLI in many places. This means that functions that now have an optional TLI
argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
mallocs anymore if the TLI argument is missing. I've updated most passes to do
the right thing.
Fixes PR13694 and probably others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Wed, 29 Aug 2012 07:18:25 +0000 (07:18 +0000)]
Convert FMA4 patterns to use target specific nodes instead of intrinsics to align with FMA3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162829
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Wed, 29 Aug 2012 06:28:46 +0000 (06:28 +0000)]
Make use of the LLVM_DELETED_FUNCTION macro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162828
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Wed, 29 Aug 2012 05:48:09 +0000 (05:48 +0000)]
Add virtual keywords for methods that override the base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162826
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 04:41:37 +0000 (04:41 +0000)]
Cleanup sloppy code. Jakob's review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162825
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 03:52:57 +0000 (03:52 +0000)]
Fix a nondeterminism in the ARM assembler.
Adding arbitrary records to ARM.td would break
basic-arm-instructions.s because selection of nop vs mov r0,r0 was
ambiguous (this will be tested by a subsequent addition to ARM.td).
An imperfect but sensible fix is to give precedence to match rules
that have more constraints.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162824
91177308-0d34-0410-b5e6-
96231b3b80d8
Jush Lu [Wed, 29 Aug 2012 02:41:21 +0000 (02:41 +0000)]
[arm-fast-isel] Add support for ARM PIC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162823
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 01:58:55 +0000 (01:58 +0000)]
Fix ARM vector copies of overlapping register tuples.
I have tested the fix, but have not been successfull in generating
a robust unit test. This can only be exposed through particular
register assignments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162821
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Wed, 29 Aug 2012 01:58:52 +0000 (01:58 +0000)]
cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162820
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 29 Aug 2012 01:37:57 +0000 (01:37 +0000)]
Create llvm/test/Object/Mips/lit.local.cfg to check Mips in targets_to_build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162819
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 00:38:03 +0000 (00:38 +0000)]
Verify the tied operand flags.
WHen running with -verify-machineinstrs, check that tied operands come
in matching use/def pairs, and that they are consistent with MCInstrDesc
when it applies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162816
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Wed, 29 Aug 2012 00:38:02 +0000 (00:38 +0000)]
Enable recursing into the compiler-rt projcet with the CMake build.
This only fires if using a recent enough CMake -- compiler-rt uses a few
of the more advanced features that not everyone needs.
Please let me know if anyone sees issues with this. I'll be updating
documentation and other stuff to tell people about this.
Many thanks to Alexey for doing a ton of work to get ASan's CMake build
into a really fantastic shape. =]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162815
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Wed, 29 Aug 2012 00:37:58 +0000 (00:37 +0000)]
Maintain a vaild isTied bit as operands are added and removed.
The isTied bit is set automatically when a tied use is added and
MCInstrDesc indicates a tied operand. The tie is broken when one of the
tied operands is removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162814
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 29 Aug 2012 00:37:56 +0000 (00:37 +0000)]
llvm/test: [CMake] Add profile_rt-shared to deps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162813
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 29 Aug 2012 00:37:51 +0000 (00:37 +0000)]
libprofile: [CMake] Let libprofile_rt be not loadable_module but shared library. Autoconf's one does so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162812
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 29 Aug 2012 00:37:46 +0000 (00:37 +0000)]
llvm/test/Analysis/Profiling: Mark 3 of them as REQUIRES: loadable_module.
FIXME: profile_rt.dll could be built on win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162811
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Wed, 29 Aug 2012 00:10:48 +0000 (00:10 +0000)]
Moved input for objdump test from Mips to Inputs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162808
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 28 Aug 2012 23:57:47 +0000 (23:57 +0000)]
Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162807
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Tue, 28 Aug 2012 23:42:17 +0000 (23:42 +0000)]
Add comments on the literal value used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162805
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Grosbach [Tue, 28 Aug 2012 23:22:30 +0000 (23:22 +0000)]
LLI: move instruction cache tweaks.
Invalidate the instruction cache right before we start actually executing code, otherwise
we can miss some that came later. This is still not quite right for a truly lazilly
compiled environment, but it's closer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162803
91177308-0d34-0410-b5e6-
96231b3b80d8
Manman Ren [Tue, 28 Aug 2012 22:21:25 +0000 (22:21 +0000)]
Profile: set branch weight metadata with data generated from profiling.
This patch implements ProfileDataLoader which loads profile data generated by
-insert-edge-profiling and updates branch weight metadata accordingly.
Patch by Alastair Murray.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162799
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Tue, 28 Aug 2012 20:07:41 +0000 (20:07 +0000)]
The instruction DEXT may be transformed into DEXTU or DEXTM depending
on the size of the extraction and its position in the 64 bit word.
This patch allows support of the dext transformations with mips64 direct
object output.
0 <= msb < 32 0 <= lsb < 32 0 <= pos < 32 1 <= size <= 32
DINS
The field is entirely contained in the right-most word of the doubleword
32 <= msb < 64 0 <= lsb < 32 0 <= pos < 32 2 <= size <= 64
DINSM
The field straddles the words of the doubleword
32 <= msb < 64 32 <= lsb < 64 32 <= pos < 64 1 <= size <= 32
DINSU
The field is entirely contained in the left-most word of the doubleword
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162782
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Tue, 28 Aug 2012 19:24:49 +0000 (19:24 +0000)]
Some of the instructions in the Mips instruction set are revision
delimited. llvm-mc -disassemble access these through the -mattr
option.
llvm-objdump -disassemble had no such way to set the attribute so
some instructions were just not recognized for disassembly.
This patch accepts llvm-mc mechanism for specifying the attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162781
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Tue, 28 Aug 2012 19:20:29 +0000 (19:20 +0000)]
Explicitly update the number of nodes to be traversed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162780
91177308-0d34-0410-b5e6-
96231b3b80d8
Jack Carter [Tue, 28 Aug 2012 19:07:39 +0000 (19:07 +0000)]
Some instructions are passed to the assembler to be
transformed to the final instruction variant. An
example would be dsrll which is transformed into
dsll32 if the shift value is greater than 32.
For direct object output we need to do this transformation
in the codegen. If the instruction was inside branch
delay slot, it was being missed. This patch corrects this
oversight.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162779
91177308-0d34-0410-b5e6-
96231b3b80d8
Roman Divacky [Tue, 28 Aug 2012 19:06:55 +0000 (19:06 +0000)]
Emit word of zeroes after the last instruction as a start of the mandatory
traceback table on PowerPC64. This helps gdb handle exceptions. The other
mandatory fields are ignored by gdb and harder to implement so just add
there a FIXME.
Patch by Bill Schmidt. PR13641.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162778
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Tue, 28 Aug 2012 18:58:57 +0000 (18:58 +0000)]
Follow-up patch to r162731.
Fix a couple of bugs in mips' long branch pass.
This patch was supposed to be committed along with r162731, so I don't have a
new test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162777
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 18:34:41 +0000 (18:34 +0000)]
Add a MachineOperand::isTied() flag.
While in SSA form, a MachineInstr can have pairs of tied defs and uses.
The tied operands are used to represent read-modify-write operands that
must be assigned the same physical register.
Previously, tied operand pairs were computed from fixed MCInstrDesc
fields, or by using black magic on inline assembly instructions.
The isTied flag makes it possible to add tied operands to any
instruction while getting rid of (some of) the inlineasm magic.
Tied operands on normal instructions are needed to represent predicated
individual instructions in SSA form. An extra <tied,imp-use> operand is
required to represent the output value when the instruction predicate is
false.
Adding a predicate to:
%vreg0<def> = ADD %vreg1, %vreg2
Will look like:
%vreg0<tied,def> = ADD %vreg1, %vreg2, pred:3, %vreg7<tied,imp-use>
The virtual register %vreg7 is the value given to %vreg0 when the
predicate is false. It will be assigned the same physreg as %vreg0.
This commit adds the isTied flag and sets it based on MCInstrDesc when
building an instruction. The flag is not used for anything yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162774
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 18:05:48 +0000 (18:05 +0000)]
Don't allow TargetFlags on MO_Register MachineOperands.
Register operands are manipulated by a lot of target-independent code,
and it is not always possible to preserve target flags. That means it is
not safe to use target flags on register operands.
None of the targets in the tree are using register operand target flags.
External targets should be using immediate operands to annotate
instructions with operand modifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162770
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 28 Aug 2012 17:18:27 +0000 (17:18 +0000)]
Patch by Sean Silva to un-barf his computer by explicitly removing the '\n'
character instead of always the last character.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162767
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 16:12:39 +0000 (16:12 +0000)]
Add PPC Freescale e500mc and e5500 subtargets.
Add subtargets for Freescale e500mc (32-bit) and e5500 (64-bit) to
the PowerPC backend.
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162764
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 28 Aug 2012 13:59:23 +0000 (13:59 +0000)]
InstCombine: Defensively avoid undefined shifts by limiting the amount to the bit width.
No test case, undefined shifts get folded early, but can occur when other
transforms generate a constant. Thanks to Duncan for bringing this up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162755
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 28 Aug 2012 13:08:13 +0000 (13:08 +0000)]
InstCombine: Guard the transform introduced in r162743 against large ints and non-const shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162751
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Tue, 28 Aug 2012 12:23:22 +0000 (12:23 +0000)]
Make sure that we don't call getZExtValue on values > 64 bits.
Thanks Benjamin for noticing this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162749
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Tue, 28 Aug 2012 10:01:43 +0000 (10:01 +0000)]
Teach InstCombine to canonicalize [SU]div+[AL]shl patterns.
For example:
%1 = lshr i32 %x, 2
%2 = udiv i32 %1, 100
rdar://
12182093
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162743
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 28 Aug 2012 07:36:46 +0000 (07:36 +0000)]
The commutative flag is already correctly set within the multiclass. If we set
it here, then a 'register-memory' version would wrongly get the commutative
flag.
<rdar://problem/
12180135>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162741
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Tue, 28 Aug 2012 07:30:47 +0000 (07:30 +0000)]
Convert V_SETALLONES/AVX_SETALLONES/AVX2_SETALLONES to Post-RA pseudos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162740
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Tue, 28 Aug 2012 07:05:28 +0000 (07:05 +0000)]
Merge AVX_SET0PSY/AVX_SET0PDY/AVX2_SET0 into a single post-RA pseudo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162738
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 28 Aug 2012 04:04:29 +0000 (04:04 +0000)]
llvm/test/CodeGen/X86/pr12312.ll: Add -mtriple=x86_64-unknown-unknown.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162736
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Tue, 28 Aug 2012 03:34:40 +0000 (03:34 +0000)]
Fix PR12312
- Add a target-specific DAG optimization to recognize a pattern PTEST-able.
Such a pattern is a OR'd tree with X86ISD::OR as the root node. When
X86ISD::OR node has only its flag result being used as a boolean value and
all its leaves are extracted from the same vector, it could be folded into an
X86ISD::PTEST node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162735
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 03:26:49 +0000 (03:26 +0000)]
Check all patterns for missing instruction flags.
Both single-instruction and multi-instruction patterns can be checked
for missing mayLoad / mayStore, and hasSideEffects flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162734
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 03:11:32 +0000 (03:11 +0000)]
Remove extra MayLoad/MayStore flags from atomic_load/store.
These extra flags are not required to properly order the atomic
load/store instructions. SelectionDAGBuilder chains atomics as if they
were volatile, and SelectionDAG::getAtomic() sets the isVolatile bit on
the memory operands of all atomic operations.
The volatile bit is enough to order atomic loads and stores during and
after SelectionDAG.
This means we set mayLoad on atomic_load, mayStore on atomic_store, and
mayLoad+mayStore on the remaining atomic read-modify-write operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162733
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 03:11:27 +0000 (03:11 +0000)]
Revert r162713: "Add ATOMIC_LDR* pseudo-instructions to model atomic_load on ARM."
This wasn't the right way to enforce ordering of atomics.
We are already setting the isVolatile bit on memory operands of atomic
operations which is good enough to enforce the correct ordering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162732
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Tue, 28 Aug 2012 03:03:05 +0000 (03:03 +0000)]
Fix mips' long branch pass.
Instructions emitted to compute branch offsets now use immediate operands
instead of symbolic labels. This change was needed because there were problems
when R_MIPS_HI16/LO16 relocations were used to make shared objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162731
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 02:49:14 +0000 (02:49 +0000)]
Split several PPC instruction classes.
Slight reorganisation of PPC instruction classes for scheduling. No
functionality change for existing subtargets.
- Clearly separate load/store-with-update instructions from regular loads and stores.
- Split IntRotateD -> IntRotateD and IntRotateDI
- Split out fsub and fadd from FPGeneral -> FPAddSub
- Update existing itineraries
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162729
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Tue, 28 Aug 2012 02:12:42 +0000 (02:12 +0000)]
Fix bug 13532.
In SelectionDAGLegalize::ExpandLegalINT_TO_FP, expand INT_TO_FP nodes without
using any f64 operations if f64 is not a legal type.
Patch by Stefan Kristiansson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162728
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 02:10:33 +0000 (02:10 +0000)]
Allow remat of LI on PPC.
Allow load-immediates to be rematerialised in the register coalescer for
PPC. This makes test/CodeGen/PowerPC/big-endian-formal-args.ll fail,
because it relies on a register move getting emitted. The immediate load is
equivalent, so change this test case.
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162727
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 02:10:30 +0000 (02:10 +0000)]
Add the Freescale vendor to Triple.
Adds the vendor 'fsl' (used by Freescale SDK) to Triple. This will allow
clang support for Freescale cross-compile configurations.
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162726
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 02:10:27 +0000 (02:10 +0000)]
Eliminate redundant CR moves on PPC32.
The 32-bit ABI requires CR bit 6 to be set if the call has fp arguments and
unset if it doesn't. The solution up to now was to insert a MachineNode to
set/unset the CR bit, which produces a CR vreg. This vreg was then copied
into CR bit 6. When the register allocator saw a bunch of these in the same
function, it allocated the set/unset CR bit in some random CR register (1
extra instruction) and then emitted CR moves before every vararg function
call, rather than just setting and unsetting CR bit 6 directly before every
vararg function call. This patch instead inserts a PPCcrset/PPCcrunset
instruction which are then matched by a dedicated instruction pattern.
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162725
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Tue, 28 Aug 2012 02:10:15 +0000 (02:10 +0000)]
Optimize zext on PPC64.
The zeroextend IR instruction is lowered to an 'and' node with an immediate
mask operand, which in turn gets legalised to a sequence of ori's & ands.
This can be done more efficiently using the rldicl instruction.
Patch by Tobias von Koch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162724
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Tue, 28 Aug 2012 01:17:46 +0000 (01:17 +0000)]
Temporarily revert this to bring back the bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162722
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Tue, 28 Aug 2012 00:02:01 +0000 (00:02 +0000)]
More missing mayLoad flags on AVX multiclasses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162714
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Mon, 27 Aug 2012 23:58:52 +0000 (23:58 +0000)]
Add ATOMIC_LDR* pseudo-instructions to model atomic_load on ARM.
It is not safe to use normal LDR instructions because they may be
reordered by the scheduler. The ATOMIC_LDR pseudos have a mayStore flag
that prevents reordering.
Atomic loads are also prevented from participating in rematerialization
and load folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162713
91177308-0d34-0410-b5e6-
96231b3b80d8
Sebastian Pop [Mon, 27 Aug 2012 23:05:06 +0000 (23:05 +0000)]
Add --program-prefix support to build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162707
91177308-0d34-0410-b5e6-
96231b3b80d8
Marshall Clow [Mon, 27 Aug 2012 22:53:35 +0000 (22:53 +0000)]
Fix compile error when building with C++11 - clang thinks that PRIx64 is a user-defined suffix or something
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162704
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Mon, 27 Aug 2012 22:12:44 +0000 (22:12 +0000)]
Make sure we add the predicate after all of the registers are added.
<rdar://problem/
12183003>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162703
91177308-0d34-0410-b5e6-
96231b3b80d8
Dan Gohman [Mon, 27 Aug 2012 18:31:36 +0000 (18:31 +0000)]
Don't use for loops for code that is only intended to execute once. No
intended functionality change. Thanks to Ahmed Charles for spotting it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162686
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 27 Aug 2012 16:04:24 +0000 (16:04 +0000)]
Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162678
91177308-0d34-0410-b5e6-
96231b3b80d8
Danil Malyshev [Mon, 27 Aug 2012 15:34:01 +0000 (15:34 +0000)]
Fix comment for function RuntimeDyldImpl.resolveRelocation()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162677
91177308-0d34-0410-b5e6-
96231b3b80d8
Hongbin Zheng [Mon, 27 Aug 2012 13:49:24 +0000 (13:49 +0000)]
Remove the the block_node_iterator of Region, replace it by the block_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162672
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Mon, 27 Aug 2012 12:29:01 +0000 (12:29 +0000)]
Support MIPS DSP Rev2 intrinsics.
The patch reviewed by Akira Hatanaka.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162668
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 27 Aug 2012 11:50:26 +0000 (11:50 +0000)]
llvm/test/CodeGen/X86/fma.ll: Add -march=x86, or two tests would fail on non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162667
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 27 Aug 2012 10:10:10 +0000 (10:10 +0000)]
DWARFDebugRangeList.cpp: Use PRIx64 for uint64_t as format string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162665
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 27 Aug 2012 09:37:54 +0000 (09:37 +0000)]
llvm/test/CodeGen/X86/fma_patterns.ll: Add -mtriple=x86_64. It was incompatible on i686 and Windows x64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162664
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 08:08:30 +0000 (08:08 +0000)]
Remove MMX shift intrinsic handling code that also exists in SelectionDAGBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162661
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 07:55:50 +0000 (07:55 +0000)]
Commit test change for r162658.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162660
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Mon, 27 Aug 2012 07:24:43 +0000 (07:24 +0000)]
[DebugInfo] fixup for r162657: update CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162659
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 07:19:59 +0000 (07:19 +0000)]
Don't allow vextractf128 to be folded with unaligned stores. We don't fold unaligned loads so shouldn't fold unaligned stores as it can cause an alignment fault to occur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162658
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Mon, 27 Aug 2012 07:17:47 +0000 (07:17 +0000)]
Add basic support for .debug_ranges section to LLVM's DebugInfo library.
This section (introduced in DWARF-3) is used to define instruction address
ranges for functions that are not contiguous and can't be described
by low_pc/high_pc attributes (this is the usual case for inlined subroutines).
The patch is the first step to support fetching complete inlining info from DWARF.
Reviewed by Benjamin Kramer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162657
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 07:04:50 +0000 (07:04 +0000)]
Fold some patterns into instruction definitons so tablegen can infer flags removing the need for an explicit 'neverHasSideEffects = 1'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162656
91177308-0d34-0410-b5e6-
96231b3b80d8
Anitha Boyapati [Mon, 27 Aug 2012 06:59:01 +0000 (06:59 +0000)]
FMA3 tests on bdver2 target for changes made in rev 162012. Also made
corresponding changes to existing tests for darwin triple to ensure that
same pattern is tested for bdver2 target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162655
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 06:08:57 +0000 (06:08 +0000)]
Add HasAVX1Only predicate and use it for patterns that have an AVX1 instruction and an AVX2 instruction rather than relying on AddedComplexity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162654
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 27 Aug 2012 03:38:15 +0000 (03:38 +0000)]
Make sure that FMA3 is favored even when FMA4 is also enabled. Test case for r162454.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162653
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Mon, 27 Aug 2012 03:03:07 +0000 (03:03 +0000)]
Pass -lLTO after gold-plugin.o so that it gets used in systems that default to
--as-needed.
Patch by Felix Geyer. Fixes pr13262.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162652
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 26 Aug 2012 22:01:42 +0000 (22:01 +0000)]
Mark avx2 maskstore has ReadWriteArgMem. Mark broadcast and maskload as ReadArgMem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162649
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Fri, 24 Aug 2012 23:29:28 +0000 (23:29 +0000)]
Fix integer undefined behavior due to signed left shift overflow in LLVM.
Reviewed offline by chandlerc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162623
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 23:29:07 +0000 (23:29 +0000)]
Add missing mayLoad flags to a large class of AVX *_Int instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162622
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 22:46:55 +0000 (22:46 +0000)]
Missed tLEApcrelJT.
ARMConstantIslandPass expects this instruction to stay in the same basic
block as the jump table branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162615
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 22:46:53 +0000 (22:46 +0000)]
Infer instruction properties from single-instruction patterns.
Previously, instructions without a primary patterns wouldn't get their
properties inferred. Now, we use all single-instruction patterns for
inference, including 'def : Pat<>' instances.
This causes a lot of instruction flags to change.
- Many instructions no longer have the UnmodeledSideEffects flag because
their flags are now inferred from a pattern.
- Instructions with intrinsics will get a mayStore flag if they already
have UnmodeledSideEffects and a mayLoad flag if they already have
mayStore. This is because intrinsics properties are linear.
- Instructions with atomic_load patterns get a mayStore flag because
atomic loads can't be reordered. The correct workaround is to create
pseudo-instructions instead of using normal loads. PR13693.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162614
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 21:44:11 +0000 (21:44 +0000)]
Explicitly mark LEApcrel pseudos with hasSideEffects.
It's not clear that they should be marked as such, but tbb formation
fails if t2LEApcrelJT is hoisted of of a loop.
This doesn't change the flags on these instructions,
UnmodeledSideEffects was already inferred from the missing pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162603
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 21:08:09 +0000 (21:08 +0000)]
Stop inferring isVariadic from instruction patterns.
Instructions are now only marked as variadic if they use variable_ops in
their ins list.
A variadic SDNode is typically used for call nodes that have the call
arguments as operands.
A variadic MachineInstr can actually encode a variable number of
operands, for example ARM's stm/ldm instructions. A call instruction
does not have to be variadic. The call argument registers are added as
implicit operands.
This change remove the MCID::Variadic flags from most call and return
instructions, allowing us to better verify their operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162599
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 20:52:46 +0000 (20:52 +0000)]
Fix call instruction operands in ARMFastISel.
The ARM BL and BLX instructions don't have predicate operands, but the
thumb variants tBL and tBLX do.
The argument registers should be added as implicit uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162593
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 24 Aug 2012 20:52:44 +0000 (20:52 +0000)]
Mark X86::RET and RETI instructions as variadic.
There is special magic happening when returning floating point values on
the x87 stack. The RET instructions get extra f80 operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162592
91177308-0d34-0410-b5e6-
96231b3b80d8