oota-llvm.git
12 years agoFix typos
Joel Jones [Thu, 31 May 2012 17:11:25 +0000 (17:11 +0000)]
Fix typos

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

12 years agoFix typos noticed by Benjamin Kramer.
Rafael Espindola [Thu, 31 May 2012 16:04:26 +0000 (16:04 +0000)]
Fix typos noticed by Benjamin Kramer.
Also make the checks stronger and test that we reject ranges that overlap
a previous wrapped range.

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

12 years agoX86: Rename the CLMUL target feature to PCLMUL.
Benjamin Kramer [Thu, 31 May 2012 14:34:17 +0000 (14:34 +0000)]
X86: Rename the CLMUL target feature to PCLMUL.

It was renamed in gcc/gas a while ago and causes all kinds of
confusion because it was named differently in llvm and clang.

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

12 years agoRequire intervals in the range metadata to be in a canonical form: They must
Rafael Espindola [Thu, 31 May 2012 13:45:46 +0000 (13:45 +0000)]
Require intervals in the range metadata to be in a canonical form: They must
be non contiguous, non overlapping and sorted by the lower end.

While this is technically a backward incompatibility, every frontent currently
produces range metadata with a single interval and we don't have any pass
that merges intervals yet, so no existing bitcode files should be rejected by
this.

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

12 years agoAdded FMA3 Intel instructions.
Elena Demikhovsky [Thu, 31 May 2012 09:20:20 +0000 (09:20 +0000)]
Added FMA3 Intel instructions.
I disabled FMA3 autodetection, since the result may differ from expected for some benchmarks.
I added tests for GodeGen and intrinsics.
I did not change llvm.fma.f32/64 - it may be done later.

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

12 years agoEnhance the sinking code to handle diamond patterns. Patch by
Duncan Sands [Thu, 31 May 2012 08:09:49 +0000 (08:09 +0000)]
Enhance the sinking code to handle diamond patterns.  Patch by
Carlo Alberto Ferraris.

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

12 years agoAdd intrinsic for pclmulqdq instruction.
Craig Topper [Thu, 31 May 2012 04:37:40 +0000 (04:37 +0000)]
Add intrinsic for pclmulqdq instruction.

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

12 years agoCleanup and factoring of mips16 tablegen classes. Make register classes
Akira Hatanaka [Thu, 31 May 2012 02:59:44 +0000 (02:59 +0000)]
Cleanup and factoring of mips16 tablegen classes. Make register classes
CPU16RegsRegClass and CPURARegRegClass available. Add definition of mips16
jalr instruction.

Patch by Reed Kotler.

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

12 years agoFix typo in assembly directive. Noticed by inspection.
Eric Christopher [Thu, 31 May 2012 00:53:18 +0000 (00:53 +0000)]
Fix typo in assembly directive. Noticed by inspection.

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

12 years agoAdd lit.local.cfg to run the tests in test/MC/Disassembler/Mips.
Akira Hatanaka [Thu, 31 May 2012 00:49:56 +0000 (00:49 +0000)]
Add lit.local.cfg to run the tests in test/MC/Disassembler/Mips.

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

12 years agoAvoid depending on list orders and register numbering.
Jakob Stoklund Olesen [Wed, 30 May 2012 23:00:43 +0000 (23:00 +0000)]
Avoid depending on list orders and register numbering.

This code is covered by test/CodeGen/ARM/arm-modifier.ll.

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

12 years agoExtract some pointer hacking to a function.
Jakob Stoklund Olesen [Wed, 30 May 2012 22:40:03 +0000 (22:40 +0000)]
Extract some pointer hacking to a function.

Switch to MCSuperRegIterator while we're there.

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

12 years agoPrioritize smaller register classes for urgent evictions.
Jakob Stoklund Olesen [Wed, 30 May 2012 21:46:58 +0000 (21:46 +0000)]
Prioritize smaller register classes for urgent evictions.

It helps compile exotic inline asm. In the test case, normal GR32
virtual registers use up eax-edx so the final GR32_ABCD live range has
no registers left. Since all the live ranges were tiny, we had no way of
prioritizing the smaller register class.

