Commit Graph

3934 Commits

Author SHA1 Message Date
Nick Lewycky
529de8a457 Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
and also update the cloning interface's major user, the loop optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 05:24:34 +00:00
Nick Lewycky
6af31aab63 Update the inliner and simplifycfg to handle unwind_to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 05:10:13 +00:00
Nick Lewycky
c6694228fa Two things. Preserve the unwind_to when splitting a BB.
Add the ability to remove just one instance of a BB from a phi node. This fixes
the compile error in the tree now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 05:04:48 +00:00
Nick Lewycky
c0d025f54f Prune the unwind_to labels on BBs that don't need them. Another step in the
removal of invoke, PR1269.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-09 04:55:16 +00:00
Nick Lewycky
6c36a0f9ee Not all users of a BB are Instructions any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-08 07:48:41 +00:00
Devang Patel
12a466b9d0 Update inliner to handle functions that return multiple values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 20:06:16 +00:00
Andrew Lenharth
d245a8ae47 add a pass that can extract all kinds of global values, not just functions. Update llvm-extract to use it and optionally extract a global variable if you want it too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 19:51:57 +00:00
Gabor Greif
29d8aa7877 fix typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-06 10:36:00 +00:00
Nick Lewycky
c1a2a61201 Don't try to simplify urem and srem using arithmetic rules that don't work
under modulo (overflow). Fixes PR1933.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-06 06:48:30 +00:00
Devang Patel
e0a6a3f22d Skip, for now, callsites where use of sret argument is not dominated by callsite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47980 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 23:39:23 +00:00
Devang Patel
c5eb380b60 Handle 'ret' with multiple values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 21:50:24 +00:00
Devang Patel
4d519457d1 Skip functions that return multiple values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 00:36:59 +00:00
Devang Patel
ac3746f20c Use while loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:59:49 +00:00
Devang Patel
37963556e3 Use cast instead of dyn_cast.
Update test to use multiple return value directly, instead of relying on -sretpromotion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47907 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:45:28 +00:00
Devang Patel
a9fe8bb3b6 Filter nested structs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47906 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:32:09 +00:00
Devang Patel
dc00d42bb1 Handle multiple return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:15:15 +00:00
Devang Patel
96f9cc02e3 Use appropriate index to get the result value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47897 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 19:22:54 +00:00
Devang Patel
544b92bb3c Skip sret attribute while preparing attribute list for
new function and new call sites.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 19:12:58 +00:00
Devang Patel
df1d15c52e Increment counter that keeps track of total number of sret promoted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 17:48:11 +00:00
Devang Patel
d0f4103a31 Skip declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 17:47:06 +00:00
Devang Patel
74382c3453 Process externally visible functions also. Later on code generator will do the right thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 17:46:26 +00:00
Devang Patel
98a6e067df Collect statistics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 17:44:37 +00:00
Devang Patel
41e2397b72 s/isReturnStruct()/hasStructRetAttr()/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 21:46:28 +00:00
Devang Patel
2a4821b2b3 Preserve paramater attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47847 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 18:36:03 +00:00
Chris Lattner
b822e70f36 allow specified inline threshold to be negative, as the value is
itself sometimes negative.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 08:09:51 +00:00
Devang Patel
c45b5d9f66 Fix cut-n-pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 23:41:13 +00:00
Devang Patel
ca891ecf91 Add pass to promote sret.
This pass transforms 

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal void @foo(%struct._Point* sret  %agg.result)

into

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal %struct._Point @foo()

This pass updates foo() clients appropriately to use
getresult instruction to extract return values.

