Duncan Sands
b4e346d867
Rename SimplifyDistributed to the more meaningfull name SimplifyByFactorizing.
...
llvm-svn: 120051
2010-11-23 20:42:39 +00:00
Benjamin Kramer
8d7096e8ca
The srem -> urem transform is not safe for any divisor that's not a power of two.
...
E.g. -5 % 5 is 0 with srem and 1 with urem.
Also addresses Frits van Bommel's comments.
llvm-svn: 120049
2010-11-23 20:33:57 +00:00
Duncan Sands
42e2ffcd33
Replace calls to ConstantFoldInstruction with calls to SimplifyInstruction
...
in two places that are really interested in simplified instructions, not
constants.
llvm-svn: 120044
2010-11-23 20:26:33 +00:00
Duncan Sands
20cae200d0
Constant folding here is pointless, because InstructionSimplify
...
(which does constant folding and more) is called a few lines
later.
llvm-svn: 120042
2010-11-23 20:24:21 +00:00
Jason W Kim
b1725a8110
Move the ARM reloc constants to Support/ELF.h
...
llvm-svn: 120035
2010-11-23 19:40:36 +00:00
Bob Wilson
ff0e6b1252
Recognize sign/zero-extended constant BUILD_VECTORs for VMULL operations.
...
We need to check if the individual vector elements are sign/zero-extended
values. For now this only handles constants values. Radar 8687140.
llvm-svn: 120034
2010-11-23 19:38:38 +00:00
Bob Wilson
77071bcf8a
Fix copy-and-paste error in exception message.
...
llvm-svn: 120033
2010-11-23 19:38:34 +00:00
Benjamin Kramer
c8e6037e7d
InstCombine: Reduce "X shift (A srem B)" to "X shift (A urem B)" iff B is positive.
...
This allows to transform the rem in "1 << ((int)x % 8);" to an and.
llvm-svn: 120028
2010-11-23 18:52:42 +00:00
Duncan Sands
45b231e80f
Propagate LeftDistributes and RightDistributes into their only uses.
...
Stylistic improvement suggested by Frits van Bommel.
llvm-svn: 120026
2010-11-23 15:28:14 +00:00
Duncan Sands
fce4583b6a
Fix typo pointed out by Frits van Bommel and Marius Wachtler.
...
llvm-svn: 120025
2010-11-23 15:25:34 +00:00
Duncan Sands
555525adf4
Exploit distributive laws (eg: And distributes over Or, Mul over Add, etc) in a
...
fairly systematic way in instcombine. Some of these cases were already dealt
with, in which case I removed the existing code. The case of Add has a bunch of
funky logic which covers some of this plus a few variants (considers shifts to be
a form of multiplication), which I didn't touch. The simplification performed is:
A*B+A*C -> A*(B+C). The improvement is to do this in cases that were not already
handled [such as A*B-A*C -> A*(B-C), which was reported on the mailing list], and
also to do it more often by not checking for "only one use" if "B+C" simplifies.
llvm-svn: 120024
2010-11-23 14:23:47 +00:00
Kalle Raiskila
f71cc94c91
Division by pow-of-2 is not cheap on SPU, do it with
...
shifts.
llvm-svn: 120022
2010-11-23 13:27:59 +00:00
Rafael Espindola
72c8de703d
Implement the rex64 prefix.
...
llvm-svn: 120017
2010-11-23 11:23:24 +00:00
Duncan Sands
97ada840ed
Expand a little on the description of what InstructionSimplify does.
...
llvm-svn: 120016
2010-11-23 10:50:08 +00:00
Duncan Sands
809b3e3634
Clarify that constant folding of instructions applies when all operands
...
are constant. There was in fact one exception to this (phi nodes) - so
remove that exception (InstructionSimplify handles this so there should
be no loss).
llvm-svn: 120015
2010-11-23 10:16:18 +00:00
Rafael Espindola
af4cd15f2a
Invalidate the layout on any relaxation, not just Instructions. Bug found by David Meyer.
...
While here, remove unused argument and rename UpdateForSlide to Invalidate.
llvm-svn: 120009
2010-11-23 08:08:33 +00:00
Rafael Espindola
6f069fc35f
Produce a relocation for pcrel absolute values. Based on a patch by David Meyer.
...
llvm-svn: 120006
2010-11-23 07:20:12 +00:00
Cameron Zwarich
1fa40011ae
Optimize a common case in the Lengauer-Tarjan dominators algorithm. This gives a
...
9.7% speedup running domtree on test-suite.
Reviewed by Chris Lattner.
llvm-svn: 120003
2010-11-23 06:32:37 +00:00
Chris Lattner
a830fc6a45
Revert functionality doug added in r98575 that was never
...
documented and only used by some clang stuff I just removed.
llvm-svn: 120002
2010-11-23 06:09:51 +00:00
Rafael Espindola
a660c25883
Reuse data fragments while lowering. Patch by David Meyer.
...
llvm-svn: 119999
2010-11-23 05:49:35 +00:00
Zhanyong Wan
ee1d07099f
Fix formatting nits in the coding standards. Reviewed by clattner.
...
llvm-svn: 119998
2010-11-23 05:03:07 +00:00
Chris Lattner
44b4aff9ff
fix this harder.
...
llvm-svn: 119994
2010-11-23 04:26:12 +00:00
Chris Lattner
040c0a1c3d
fix a bug I introduced on the other side of the #ifdef
...
llvm-svn: 119993
2010-11-23 04:19:56 +00:00
Chris Lattner
e6d7915f62
reimplement SwapByteOrder.h in terms of overloading instead of
...
being in terms of excessively complex template logic.
llvm-svn: 119992
2010-11-23 04:04:25 +00:00
Wesley Peck
d589353ad0
Renaming ISD::BIT_CONVERT to ISD::BITCAST to better reflect the LLVM IR concept.
...
llvm-svn: 119990
2010-11-23 03:31:01 +00:00
Chris Lattner
d935e210ee
add a 'LLVMConstIntOfArbitraryPrecision' api to the C api,
...
patch by Greg Pfeil!
llvm-svn: 119989
2010-11-23 02:47:22 +00:00
Chris Lattner
41281bd30f
duncan's spider sense was right, I completely reversed the condition
...
on this instcombine xform. This fixes a miscompilation of 403.gcc.
llvm-svn: 119988
2010-11-23 02:42:04 +00:00
Chris Lattner
c0fcc364c0
filecheckize
...
llvm-svn: 119987
2010-11-23 02:26:52 +00:00
Jason W Kim
287d5fb10b
Fixed some style issues (no _, no spc after !)
...
llvm-svn: 119986
2010-11-22 22:05:16 +00:00
Rafael Espindola
492580fa9a
Remove duplicated constants. Thanks to Jason for noticing it.
...
llvm-svn: 119985
2010-11-22 21:49:05 +00:00
Benjamin Kramer
b5a2a81094
InstCombine: Implement X - A*-B -> X + A*B.
...
llvm-svn: 119984
2010-11-22 20:31:27 +00:00
Jason W Kim
0941164ddb
Make the <ARCH>ELFObjectWriter statics private
...
llvm-svn: 119982
2010-11-22 18:57:00 +00:00
Jason W Kim
243d3f5d8c
Fix misplaced statics.
...
llvm-svn: 119981
2010-11-22 18:47:05 +00:00
Jason W Kim
dea9f17ab2
Kill trailing whitespace
...
llvm-svn: 119979
2010-11-22 18:42:07 +00:00
Jason W Kim
e2fece2f4c
Refactor the ELFRelocationEntry (pull up) and move the arch-specific statics to inside the class where it belongs.
...
Next step is to rationally break apart the RecordRelocation()
Probably the step will be to have 1 member function for ech slot of the ELFRelocationEntry()
llvm-svn: 119978
2010-11-22 18:41:13 +00:00
Evan Cheng
e6d55cd247
Fix epilogue codegen to avoid leaving the stack pointer in an invalid
...
state. Previously Thumb2 would restore sp from fp like this:
mov sp, r7
sub, sp, #4
If an interrupt is taken after the 'mov' but before the 'sub', callee-saved
registers might be clobbered by the interrupt handler. Instead, try
restoring directly from sp:
add sp, #4
Or, if necessary (with VLA, etc.) use a scratch register to compute sp and
then restore it:
sub.w r4, r7, #8
mov sp, r7
rdar://8465407
llvm-svn: 119977
2010-11-22 18:12:04 +00:00
Mikhail Glushenkov
cfae3f46f9
Add a newline.
...
llvm-svn: 119976
2010-11-22 17:10:20 +00:00
Mikhail Glushenkov
946fa2d2ee
llvmc: Make -march/-mcpu/-mtune behaviour more consistent with gcc.
...
llvm-svn: 119975
2010-11-22 17:10:09 +00:00
Duncan Sands
73f0559779
If a GEP index simply advances by multiples of a type of zero size,
...
then replace the index with zero.
llvm-svn: 119974
2010-11-22 16:32:50 +00:00
Kalle Raiskila
8f1131e569
Fix a bug with extractelement on SPU.
...
In the attached testcase, the element was
never extracted (missing rotate).
llvm-svn: 119973
2010-11-22 16:28:26 +00:00
Rafael Espindola
e20c3d7c26
Add basic CFI methods to the streamer interface.
...
llvm-svn: 119972
2010-11-22 14:27:24 +00:00
Duncan Sands
ffcd1f61d9
Move the "gep undef" -> "undef" transform from instcombine to
...
InstructionSimplify.
llvm-svn: 119970
2010-11-22 13:42:49 +00:00
Rafael Espindola
5f582e980e
Remove some #includes.
...
llvm-svn: 119967
2010-11-22 11:53:17 +00:00
Benjamin Kramer
632a91cba5
Implement the "if (X == 6 || X == 4)" -> "if ((X|2) == 6)" optimization.
...
This currently only catches the most basic case, a two-case switch, but can be
extended later.
llvm-svn: 119964
2010-11-22 09:45:38 +00:00
Duncan Sands
f0224e2119
Don't keep track of inserted phis in PromoteMemoryToRegister: the information
...
is never used. Patch by Cameron Zwarich.
llvm-svn: 119963
2010-11-22 09:41:24 +00:00
Duncan Sands
99ff019c87
Fix a compiler warning about Kind being used uninitialized
...
when assertions are disabled.
llvm-svn: 119962
2010-11-22 09:38:00 +00:00
Eric Christopher
662ad8ba93
Pseudos default to 4byte size, let the instruction size field notice
...
that branch tables are special.
llvm-svn: 119954
2010-11-21 23:38:19 +00:00
Wesley Peck
e25f241e37
Implement ELF object file writing support for the MBlaze backend. Its not perfect yet, but it works for many tests.
...
llvm-svn: 119952
2010-11-21 22:06:28 +00:00
Wesley Peck
911abf2bc0
Implement branch analysis in the MBlaze backend.
...
llvm-svn: 119951
2010-11-21 21:53:36 +00:00
Wesley Peck
470c56eef5
Make it a little bit more explicit that the MBlaze backend only supports upto
...
32-bit immediate values.
llvm-svn: 119950
2010-11-21 21:39:46 +00:00