This patch allows tiny unspillable live ranges to be evicted by tiny
unspillable live ranges from a smaller register class.

<rdar://problem/11542429>

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

12 years agoPrint uint16_t numbers without a sign.
Jakob Stoklund Olesen [Wed, 30 May 2012 19:20:19 +0000 (19:20 +0000)]
Print uint16_t numbers without a sign.

It seems I broke C++11.

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

12 years agoAdd support for the mips inline asm 'm' output modifier.
Eric Christopher [Wed, 30 May 2012 19:05:19 +0000 (19:05 +0000)]
Add support for the mips inline asm 'm' output modifier.

Patch by Jack Carter.

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

12 years agoSwitch the canonical FMA term operand order to match both the comment I wrote and...
Owen Anderson [Wed, 30 May 2012 18:54:50 +0000 (18:54 +0000)]
Switch the canonical FMA term operand order to match both the comment I wrote and the usual LLVM convention.

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

12 years agoTeach DAGCombine to canonicalize the position of a constant in the term operands...
Owen Anderson [Wed, 30 May 2012 18:50:39 +0000 (18:50 +0000)]
Teach DAGCombine to canonicalize the position of a constant in the term operands of an FMA node.

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

12 years agoRemove extra space.
Chad Rosier [Wed, 30 May 2012 18:47:55 +0000 (18:47 +0000)]
Remove extra space.

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

12 years agoReinstate -O3 for LTO.
David Blaikie [Wed, 30 May 2012 18:42:51 +0000 (18:42 +0000)]
Reinstate -O3 for LTO.

This broke in r144788 when the CodeGenOpt option was moved from everywhere else
(specifically, from addPassesToEmitFile) to createTargetMachine. Since
LTOCodeGenerator wasn't passing the 4th argument, when the 4th parameter became
the 3rd, it silently continued to compile (int->bool conversion) but meant
something completely different.

This change preserves the existing (accidental) and previous (default)
semantics of the addPassesToEmitFile and restores the previous/intended
CodeGenOpt argument by passing it appropriately to createTargetMachine.

(discovered by pending changes to -Wconversion to catch constant->bool
conversions)

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

12 years agoMake sure that we're dealing with a binary SCEVExpr when simplifying.
Benjamin Kramer [Wed, 30 May 2012 18:42:43 +0000 (18:42 +0000)]
Make sure that we're dealing with a binary SCEVExpr when simplifying.

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

12 years agoFix some uses of getSubRegisters() to use getSubReg() instead.
Jakob Stoklund Olesen [Wed, 30 May 2012 18:40:49 +0000 (18:40 +0000)]
Fix some uses of getSubRegisters() to use getSubReg() instead.

It is better to address sub-registers directly by name instead of
relying on their position in the sub-register list.

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

12 years agoRemove some redundant tests.
Jakob Stoklund Olesen [Wed, 30 May 2012 18:38:56 +0000 (18:38 +0000)]
Remove some redundant tests.

An empty list is not represented as a null pointer. Let TRI do its own
shortcuts.

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

12 years agoTeach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.
Benjamin Kramer [Wed, 30 May 2012 18:32:23 +0000 (18:32 +0000)]
Teach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.

This also required making recursive simplifications until
nothing changes or a hard limit (currently 3) is hit.

With the simplification in place indvars can canonicalize
loops of the form
for (unsigned i = 0; i < a-b; ++i)
into
for (unsigned i = 0; i != a-b; ++i)
which used to fail because SCEV created a weird umax expr
for the backedge taken count.

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

12 years agoit's pointed out that R11 can be used for magic things, and doing things just for...
Chris Lattner [Wed, 30 May 2012 18:08:02 +0000 (18:08 +0000)]
it's pointed out that R11 can be used for magic things, and doing things just for 64-bit registers is silly.  Just optimize 3 more.

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

