Commit Graph

44526 Commits

Author SHA1 Message Date
Duncan Sands
3421d90853 Teach InstructionSimplify about distributive laws. These transforms fire
quite often, but don't make much difference in practice presumably because
instcombine also knows them and more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122328 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 13:32:22 +00:00
Duncan Sands
0312a93693 Move checking of the recursion limit into the various Thread methods.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122327 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 09:09:15 +00:00
Duncan Sands
566edb04b8 Add generic simplification of associative operations, generalizing
a couple of existing transforms.  This fires surprisingly often, for
example when compiling gcc "(X+(-1))+1->X" fires quite a lot as well
as various "and" simplifications (usually with a phi node operand).
Most of the time this doesn't make a real difference since the same
thing would have been done elsewhere anyway, eg: by instcombine, but
there are a few places where this results in simplifications that we
were not doing before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122326 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 08:49:00 +00:00
Cameron Zwarich
47bce43229 Incremental progress towards a new implementation of StrongPHIElimination. Most
of the problems with my last attempt were in the updating of LiveIntervals
rather than the coalescing itself. Therefore, I decided to get that right first
by essentially reimplementing the existing PHIElimination using LiveIntervals.

It works correctly, with only a few tests failing (which may not be legitimate
failures) and no new verifier failures (at least as far as I can tell, I didn't
count the number per file).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122321 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 06:54:43 +00:00
Bob Wilson
316009054e Add ARM-specific DAG combining to cast i64 vector element load/stores to f64.
Type legalization splits up i64 values into pairs of i32 values, which leads
to poor quality code when inserting or extracting i64 vector elements.
If the vector element is loaded or stored, it can be treated as an f64 value
and loaded or stored directly from a VPR register.  Use the pre-legalization
DAG combiner to cast those vector elements to f64 types so that the type
legalizer won't mess them up.  Radar 8755338.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 06:43:19 +00:00
Rafael Espindola
62b83b62f3 Layout one section until no relaxations are done and then move to the next
section.

This helps because in practice sections form a dag with debug sections pointing
to text sections. Finishing up the text sections first makes the debug section
relaxation trivial.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 04:22:09 +00:00
Eric Christopher
c19aadb8b0 Arm and thumb call instructions are also in different orders.
Fixes rdar://8782223


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122313 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 03:50:43 +00:00
Chris Lattner
f1b4eafbfe rename MVT::Flag to MVT::Glue. "Flag" is a terrible name for
something that just glues two nodes together, even if it is
sometimes used for flags.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122310 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:38:05 +00:00
Eric Christopher
6e90ce21cc If we're not using reg+reg offset we're using reg+imm, set the opcode
to be the one we want to use. bugpoint reduced testcase is a little large,
I'll see if I can simplify it down more.

Fixes part of rdar://8782207


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122307 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:12:07 +00:00
Chris Lattner
5df1578dec improve "cannot yet select" errors a trivial amount: now
they are just as useless, but at least a bit more gramatical


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122305 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 02:07:03 +00:00
Bill Wendling
a519d57725 Fix a copy-pasto. When the tBR_JTr instruction was converted to using the
tPseudoInst class, its size was changed from "special" to "2 bytes". This is
incorrect because the jump table will no longer be taken into account when
calculating branch offsets.
<rdar://problem/8782216>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122303 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 01:57:15 +00:00
Bill Wendling
9a4d2e40a0 Comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122302 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 01:54:40 +00:00
Jakob Stoklund Olesen
8d0963f72c Add EdgeBundles to SplitKit.
Edge bundles is an annotation on the CFG that turns it into a bipartite directed
graph where each basic block is connected to an outgoing and an ingoing bundle.
These bundles are useful for identifying regions of the CFG for live range
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 01:50:21 +00:00
Jakob Stoklund Olesen
b907e8a2d4 Use IntEqClasses to compute connected components of live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 00:48:17 +00:00
Jakob Stoklund Olesen
2a6899c539 Add ADT/IntEqClasses.h as a light-weight implementation of EquivalenceClasses.h.
This implementation already exists as ConnectedVNInfoEqClasses in
LiveInterval.cpp, and it seems to be generally useful to have a light-weight way
of forming equivalence classes of small integers.