This pass is not yet ready for prime time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 23:34:08 +00:00
Chris Lattner
9d34c4d678 fix a bug Anders ran into where scalarrepl would crash when promoting
a union containing a vector and an array whose elements were smaller than
the vector elements.  this means we need to compile the load of the 
array elements into an extract element plus a truncate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 07:12:06 +00:00
Chris Lattner
800de31776 Refactor some code out of ConvertUsesToScalar into their own methods, no
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 07:03:13 +00:00
Chris Lattner
5ebd93630b Folding or(fcmp,fcmp) only works if the operands of the fcmps are the same fp type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 06:09:11 +00:00
Owen Anderson
77db50f68f Fix an issue where GVN had the sizes of the two memcpy's reverse, resulting
in an invalid transformation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 23:06:17 +00:00
Gabor Greif
53bdbd7565 fix http://llvm.org/bugs/show_bug.cgi?id=2097
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 19:13:21 +00:00
Eli Friedman
9ec8095485 Fix for pr2093: direct operands aren't necessarily addresses, so don't
try to simplify them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 18:37:49 +00:00
Bill Wendling
587c01d674 De-tabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 10:53:30 +00:00
Evan Cheng
9bf12b5583 Fix PR2076. CodeGenPrepare now sinks address computation for inline asm memory
operands into inline asm block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47589 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 02:42:37 +00:00
Owen Anderson
c0808a7e1d Fix an issue where GVN was performing the return slot optimization when it was
not safe.  This is fixed by more aggressively checking that the return slot is
not used elsewhere in the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 04:08:09 +00:00
Owen Anderson
0f7ea1ab10 Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 00:40:41 +00:00
Dale Johannesen
22c3979fca Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 22:17:59 +00:00
Zhou Sheng
58d13af6f0 Fixed a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 10:00:35 +00:00
Dan Gohman
b5660dc822 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 16:44:09 +00:00
Anton Korobeynikov
4aefd6b7d4 Fix newly-introduced 4.3 warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 12:07:57 +00:00
Anton Korobeynikov
c6ee8276f3 Get rid of hash_map. Use StringMap instead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:27:49 +00:00
Anton Korobeynikov
07e6e56f57 Make Transforms to be 4.3 warnings-clean
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:26:25 +00:00
Anton Korobeynikov
ae9f3a3b7c Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 11:08:44 +00:00
Owen Anderson
61d30a821f When performing return slot optimization, remember to inform memdep when we're removing the memcpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 08:23:02 +00:00
Dale Johannesen
0d51e7ec0d Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 21:38:47 +00:00
Chris Lattner
75542bd56b remove the LowerSelect pass. The last client was the old Sparc backend, which is long dead by now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:49:17 +00:00
Chris Lattner
15f166c7b6 remove the lower packed pass. It can never work and even the parts that
could work don't work fully.  This fixes PR1705.  Oh yeah, we don't have
packed types anymore either ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:39:17 +00:00
Owen Anderson
967552e7ec Refactor this method a bit, and correct a test that was completely wrong but happened to work out anyways. :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:07:51 +00:00
Chris Lattner
e42ce73c37 isa+cast -> dyncast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:53:20 +00:00
Chris Lattner
0a76a621a4 simplify this code again, try 2 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:52:38 +00:00
Owen Anderson
9cffa9a6ed Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:51:23 +00:00
Owen Anderson
61c24e96b1 Major improvements to yesterday's return slot optimization. Remove some unneccessary constraints,
and add some others that should have been in from the first place.  Document the whole thing better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:35:43 +00:00
Chris Lattner
50b2ca4c73 fdiv/frem of undef can produce undef, because the undef operand
can be a SNaN.  We could be more aggressive and turn this into 
unreachable, but that is less nice, and not really worth it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 06:12:18 +00:00
Owen Anderson
fa113f8155 Factor the profitability check for return slot optimization out into a static function.
At some point in the future, this check will become smarter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:27:34 +00:00
Owen Anderson
c0755a6f98 An sret parameter is required to be the first parameter, so there's no need to loop
over all the parameters of the callee looking for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:15:29 +00:00
Owen Anderson
7acc0af95a Cleanup some of my patches from yesterday. Refactor the check for which xform
to apply to a memcpy into processInstruction.  Also, fix a bug in the check due to
missing braces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 03:09:45 +00:00
Owen Anderson
c2580ab9b0 Fix Transforms/GVN/memcpy.ll, which Chris broke in r47275 by reordering the branches. memcpy's are a kind of CallInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 02:53:23 +00:00
Nick Lewycky
e0cfecf47d Correctly fold divide-by-constant, even when faced with overflow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47287 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 22:48:05 +00:00
Chris Lattner
e10c0b9d66 Transforming -A + -B --> -(A + B) isn't safe for FP, thanks
to Dale for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47276 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:50:16 +00:00
Chris Lattner
913b19f6fc minor code simplification, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:47:29 +00:00
Duncan Sands
548448a317 Simplify caller updating using a CallSite, as
requested by Chris.  While there, do the same
for an existing function committed by someone
called "lattner" :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47273 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 17:32:13 +00:00
Owen Anderson
5aa4f2a085 Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value.  llvm-gcc does not emit this by default.  Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter.  This optimization detects
and optimizes that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 09:24:53 +00:00
Chris Lattner
8244243a31 switch simplifycfg from using vectors for most things to smallvectors,
this speeds it up 2.3% on eon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 07:42:56 +00:00
Chris Lattner
bf1d8a7099 optimize away stackrestore calls that have no intervening alloca or call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 06:12:38 +00:00
Chris Lattner
d5b8d92b9f simplify some code, BreakUpSubtract always returns nonnull now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-18 02:18:25 +00:00
Chris Lattner
dd12f96c5e Fold (-x + -y) -> -(x+y) which promotes better association, fixing
the second half of PR2047


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 21:03:36 +00:00
Chris Lattner
5329bb22e9 fix pasto
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 20:54:40 +00:00
Chris Lattner
0b0803ae15 Split up subtracts into add+negate if they have a reassociable use or operand
that is also a subtract.  This implements PR2047 and Transforms/Reassociate/subtest2.ll 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 20:51:26 +00:00
Chris Lattner
9bc5ed78c8 make the logic for breaking up subtracts more explicit, no
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 20:44:51 +00:00
Duncan Sands
3d5378ff8e Remove any 'nest' parameter attributes if the function
is not passed as an argument to a trampoline intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-16 20:56:04 +00:00
Devang Patel
9d9b204d6a Fix PR2028
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 01:24:49 +00:00
Devang Patel
9b03daa2a3 If loop header is also loop exiting block then OrigPN is incoming value for B loop header.
Fixes PR 2030.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 23:18:47 +00:00
Chris Lattner
8c5c22f610 Fix PR2029
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 19:18:13 +00:00
Chris Lattner
13daadbd25 simplify code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:39:01 +00:00
Nick Lewycky
95f0ba2703 Fix PR2032. Inform the alias analysis of changes to the underlying program.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:11:24 +00:00
Devang Patel
ea06906559 A loop latch phi node may have uses inside loop, not just in loop header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:23:07 +00:00
Dan Gohman
7649127ec1 Rename APInt's isPositive to isNonNegative, to reflect what it
actually does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:09:18 +00:00
Devang Patel
23067dfeac While moving exit condition, do not drop loop latch on the floor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:06:36 +00:00
Devang Patel
02c4836f3d Keep track of exit value operand number when operands are swapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 19:48:48 +00:00
Chris Lattner
eedcf3fc46 remove some dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 17:18:26 +00:00
Owen Anderson
30b4bd4d10 Re-apply the patch to improve the optimizations of memcpy's, with several
bugs fixed.  This now passes PPC bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 21:15:18 +00:00
Eli Friedman
b6c36e4058 Fix for bug 1996: optimize out loads of undef. This code basically just
checks for a malloc/alloca immediately followed by a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 12:08:14 +00:00
Chris Lattner
916c954bf2 Fix scalarrepl to not 'miscompile' undefined code, part #2.
This fixes the store case, my previous patch just fixed the load
case.  rdar://5707076.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 19:05:37 +00:00
Devang Patel
82ada54da0 Fix PR 1995.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:49:13 +00:00
Bill Wendling
e00fec554b Temporarily reverting:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html