12 years agoExtend the (abi-irrelevant) return convention to be able to return more than two...
Chris Lattner [Wed, 30 May 2012 17:50:14 +0000 (17:50 +0000)]
Extend the (abi-irrelevant) return convention to be able to return more than two values in
integer registers.  This is already supported by the fastcc convention, but it doesn't
hurt to support it in the standard conventions as well.

In cases where we can cheat at the calling convention, this allows us to avoid returning
things through memory in more cases.

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

12 years ago[arm-fast-isel] Add support for the llvm.frameaddress() intrinsic.
Chad Rosier [Wed, 30 May 2012 17:23:22 +0000 (17:23 +0000)]
[arm-fast-isel] Add support for the llvm.frameaddress() intrinsic.
Patch by Jush Lu <jush.msn@gmail.com>.

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

12 years agoAdd MCRegisterInfo::RegListIterator.
Jakob Stoklund Olesen [Wed, 30 May 2012 16:36:28 +0000 (16:36 +0000)]
Add MCRegisterInfo::RegListIterator.

Also add subclasses MCSubRegIterator, MCSuperRegIterator, and
MCRegAliasIterator.

These iterators provide an abstract interface to the MCRegisterInfo
register lists so the internal representation can be changed without
changing all clients.

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

12 years agoMark insertq/extrq intrinsic readnone.
Benjamin Kramer [Wed, 30 May 2012 13:44:25 +0000 (13:44 +0000)]
Mark insertq/extrq intrinsic readnone.

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

12 years agoPort support for SSE4a extrq/insertq to the old jit code emitter.
Benjamin Kramer [Wed, 30 May 2012 09:13:55 +0000 (09:13 +0000)]
Port support for SSE4a extrq/insertq to the old jit code emitter.

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

12 years agoRemove little semicolon that caused a lot of warnings.
Benjamin Kramer [Wed, 30 May 2012 09:13:49 +0000 (09:13 +0000)]
Remove little semicolon that caused a lot of warnings.

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

12 years ago[asan] instrument cmpxchg and atomicrmw
Kostya Serebryany [Wed, 30 May 2012 09:04:06 +0000 (09:04 +0000)]
[asan] instrument cmpxchg and atomicrmw

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

12 years agoSCEV: Handle a corner case reducing AddRecExpr * AddRecExpr
Andrew Trick [Wed, 30 May 2012 03:35:20 +0000 (03:35 +0000)]
SCEV: Handle a corner case reducing AddRecExpr * AddRecExpr

If integer overflow causes one of the terms to reach zero, that can
force the entire expression to zero.

Fixes PR12929: cast<Ty>() argument of incompatible type

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

12 years agoReformat the loop that does AddRecExpr * AddRecExpr reduction.
Andrew Trick [Wed, 30 May 2012 03:35:17 +0000 (03:35 +0000)]
Reformat the loop that does AddRecExpr * AddRecExpr reduction.

No functionality.

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

12 years agoTeach taildup to update livein set. rdar://11538365
Evan Cheng [Wed, 30 May 2012 00:42:39 +0000 (00:42 +0000)]
Teach taildup to update livein set. rdar://11538365

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

12 years agoIf-converter models predicated defs as read + write. The read should be marked as...
Evan Cheng [Wed, 30 May 2012 00:42:02 +0000 (00:42 +0000)]
If-converter models predicated defs as read + write. The read should be marked as 'undef' since it may not already be live. This appeases -verify-machineinstrs.

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

12 years agotypo fix
Chris Lattner [Wed, 30 May 2012 00:40:23 +0000 (00:40 +0000)]
typo fix

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

12 years agoAdd an insertPass API to TargetPassConfig. <rdar://problem/11498613>
Bob Wilson [Wed, 30 May 2012 00:17:12 +0000 (00:17 +0000)]
Add an insertPass API to TargetPassConfig.  <rdar://problem/11498613>

Besides adding the new insertPass function, this patch uses it to
enhance the existing -print-machineinstrs so that the MachineInstrs
after a specific pass can be printed.

Patch by Bin Zeng!

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

12 years agoMake DiffListIterator public to unbreak the gcc buildbots.
Jakob Stoklund Olesen [Wed, 30 May 2012 00:05:03 +0000 (00:05 +0000)]
Make DiffListIterator public to unbreak the gcc buildbots.