IntEqClasses doesn't allow enumeration of the elements in a class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-21 00:04:46 +00:00
Owen Anderson
4d3daab1a1 Speculatively revert the use of DenseMap in LazyValueInfo, which may be causing Linux self-host failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122291 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 23:53:19 +00:00
Owen Anderson
bb39ac1458 Attempt to appease the DragonEgg buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 23:23:18 +00:00
Owen Anderson
3b77f56194 Revert r122114 (CallbackVH observing use-list changes) because it caused severe slowdowns on the Linux self-host configuration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 22:28:03 +00:00
Nate Begeman
672fb6225b Implement feedback from Bruno on making pblendvb an x86-specific ISD node in addition to being an intrinsic, and convert
lowering to use it.  Hopefully the pattern fragment is doing the right thing with XMM0, looks correct in testing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 22:04:24 +00:00
Owen Anderson
aa6f105629 Convert one of LVI's primary maps to a DenseMap, now that we know are more assured of iterator stability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 21:30:54 +00:00
Wesley Peck
d66a32c35f Teach the MBlaze disassembler to disassemble special purpose registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 21:18:04 +00:00
Roman Divacky
d149186e15 Set the value of absolute symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 21:14:39 +00:00
Duncan Sands
69fdf876e1 Oops, forgot to add the pass itself!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 21:07:42 +00:00
Duncan Sands
43ff68ded0 Add a new convenience pass for testing InstructionSimplify. Previously
it could only be tested indirectly, via instcombine, gvn or some other
pass that makes use of InstructionSimplify, which means that testcases
had to be carefully contrived to dance around any other transformations
that that pass did.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:54:37 +00:00
Wesley Peck
9c0068f0a3 Teach the MBlaze asm parser how to parse special purpose register names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122261 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:43:24 +00:00
Dale Johannesen
025cc6e1be Cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:10:50 +00:00
Benjamin Kramer
b0de244f23 Add a check missing from my last commit and avoid a potential overflow situation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 20:00:31 +00:00
Owen Anderson
87790abb08 More LVI cleanups, including trying to simplify the process of maintaining the OverDefinedCache.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 19:33:41 +00:00
Owen Anderson
6186394528 Reuse the reference into the LVI cache throughout the solver subsystem. This is much easier to
verify as being safe thanks its recent de-recursivization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122254 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 18:18:16 +00:00
Benjamin Kramer
4dc1ac0947 Reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122249 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 16:21:59 +00:00
Benjamin Kramer
5337f20c15 Teach InstCombine to merge (icmp ult (X + CA), C1) | (icmp eq X, C2) into (icmp ult (X + CA), C1 + 1) if C2 + CA == C1.
InstCombine creates these so now we compile x == 23 || x == 24 || x == 25 to
  %x.off = add i32 %x, -23
  %1 = icmp ult i32 %x.off, 3
instead of
  %x.off = add i32 %x, -23
  %1 = icmp ult i32 %x.off, 2
  %cmp3 = icmp eq i32 %x, 25
  %ret2 = or i1 %1, %cmp3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 16:18:51 +00:00