This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 20:03:07 +00:00
Chris Lattner
2663ffe751 Make RenamePass faster by making the 'is this a new phi node'
check more intelligent.  This speeds up mem2reg from 5.29s to 
0.79s on a synthetic testcase with tons of predecessors and
phi nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 21:26:23 +00:00
Chris Lattner
7c95debb49 Fix a bug compiling PR1978 (perhaps not the only one though) which
was incorrectly simplifying "x == (gep x, 1, i)" into false, even 
though i could be negative.  As it turns out, all the code to 
handle this already existed, we just need to disable the incorrect
optimization case and let the general case handle it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 04:45:32 +00:00
Owen Anderson
c69ace3a64 Be more precise when eliminating pointers bue to memcpy's. This allows more
stores to be deleted in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 04:53:00 +00:00
Owen Anderson
6f7a52d300 Allow GVN to hack on memcpy's, making them open to further optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 02:59:58 +00:00
Nick Lewycky
5be2920149 There are some cases where icmp(add) can be folded into a new icmp. Handle them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 16:33:09 +00:00
Nick Lewycky
0c2c3f6e81 Hack on vectors too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 08:19:11 +00:00
Nick Lewycky
b6eabff169 Fold away one multiply in instcombine. This would normally be caught in
reassociate anyways, but they could be generated during instcombine's run.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:42:09 +00:00
Duncan Sands
532d022794 Don't drop function/call return attributes like 'nounwind'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 20:37:16 +00:00
Nick Lewycky
b4b0417220 Remove a couple more cases of "getNumUses() == 0". No need to walk the linked
list just to see if whether the list is empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 08:01:28 +00:00
Nick Lewycky
c7444498ee Use empty() instead of comparing size() with zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 07:54:16 +00:00
Nick Lewycky
d29ce1783c Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 07:45:37 +00:00
Owen Anderson
772601a885 Make DSE much more aggressive by performing DCE earlier. Update a testcase to reflect this increased aggressiveness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 01:24:47 +00:00
Chris Lattner
b10e0da065 Fix a bug where scalarrepl would discard offset if type would match.
In practice this can only happen on code with already undefined behavior, 
but this is still a good thing to handle correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46539 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 00:39:15 +00:00
Chris Lattner
c69d3c9442 Don't let globalopt hack on volatile loads or stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 19:01:37 +00:00