Apparently, a friend can't derive from a private class according to gcc.

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

12 years agoUse MCRegUnitIterator to compute regsOverlap().
Jakob Stoklund Olesen [Tue, 29 May 2012 23:40:02 +0000 (23:40 +0000)]
Use MCRegUnitIterator to compute regsOverlap().

The register unit lists are typically much shorter than the register
overlap lists, and the backing table for register units has better cache
locality because it is smaller.

This makes llc about 0.5% faster. The regsOverlap() function isn't that hot.

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

12 years agoEmit register unit lists for each register.
Jakob Stoklund Olesen [Tue, 29 May 2012 23:40:00 +0000 (23:40 +0000)]
Emit register unit lists for each register.

Register units are already used internally in TableGen to compute
register pressure sets and overlapping registers. This patch makes them
available to the code generators.

The register unit lists are differentially encoded so they can be reused
for many related registers. This keeps the total size of the lists below
200 bytes for most targets. ARM has the largest table at 560 bytes.

Add an MCRegUnitIterator for traversing the register unit lists. It
provides an abstract interface so the representation can be changed in
the future without changing all clients.

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

12 years agobounds checking:
Nuno Lopes [Tue, 29 May 2012 22:32:51 +0000 (22:32 +0000)]
bounds checking:
 - hoist checks out of loops where SCEV is smart enough
 - add additional statistics to measure how much we loose for not supporting interprocedural and pointers loaded from memory

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

12 years agoDenseMap's move assignment operator needs to return *this
Douglas Gregor [Tue, 29 May 2012 20:33:09 +0000 (20:33 +0000)]
DenseMap's move assignment operator needs to return *this

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

12 years agoOptional def can be either a def or a use (of reg0).
Evan Cheng [Tue, 29 May 2012 19:40:44 +0000 (19:40 +0000)]
Optional def can be either a def or a use (of reg0).

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

12 years agoAdd intrinsics, code gen, assembler and disassembler support for the SSE4a extrq...
Benjamin Kramer [Tue, 29 May 2012 19:05:25 +0000 (19:05 +0000)]
Add intrinsics, code gen, assembler and disassembler support for the SSE4a extrq and insertq instructions.

This required light surgery on the assembler and disassembler
because the instructions use an uncommon encoding. They are
the only two instructions in x86 that use register operands
and two immediates.

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

12 years agoClear the entering, exiting and internal ranges of a bundle before collecting
Lang Hames [Tue, 29 May 2012 18:19:54 +0000 (18:19 +0000)]
Clear the entering, exiting and internal ranges of a bundle before collecting
ranges for the instruction about to be bundled. This fixes a bug in an external
project where an assertion was triggered due to spurious 'multiple defs' within
the bundle.

Patch by Ivan Llopard. Thanks Ivan!

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

12 years agoUpdate CPPBackend to new API for AttrListPtr::get.
Nicolas Geoffray [Tue, 29 May 2012 15:07:18 +0000 (15:07 +0000)]
Update CPPBackend to new API for AttrListPtr::get.

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

12 years agoConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
Stepan Dyatkovskiy [Tue, 29 May 2012 12:26:47 +0000 (12:26 +0000)]
ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.

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

12 years agoAdd llvm.fabs intrinsic.
Peter Collingbourne [Mon, 28 May 2012 21:48:37 +0000 (21:48 +0000)]
Add llvm.fabs intrinsic.

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

12 years agoFix suspicous hasOneUse() check, found by PVS Studio (PR12357).
Benjamin Kramer [Mon, 28 May 2012 20:52:48 +0000 (20:52 +0000)]
Fix suspicous hasOneUse() check, found by PVS Studio (PR12357).

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

12 years agoInstCombine: Fix infinite loop when encountering switch on trivial icmp.
Benjamin Kramer [Mon, 28 May 2012 19:18:16 +0000 (19:18 +0000)]
InstCombine: Fix infinite loop when encountering switch on trivial icmp.