Daniel Dunbar
67e0c212c2 Add header...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122247 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 15:45:51 +00:00
Daniel Dunbar
9b2f25e313 X86/MC/Mach-O: Split out createX86MachObjectWriter().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122246 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 15:07:39 +00:00
Duncan Sands
ee9a2e322a Have SimplifyBinOp dispatch Xor, Add and Sub to the corresponding methods
(they had just been forgotten before).  Adding Xor causes "main" in the
existing testcase 2010-11-01-lshr-mask.ll to be hugely more simplified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122245 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 14:47:04 +00:00
Michael J. Spencer
2d484eb88d Support/PathV2: Add missing has_relative_path impl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122243 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 13:30:28 +00:00
Duncan Sands
0d7ce5ffa4 There is no need for isAssociative to take the type as an argument anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122242 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 13:10:23 +00:00
Chris Lattner
2b9375e44b fix PR8807 by making transformConstExprCastCall aware of byval arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122238 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 08:36:38 +00:00
Chris Lattner
ab215bc371 various cleanups for transformConstExprCastCall
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 08:25:06 +00:00
Chris Lattner
0b66f63a26 when eliding a byval copy due to inlining a readonly function, we have
to make sure that the reused alloca has sufficient alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122236 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 08:10:40 +00:00
Chris Lattner
e7ae705c32 pull byval processing out to its own helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 07:57:41 +00:00
Chris Lattner
018fb767b9 fix PR8769, a miscompilation by inliner when inlining a function with a byval
argument.  The generated alloca has to have at least the alignment of the
byval, if not, the client may be making assumptions that the new alloca won't
satisfy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 07:45:28 +00:00
Cameron Zwarich
2100d21f39 MachineVerifier should count landing pad successors as basic blocks rather than
out-edges. Fixes PR8824.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122228 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 04:19:48 +00:00
Cameron Zwarich
0b13d7db28 Teach MachineVerifier that early clobber defs begin at USE slots and other defs
begin at DEF slots. Fixes the second half of PR8813.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 03:15:20 +00:00
Cameron Zwarich
5e61f9916e Add a missing check from r122218.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 02:59:51 +00:00
Chris Lattner
5c3d4f0fc9 implement type legalization promotion support for SMULO and UMULO, giving
ARM (and other 32-bit-only) targets support for i8 and i16 overflow 
multiplies.  The generated code isn't great, but this at least fixes
CodeGen/Generic/overflow.ll when running on ARM hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122221 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 02:05:39 +00:00
Chris Lattner
23a0199f05 now that addc/adde are gone, "ADDC" in the X86 backend uses EFLAGS results,
the same as setcc.  Optimize ADDC(0,0,FLAGS) -> SET_CARRY(FLAGS).  This is
a step towards finishing off PR5443.  In the testcase in that bug we now  get:

	movq	%rdi, %rax
	addq	%rsi, %rax
	sbbq	%rcx, %rcx
	testb	$1, %cl
	setne	%dl
	ret

instead of:

	movq	%rdi, %rax
	addq	%rsi, %rax
	movl	$0, %ecx
	adcq	$0, %rcx
	testq	%rcx, %rcx
	setne	%dl
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122219 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:37:09 +00:00
Cameron Zwarich
636f15ff04 Don't assume that an instruction ending a register's live range always reads
the register; it may be a dead def instead. Fixes PR8820.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122218 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:22:37 +00:00
Chris Lattner
39ffcb7b62 We lower setb to sbb with the hope that the and will go away, when it
doesn't, match it back to setb.

On a 64-bit version of the testcase before we'd get:

	movq	%rdi, %rax
	addq	%rsi, %rax
	sbbb	%dl, %dl
	andb	$1, %dl
	ret

now we get:

	movq	%rdi, %rax
	addq	%rsi, %rax
	setb	%dl
	ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:16:03 +00:00
Mon P Wang
55fb9b0fcf Avoid dropping the address space when InstCombine optimizes memset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:05:30 +00:00
Chris Lattner
d8ff7eca8c use for loop over types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 01:03:27 +00:00
Chris Lattner
5b85654844 Change the X86 backend to stop using the evil ADDC/ADDE/SUBC/SUBE nodes (which
their carry depenedencies with MVT::Flag operands) and use clean and beautiful
EFLAGS dependences instead.

We do this by changing the modelling of SBB/ADC to have EFLAGS input and outputs
(which is what requires the previous scheduler change) and change X86 ISelLowering
to custom lower ADDC and friends down to X86ISD::ADD/ADC/SUB/SBB nodes.

With the previous series of changes, this causes no changes in the testsuite, woo.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:59:46 +00:00
Chris Lattner
37944985a5 Fix a bug in the scheduler's handling of "unspillable" vregs.
Imagine we see:

EFLAGS = inst1
EFLAGS = inst2 FLAGS
gpr = inst3 EFLAGS

Previously, we would refuse to schedule inst2 because it clobbers
the EFLAGS of the predecessor.  However, it also uses the EFLAGS
of the predecessor, so it is safe to emit.  SDep edges ensure that
the right order happens already anyway.

This fixes 2 testsuite crashes with the X86 patch I'm going to
commit next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122211 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:55:43 +00:00
Chris Lattner
142d21c861 the result of CheckForLiveRegDef is dead, remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:51:56 +00:00
Chris Lattner
5078293cc2 reduce indentation, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122208 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:50:16 +00:00
Cameron Zwarich
8ec88ba588 Ignore debug values when performing MachineVerifier liveness checks. Fixes
PR8822.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20 00:08:10 +00:00
Mon P Wang
a0fd0d5b27 Prevents PerformShuffleCombine from creating a node with an illegal type after legalize types
has run, e.g., prevent creating an i64 node from a v2i64 when i64 is not a legal type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 23:55:53 +00:00
Cameron Zwarich
1b031ddede Early clobber operands are allowed to be defined at use indices. This fixes one
half of PR8813.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 23:50:53 +00:00
Chris Lattner
f2a97ed13d fix an oversight caught by Frits!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122204 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 23:24:04 +00:00
Cameron Zwarich
fb69f6037d Fix PR8815 by checking for an explicit clobber def tied to a use operand in
ConnectedVNInfoEqClasses::Classify().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 22:12:45 +00:00
Chris Lattner
c19d1c3ba2 improve the setcc -> setcc_carry optimization to happen more
consistently by moving it out of lowering into dag combine.

Add some missing patterns for matching away extended versions of setcc_c.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 22:08:31 +00:00
Cameron Zwarich
22d67cf6ac Fix PR8811 by teaching MachineVerifier about optional defs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 21:37:23 +00:00
Cameron Zwarich
c44270dd6f StrongPHIElimination will never run before TwoAddressInstructionPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122197 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 21:32:29 +00:00
Chris Lattner
481eebc931 simplify some code to just reuse a setcc if we can instead of
going through the CSE maps to get it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122196 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 21:23:48 +00:00
Nick Lewycky
476b242fe7 Add missing standard headers. Patch by Joerg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122193 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:43:38 +00:00
Nick Lewycky
2402123413 Add missing std:: prefixes to some calls. C++ doesn't require that <cfoo>
headers provide symbols outside namespace std and the LLVM coding standards
state that we should prefix all of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122192 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:42:43 +00:00
Chris Lattner
da60588402 teach MaskedValueIsZero how to analyze ADDE. This is
enough to teach it that ADDE(0,0) is known 0 except the 
low bit, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:38:28 +00:00
Chris Lattner
459f4f8c25 tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:24:28 +00:00
Chris Lattner
2a786eb030 now that generic vector types aren't selected onto MMX operations,
we don't need -disable-mmx anymore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:19:20 +00:00
Chris Lattner
e019ec168b reduce copy/paste programming with the power of for loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122187 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:07:10 +00:00
Chris Lattner
a34b3cf953 X86 supports i8/i16 overflow ops (except i8 multiplies), we should
generate them.  

Now we compile:

define zeroext i8 @X(i8 signext %a, i8 signext %b) nounwind ssp {
entry:
  %0 = tail call %0 @llvm.sadd.with.overflow.i8(i8 %a, i8 %b)
  %cmp = extractvalue %0 %0, 1
  br i1 %cmp, label %if.then, label %if.end

into:

_X:                                     ## @X
## BB#0:                                ## %entry
	subl	$12, %esp
	movb	16(%esp), %al
	addb	20(%esp), %al
	jo	LBB0_2

Before we were generating:

_X:                                     ## @X
## BB#0:                                ## %entry
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movb	12(%ebp), %al
	testb	%al, %al
	setge	%cl
	movb	8(%ebp), %dl
	testb	%dl, %dl
	setge	%ah
	cmpb	%cl, %ah
	sete	%cl
	addb	%al, %dl
	testb	%dl, %dl
	setge	%al
	cmpb	%al, %ah
	setne	%al
	andb	%cl, %al
	testb	%al, %al
	jne	LBB0_2




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 20:03:11 +00:00
Chris Lattner
74b64611c4 move a transformation to a more logical place, simplifying it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 19:43:52 +00:00
Chris Lattner
e5cbdca3bd recognize an unsigned add with overflow idiom into uadd.
This resolves a README entry and technically resolves PR4916,
but we still get poor code for the testcase in that PR because
GVN isn't CSE'ing uadd with add, filed as PR8817.

Previously we got:

_test7:                                 ## @test7
	addq	%rsi, %rdi
	cmpq	%rdi, %rsi
	movl	$42, %eax
	cmovaq	%rsi, %rax
	ret

Now we get:

_test7:                                 ## @test7
	addq	%rsi, %rdi
	movl	$42, %eax
	cmovbq	%rsi, %rax
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 19:37:52 +00:00
Chris Lattner
26b482d7a7 optimize uadd(x, cst) into a comparison when the normal
result is dead.  This is required for my next patch to not
regress the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 19:35:32 +00:00
Chris Lattner
0fe80bbbb6 use IC.ReplaceInstUsesWith instead of a raw RAUW so that uses of
the old thing end up on the instcombine worklist.  Not doing this
can cause an extra top-level iteration of instcombine, burning
compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122179 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 18:38:44 +00:00
Chris Lattner
0a62474830 generalize the sadd creation code to not require that the
sadd formed is half the size of the original type. We can
now compile this into a sadd.i8:

unsigned char X(char a, char b) {
  int res = a+b;
  if ((unsigned )(res+128) > 255U)
    abort();
  return res;
}




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 18:35:09 +00:00
Chris Lattner
dd7e837374 fix another miscompile in the llvm.sadd formation logic: it wasn't
checking to see if the high bits of the original add result were dead.
Inserting a smaller add and zexting back to that size is not good enough.

This is likely to be the fix for 8816.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122177 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 18:22:06 +00:00
Cameron Zwarich
d959da92a5 Remove some checks for StrongPHIElim. These checks make it impossible to use an
alternative register allocator that does not require LiveIntervals by specifying
it on the command-line for a target that has StrongPHIElimination enabled by
default.

These checks are pretty meaningless anyways, since StrongPHIElimination and
PHIElimination are never used at the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 18:03:27 +00:00
Chris Lattner
368397bb7d fix a bug (possibly 8816) in the sadd forming xform: it isn't
profitable (or safe) to promote code when the add-with-constant
has other uses.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 17:59:02 +00:00
Chris Lattner
f0f568b49e rework the code added in r122072 to pull it out to its own
helper function, clean up comments, and reduce indentation.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122174 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 17:52:50 +00:00
Chris Lattner
1dec0d2704 Enhance LICM to promote alias sets whose pointers themselves are stored,
which doesn't affect the memory address being promoted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 05:57:25 +00:00
Chris Lattner
1c0af0ed25 fix PR8602, a bug in an assertion: a volatile store *of* a pointer
does not make the alias set for that pointer volatile, just stores
*to* the pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 05:51:54 +00:00
Chris Lattner
96ba57fdda fix PR8642: if a critical edge has a PHI value that can trap,
isel is *required* to split the edge.  PHI values get evaluated
on the edge, not in their predecessor block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 04:58:57 +00:00
Chris Lattner
a0d172f7fe revert r122164, I'm going to go with a different approach.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122168 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 04:23:03 +00:00
Rafael Espindola
c5b0e44aca Fixed version of 122160 (the previous one would fold undefined symbols).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 04:18:56 +00:00
Rafael Espindola
af0e6ce80f Revert 122160 while I debug it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 03:22:05 +00:00
Chris Lattner
140f4a315b first step to fixing PR8642: don't fold away empty basic blocks
which have trapping constant exprs in them due to PHI nodes.
Eliminating them can cause the constant expr to be evalutated
on new paths if the input edges are critical.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 03:02:34 +00:00
Rafael Espindola
f399d9d37b Move all folding to AttemptToFoldSymbolOffsetDifference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19 02:15:04 +00:00
Michael J. Spencer
79e8625220 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:15 +00:00
Michael J. Spencer
7385509101 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:07 +00:00
Chris Lattner
a37029cd24 simplify this a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122156 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 20:22:49 +00:00
Anton Korobeynikov
c8bd78c16b Restore the behavior of frame lowering before my refactoring.
It turns out that ppc backend has really weird interdependencies
over different hooks and all stuff is fragile wrt small changes.
This should fix PR8749


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122155 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 19:53:14 +00:00
Roman Divacky
7529b16410 Add support for lexing single quotes like 'c'.
This fixed 8615.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122150 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 08:56:37 +00:00
Owen Anderson
fffa863536 Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 07:37:18 +00:00
Rafael Espindola
3132780a2e Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 06:27:54 +00:00
Rafael Espindola
1ec5bd31fe Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 05:37:28 +00:00
Rafael Espindola
3f037ef2f5 Add a FIXME and explain a hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:19:20 +00:00
Michael J. Spencer
1d6e7d2e42 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:46 +00:00
Michael J. Spencer
b9c767cce5 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:36 +00:00
Rafael Espindola
f705a7ed27 Fix the note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122139 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:01:45 +00:00
Rafael Espindola
d076482ab7 Revert 122011, 122012, 122013, 122023 adding back an important optimization.
I added a note, but suggestions on how to add a test are really welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:57:21 +00:00
Jakob Stoklund Olesen
390482569c Apparently, operandices is not a word.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:28:32 +00:00
Rafael Espindola
bff66a86e6 Move some data to the TargetWriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:27:34 +00:00
Jakob Stoklund Olesen
83d1ba5728 Teach the inline spiller to attempt folding a load instruction into its single
use before rematerializing the load.

This allows us to produce:

    addps	LCPI0_1(%rip), %xmm2

Instead of:

    movaps	LCPI0_1(%rip), %xmm3
    addps	%xmm3, %xmm2

Saving a register and an instruction. The standard spiller already knows how to
do this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:04:14 +00:00
Jakob Stoklund Olesen
87c6d25c71 Tweak debug spew.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122132 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 03:04:11 +00:00
Bill Wendling
a68a4fdf37 r120333 changed the opcode for the Thumb1 stuff from ARM::tMOVr to
ARM::tMOVgpr2gpr. But this check didn't change. As a result, we were getting
misaligned references to the jump table from an ADR instruction.

There is a test case, but unfortunately it's sensitive to random code changes.

<rdar://problem/8782223>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 02:13:59 +00:00
Bill Wendling
cd080249fc RemoveUnusedCPEntries can change things. Track it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122129 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:53:06 +00:00
Jakob Stoklund Olesen
dfe3b6d2a9 Check that the register is live-in to the loop header before inserting copies in
the loop predecessors.

The register can be live-out from a predecessor without being live-in to the
loop header if there is a critical edge from the predecessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:06:19 +00:00
Nick Lewycky
bb1744ec15 Fix GCC warning:
lib/CodeGen/RegAllocGreedy.cpp:311: error: unused variable 'PhysReg' [-Wunused-variable]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122122 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:05:55 +00:00
Rafael Espindola
1ee03a835e Relax push instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122121 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:01:34 +00:00
Nick Lewycky
90862eeb7d Make LazyValueInfo non-recursive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 01:00:40 +00:00
Bob Wilson
094dd80ecc Rearrange some Neon multiclasses. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122119 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:42:58 +00:00
Michael J. Spencer
b3127bb06a Support/PathV1: Deprecate getLast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:19:10 +00:00
Owen Anderson
a479b23256 Add support to CallbackVH to receive notification when a Value's use-list changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:07:15 +00:00
Jakob Stoklund Olesen
89cab93fe9 Pass a Banner argument to the machine code verifier both from
createMachineVerifierPass and MachineFunction::verify.

The banner is printed before the machine code dump, just like the printer pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:06:56 +00:00
Bob Wilson
3deb45149a Fix result type of Neon floating-point comparisons against zero.
The result vector elements are always integers.  Radar 8782191.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122112 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:04:33 +00:00
Bob Wilson
3a75b9bc8f Add some missing entries in ARMTargetLowering::getTargetNodeName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122111 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 00:04:26 +00:00
Bill Wendling
2d0537cdd8 Whitespace fixes. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122110 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:27:41 +00:00
Jakob Stoklund Olesen
8d12140437 Avoid dereferencing end() in collectInterferingVRegs() when there is no
interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:38 +00:00
Jakob Stoklund Olesen
af24964251 Make the -verify-regalloc command line option available to base classes as
RegAllocBase::VerifyEnabled.

Run the machine code verifier in a few interesting places during RegAllocGreedy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:35 +00:00
Jakob Stoklund Olesen
f428eb6c1b Enable loop splitting in RegAllocGreedy.
The heuristics split around the largest loop where the current register may be
allocated without interference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:16:32 +00:00
Nate Begeman
9a3dc55202 Add vector versions of some existing scalar transforms to aid codegen in matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122105 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:12:19 +00:00
Bill Wendling
976ef86689 During local stack slot allocation, the materializeFrameBaseRegister function
may be called. If the entry block is empty, the insertion point iterator will be
the "end()" value. Calling ->getParent() on it (among others) causes problems.

Modify materializeFrameBaseRegister to take the machine basic block and insert
the frame base register at the beginning of that block. (It's very similar to
what the code does all ready. The only difference is that it will always insert
at the beginning of the entry block instead of after a previous materialization
of the frame base register. I doubt that that matters here.)

<rdar://problem/8782198>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122104 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:09:14 +00:00
Bob Wilson
d727343a40 Fix a DAGCombiner crash when folding binary vector operations with constant
BUILD_VECTOR operands where the element type is not legal.  I had previously
changed this code to insert TRUNCATE operations, but that was just wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:06:49 +00:00
Bob Wilson
9bb43e1675 Avoid report_fatal_error in ARM's PrintAsmOperand method.
The standard error handling in AsmPrinter::EmitInlineAsm handles this much
better, so just use it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:06:42 +00:00
Bob Wilson
26156456dd Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 23:06:32 +00:00
Nate Begeman
b65c175d32 Add support for matching psign & plendvb to the x86 target
Remove unnecessary pandn patterns, 'vnot' patfrag looks through bitcasts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 22:55:37 +00:00
Owen Anderson
175fb36f10 Thumb's forced-PC-alignment requirement applies to the _total_ displacement, not just to the fragment relative
portion.  While the fragment boundary is usually already aligned, it is possible for it not to be, which 
would lead to a non-aligned final displacement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:49:48 +00:00
Dale Johannesen
f5daf8bb7f Add a transform to DAG Combiner. This improves the
code for the case where 32-bit divide by constant is
turned into 64-bit multiply by constant.  8771012.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:45:49 +00:00
Michael J. Spencer
965841cfe4 Support/Path: Deprecate PathV1::isAbsolute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 21:21:31 +00:00
Benjamin Kramer
3ce88c9290 PathV2: Use StringRef::substr to simplify substring creation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 20:27:37 +00:00
Jakob Stoklund Olesen
2f3a4aa550 Allow missing kill flags on an untied operand of a two-address instruction when
the operand uses the same register as a tied operand:

  %r1 = add %r1, %r1

If add were a three-address instruction, kill flags would be required on at
least one of the uses. Since it is a two-address instruction, the tied use
operand must not have a kill flag.

This change makes the kill flag on the untied use operand optional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 19:18:41 +00:00
Jim Grosbach
a3dbd3a244 If The ARM WriteNopData() gets an unaligned byte count to pad out, fill in with
a partial value. rdar://8782954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 19:03:02 +00:00
Benjamin Kramer
7fb866643e Missed some StringRefRefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:59:09 +00:00
Jim Grosbach
f0db261e97 Add bits 31-28 to the Thumb2 encoding of TBB/TBH.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122076 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:42:56 +00:00
Jim Grosbach
6ec6eeb692 Handle 2 and 4 byte data blob fixup values for ARM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:39:10 +00:00
Benjamin Kramer
d53f3c864b Pass StringRefs by value, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:19:06 +00:00
Jakob Stoklund Olesen
090100fdb1 Add MachineLoopRange comparators for sorting loop lists by number and by area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:13:52 +00:00
Owen Anderson
e63dda51c2 Reapply r121905 (automatic synthesis of @llvm.sadd.with.overflow) with a fix for a bug that manifested itself
on the DragonEgg self-host bot.  Unfortunately, the testcase is pretty messy and doesn't reduce well due to
interactions with other parts of InstCombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122072 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:08:00 +00:00
Rafael Espindola
31f3578b00 Store and free the TargetObjectWriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122070 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 18:01:31 +00:00
Rafael Espindola
6024c97ffa Stub out explicit MCELFObjectTargetWriter interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 17:45:22 +00:00
Rafael Espindola
285b3e5b61 Move createELFObjectWriter to its own header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 16:59:53 +00:00
Benjamin Kramer
14c0987bd9 SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122054 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 10:48:14 +00:00
Benjamin Kramer
23dcd00ede Fix mismatched new[]/delete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 09:56:50 +00:00
Kalle Raiskila
18aa393153 Don't feed 19 bit immediates to ILA.
Patch (slightly modified) by Visa Putkinen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122052 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 09:36:09 +00:00
Rafael Espindola
127a6a47bd Use getFixupKindInfo to implement isFixupKindPCRel, ELF version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122050 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 07:28:17 +00:00
Chris Lattner
e27db74a60 improve switch formation to handle small range
comparisons formed by comparisons.  For example,
this:

void foo(unsigned x) {
  if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) 
    bar();
}