The test case feeds the following into InstCombine's visitSelect:
%tobool8 = icmp ne i32 0, 0
%phitmp = select i1 %tobool8, i32 3, i32 0
Then instcombine replaces the right side of the switch with 0, doesn't notice
that nothing changes and tries again indefinitely.

This fixes PR12897.

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

12 years agoRemove unused variable.
David Blaikie [Mon, 28 May 2012 18:23:36 +0000 (18:23 +0000)]
Remove unused variable.

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

12 years agoPR12696: Attribute bits above 1<<30 are not encoded in bitcode
Meador Inge [Mon, 28 May 2012 15:45:43 +0000 (15:45 +0000)]
PR12696: Attribute bits above 1<<30 are not encoded in bitcode

Attribute bits above 1<<30 are now encoded correctly.  Additionally,
the encoding/decoding functionality has been hoisted to helper functions
in Attributes.h in an effort to help the encoding/decoding to stay in
sync with the Attribute bitcode definitions.

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

12 years agoRandom BitcodeReader cleanups.
Benjamin Kramer [Mon, 28 May 2012 14:10:31 +0000 (14:10 +0000)]
Random BitcodeReader cleanups.

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

12 years agoPR1255: Case Ranges
Stepan Dyatkovskiy [Mon, 28 May 2012 12:39:09 +0000 (12:39 +0000)]
PR1255: Case Ranges
Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now?
1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst.
2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case.
3. IntItem can be easyly easily replaced with APInt.
4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes.

Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code
ConstantInt *V = ...;
if (V->getValue().ugt(AnotherV->getValue()) {
  ...
}
will look awful. Much more better this way:
IntItem V = ConstantIntVal->getValue();
if (AnotherV < V) {
}

Of course any reviews are welcome.

P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks).
Since in future these classes will founded on APInt, it will possible to use them in more generic ways.

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

12 years agoSwitchInst: Due to bad readability case iterators definition was moved to the end...
Stepan Dyatkovskiy [Mon, 28 May 2012 10:11:27 +0000 (10:11 +0000)]
SwitchInst: Due to bad readability case iterators definition was moved to the end of SwitchInst.

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

12 years agoImplement the indirect counter increment code in a better way. Instead of
Bill Wendling [Mon, 28 May 2012 06:10:56 +0000 (06:10 +0000)]
Implement the indirect counter increment code in a better way. Instead of
replicating the code for every place it's needed, we instead generate a function
that does that for us. This function is local to the executable, so there
shouldn't be any writing violations.

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

12 years agoswitch AttrListPtr::get to take an ArrayRef, simplifying a lot of clients.
Chris Lattner [Mon, 28 May 2012 01:47:44 +0000 (01:47 +0000)]
switch AttrListPtr::get to take an ArrayRef, simplifying a lot of clients.

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

12 years agosimplify code.
Chris Lattner [Mon, 28 May 2012 01:37:08 +0000 (01:37 +0000)]
simplify code.

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

12 years agoadd some helper methods to make the type more uniform.
Chris Lattner [Mon, 28 May 2012 01:29:59 +0000 (01:29 +0000)]
add some helper methods to make the type more uniform.

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

12 years agordar://11542750 - llvm.trap should be marked no return.
Chris Lattner [Sun, 27 May 2012 23:20:41 +0000 (23:20 +0000)]
rdar://11542750 - llvm.trap should be marked no return.

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

12 years agoDenseMap: Use an early exit when there is nothing to do in DestroyAll().
Benjamin Kramer [Sun, 27 May 2012 22:53:10 +0000 (22:53 +0000)]
DenseMap: Use an early exit when there is nothing to do in DestroyAll().

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

12 years agoPR12967: Don't crash when trying to fold a shift that's larger than the type's size.
Benjamin Kramer [Sun, 27 May 2012 22:03:32 +0000 (22:03 +0000)]
PR12967: Don't crash when trying to fold a shift that's larger than the type's size.

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

12 years agoIntrusiveRefCntPtr: Use the same pattern as the other operator= overloads when using...
Benjamin Kramer [Sun, 27 May 2012 20:46:04 +0000 (20:46 +0000)]
IntrusiveRefCntPtr: Use the same pattern as the other operator= overloads when using rvalue refs.

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

12 years agoReimplement the intrinsic verifier to use the same table as Intrinsic::getDefinition,
Chris Lattner [Sun, 27 May 2012 19:37:05 +0000 (19:37 +0000)]
Reimplement the intrinsic verifier to use the same table as Intrinsic::getDefinition,
making it stronger and more sane.

Delete the code from tblgen that produced the old code.

Besides being a path forward in intrinsic sanity, this also eliminates a bunch of
machine generated code that was compiled into Function.o

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

12 years agoThese tests used intrinsics with the wrong prototype. They weren't caught because
Chris Lattner [Sun, 27 May 2012 19:35:41 +0000 (19:35 +0000)]
These tests used intrinsics with the wrong prototype.  They weren't caught because
the old verifier just checked that something "was a pointer", but not that the pointee
was correct.

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

12 years agoremove two (useless) tests that use incorrect intrinsic prototypes, detected by the...
Chris Lattner [Sun, 27 May 2012 19:31:00 +0000 (19:31 +0000)]
remove two (useless) tests that use incorrect intrinsic prototypes, detected by the new intrinsic verifier.

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

12 years agogeneralize this to allow any argument.
Chris Lattner [Sun, 27 May 2012 19:17:16 +0000 (19:17 +0000)]
generalize this to allow any argument.

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

12 years agoHave getOrCreateSubprogramDIE store the DIE for a subprogram
Peter Collingbourne [Sun, 27 May 2012 18:36:44 +0000 (18:36 +0000)]
Have getOrCreateSubprogramDIE store the DIE for a subprogram
definition in the map before calling itself to retrieve the
DIE for the declaration.  Without this change, if this causes
getOrCreateSubprogramDIE to be recursively called on the definition,
it will create multiple DIEs for that definition.  Fixes PR12831.

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

12 years agomove some code around so that Verifier.cpp can get access to the intrinsic info table.
Chris Lattner [Sun, 27 May 2012 18:28:35 +0000 (18:28 +0000)]
move some code around so that Verifier.cpp can get access to the intrinsic info table.

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

12 years agoDenseMap: Provide a move ctor and move semantics for operator[] and FindAndConstruct.
Benjamin Kramer [Sun, 27 May 2012 17:38:30 +0000 (17:38 +0000)]
DenseMap: Provide a move ctor and move semantics for operator[] and FindAndConstruct.

The only missing part is insert(), which uses a pair of parameters and I haven't
figured out how to convert it to rvalue references. It's now possible to use a
DenseMap with std::unique_ptr values :)

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

12 years agoDenseMap: Factor destruction into a common helper method.
Benjamin Kramer [Sun, 27 May 2012 17:38:18 +0000 (17:38 +0000)]
DenseMap: Factor destruction into a common helper method.

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

12 years agoenhance the intrinsic info table to encode what *kind* of Any argument
Chris Lattner [Sun, 27 May 2012 16:39:08 +0000 (16:39 +0000)]
enhance the intrinsic info table to encode what *kind* of Any argument
it is (at the cost of 45 bytes of extra table space) so that the verifier can
start using it.

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

12 years agoMove-enable IntrusiveRefCntPtr.
Benjamin Kramer [Sun, 27 May 2012 16:22:08 +0000 (16:22 +0000)]
Move-enable IntrusiveRefCntPtr.

These tend to be copied around a lot, moving it instead saves a ton of memory
accesses.

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

12 years agoPath::GetTemporaryDirectory(): Add an assertion if TempDirectory is alive, to check...
NAKAMURA Takumi [Sun, 27 May 2012 13:02:04 +0000 (13:02 +0000)]
Path::GetTemporaryDirectory(): Add an assertion if TempDirectory is alive, to check when someone would remove the tempdir.

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

12 years agoMissed parens.
Benjamin Kramer [Sun, 27 May 2012 10:56:55 +0000 (10:56 +0000)]
Missed parens.

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