compiles into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$6, %edi
	ja	LBB0_2
## BB#1:                                ## %entry
	movl	%edi, %eax
	movl	$91, %ecx
	btq	%rax, %rcx
	jb	LBB0_3

instead of:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$2, %edi
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	cmpl	$6, %edi
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movl	%edi, %eax
	movl	$88, %ecx
	btq	%rax, %rcx
	jb	LBB0_4

This catches a bunch of cases in GCC, which look like this:

 %804 = load i32* @which_alternative, align 4, !tbaa !0
 %805 = icmp ult i32 %804, 2
 %806 = icmp eq i32 %804, 3
 %or.cond121 = or i1 %805, %806
 %807 = icmp eq i32 %804, 4
 %or.cond124 = or i1 %or.cond121, %807
 br i1 %or.cond124, label %.thread, label %808

turning this into a range comparison.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 06:20:15 +00:00
Daniel Dunbar
1139d5090a MC/ARM: Use aggressive symbol folding (important for jump tables, for example).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 06:00:24 +00:00
Daniel Dunbar
17304b3489 MC/Expr: Implemnt more aggressive folding during symbol evaluation using
IsSymbolRefDifferenceFullyResolved(). For example, we will now fold away
something like:
--
_a:
...
L0:
...
L1:
...
.long (L1 - L0) / 2
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122043 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 05:50:33 +00:00
Daniel Dunbar
b87422778c MC/Mach-O: On second thought, use a custom hook for enabling aggressive
IsSymbolRefDifferenceFullyResolved, it turns out this does change behavior on
enough cases for x86-32 that I would rather wait a bit on it.
 - In practice, we will want to change this eventually because it only means we
   generate less relocations (it also eliminates the need for the horrible
   '.set' hack that Darwin requires in some places).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 05:50:29 +00:00
Daniel Dunbar
32c1c5ae5f MC/Mach-O: Implement IsSymbolRefDifferenceFullyResolved.
- Unlike for fixups, we always do the "reliable" thing (not just for x86_64).
 - Since Darwin 'as' would typically reject things that using this will allow,
   we don't need to worry about compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 04:54:58 +00:00