12 years agor157525 didn't work, just disable iterator checking.
Benjamin Kramer [Sun, 27 May 2012 10:24:52 +0000 (10:24 +0000)]
r157525 didn't work, just disable iterator checking.

This is obviosly right but I don't see how to do this with proper vector
iterators without building a horrible mess of workarounds.

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

12 years agoSDAGBuilder: Avoid iterator invalidation harder.
Benjamin Kramer [Sun, 27 May 2012 09:44:52 +0000 (09:44 +0000)]
SDAGBuilder: Avoid iterator invalidation harder.

vector.begin()-1 is invalid too.

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

12 years agorearrange some code, no functionality change.
Chris Lattner [Sat, 26 May 2012 23:03:52 +0000 (23:03 +0000)]
rearrange some code, no functionality change.

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

12 years agoSDAGBuilder: Don't create an invalid iterator when there is only one switch case.
Benjamin Kramer [Sat, 26 May 2012 21:19:12 +0000 (21:19 +0000)]
SDAGBuilder: Don't create an invalid iterator when there is only one switch case.

Found by libstdc++'s debug mode.

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

12 years agoSelectionDAGBuilder: When emitting small compare chains for switches order them by...
Benjamin Kramer [Sat, 26 May 2012 20:01:32 +0000 (20:01 +0000)]
SelectionDAGBuilder: When emitting small compare chains for switches order them by using edge weights.

SimplifyCFG tends to form a lot of 2-3 case switches when merging branches. Move
the most likely condition to the front so it is checked first and the others can
be skipped. This is currently not as effective as it could be because SimplifyCFG
destroys profiling metadata when merging branches and switches. Merging branch
weight metadata is tricky though.

This code touches at most 3 cases so I didn't use a proper sorting algorithm.

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

12 years agoSince commit 157467, if reassociate isn't actually going to change an expression
Duncan Sands [Sat, 26 May 2012 16:42:52 +0000 (16:42 +0000)]
Since commit 157467, if reassociate isn't actually going to change an expression
then it doesn't alter the instructions composing it, however it would continue
to move the instructions to just before the expression root.  Ensure it doesn't
move them either, so now it really does nothing if there is nothing to do.  That
commit also ensured that nsw etc flags weren't cleared if the expression was not
being changed.  Tweak this a bit so that it doesn't clear flags on the initial
part of a computation either if that part didn't change but later bits did.

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

12 years agoSimplifyCFG: Turn the ad-hoc std::pair that represents switch cases into an explicit...
Benjamin Kramer [Sat, 26 May 2012 14:29:37 +0000 (14:29 +0000)]
SimplifyCFG: Turn the ad-hoc std::pair that represents switch cases into an explicit struct.

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

12 years agoAdd support for branch weight metadata to MDBuilder and use it in various places.
Benjamin Kramer [Sat, 26 May 2012 13:59:43 +0000 (13:59 +0000)]
Add support for branch weight metadata to MDBuilder and use it in various places.

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

12 years agoScoreboardHazardRecognizer: Remove dead conditional in debug code.
Benjamin Kramer [Sat, 26 May 2012 11:37:37 +0000 (11:37 +0000)]
ScoreboardHazardRecognizer: Remove dead conditional in debug code.

Negative cycles are filtered out earlier.

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

12 years agoMove this debug statement earlier so it is easy to see the order in
Duncan Sands [Sat, 26 May 2012 07:47:48 +0000 (07:47 +0000)]
Move this debug statement earlier so it is easy to see the order in
which operands come flying out of the linearization stage.

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

12 years agoThe llvm_gcda_increment_indirect_counter function writes to the arguments that
Bill Wendling [Fri, 25 May 2012 23:55:00 +0000 (23:55 +0000)]
The llvm_gcda_increment_indirect_counter function writes to the arguments that
are passed in. However, those arguments may be in a write-protected area, as far
as the runtime library is concerned. For instance, the data could be placed into
a 'linkedit' section, which isn't writable. Emit the code from
llvm_gcda_increment_indirect_counter directly into the function instead.

Note: The code for this is ugly, and can lead to bloat. We should look into
simplifying this code instead of having all of these branches.

<rdar://problem/11181370>

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

12 years agoFix predicate HasStandardEncoding in MipsInstrInfo.td per suggestion of
Akira Hatanaka [Fri, 25 May 2012 22:15:15 +0000 (22:15 +0000)]
Fix predicate HasStandardEncoding in MipsInstrInfo.td per suggestion of
Benjamin Kramer.

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

12 years agoSmall code cleanup. No functionality change.
Bill Wendling [Fri, 25 May 2012 21:57:59 +0000 (21:57 +0000)]
Small code cleanup. No functionality change.

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

12 years agoOpen in read/write mode, creating the file if it doesn't exist.
Bill Wendling [Fri, 25 May 2012 21:55:06 +0000 (21:55 +0000)]
Open in read/write mode, creating the file if it doesn't exist.

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

12 years agobounds checking: add support for byval arguments
Nuno Lopes [Fri, 25 May 2012 21:15:17 +0000 (21:15 +0000)]
bounds checking: add support for byval arguments

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

12 years agoDelete MipsExpandPseudo.cpp.
Akira Hatanaka [Fri, 25 May 2012 20:54:48 +0000 (20:54 +0000)]
Delete MipsExpandPseudo.cpp.

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

12 years agoMove the code in MipsExpandPseudo to MipsInstrInfo::expandPostRAPseudo.
Akira Hatanaka [Fri, 25 May 2012 20:52:52 +0000 (20:52 +0000)]
Move the code in MipsExpandPseudo to MipsInstrInfo::expandPostRAPseudo.
Delete MipsExpandPseudo.

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

12 years agoRemove the code that expands MIPS' .cpload directive.
Akira Hatanaka [Fri, 25 May 2012 20:46:52 +0000 (20:46 +0000)]
Remove the code that expands MIPS' .cpload directive.

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

12 years agoRemove the code that emits MIPS' .cprestore directive.
Akira Hatanaka [Fri, 25 May 2012 20:42:55 +0000 (20:42 +0000)]
Remove the code that emits MIPS' .cprestore directive.

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

12 years agoRemove pseudo instructions that are no longer used.
Akira Hatanaka [Fri, 25 May 2012 20:37:40 +0000 (20:37 +0000)]
Remove pseudo instructions that are no longer used.

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

12 years ago[NVPTX] Add a new test case for the newly-enabled call handling
Justin Holewinski [Fri, 25 May 2012 17:20:38 +0000 (17:20 +0000)]
[NVPTX] Add a new test case for the newly-enabled call handling

NV_CONTRIB

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

12 years agoboundschecking:
Nuno Lopes [Fri, 25 May 2012 16:54:04 +0000 (16:54 +0000)]
boundschecking:
add support for select
add experimental support for alloc_size metadata

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

12 years agoChange interface for TargetLowering::LowerCallTo and TargetLowering::LowerCall
Justin Holewinski [Fri, 25 May 2012 16:35:28 +0000 (16:35 +0000)]
Change interface for TargetLowering::LowerCallTo and TargetLowering::LowerCall
to pass around a struct instead of a large set of individual values.  This
cleans up the interface and allows more information to be added to the struct
for future targets without requiring changes to each and every target.

NV_CONTRIB

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

12 years agotest/CodeGen/X86/bigstructret.ll: Suppress one test. It is msvc-incompatible. (compat...
NAKAMURA Takumi [Fri, 25 May 2012 15:40:54 +0000 (15:40 +0000)]
test/CodeGen/X86/bigstructret.ll: Suppress one test. It is msvc-incompatible. (compatible to mingw32 and netbsd, though)

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

12 years agotest/CodeGen/X86/bigstructret.ll: Relax stack offsets for hosts of stack-align=8...
NAKAMURA Takumi [Fri, 25 May 2012 15:12:21 +0000 (15:12 +0000)]
test/CodeGen/X86/bigstructret.ll: Relax stack offsets for hosts of stack-align=8, eg. win32 and netbsd.

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