Commit Graph

2977 Commits

Author SHA1 Message Date
Dan Gohman
f284ce203b Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 00:08:39 +00:00
Dan Gohman
97b6e2cc99 LoopIndexSplit doesn't actually use ScalarEvolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 20:50:11 +00:00
Dan Gohman
60f8a63e25 Add a method to ScalarEvolution for telling it when a loop has been
modified in a way that may effect the trip count calculation. Change
IndVars to use this method when it rewrites pointer or floating-point
induction variables instead of using a doInitialization method to
sneak these changes in before ScalarEvolution has a chance to see
the loop. This eliminates the need for LoopPass to depend on
ScalarEvolution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 20:49:49 +00:00
Chris Lattner
a84f47c3e7 commit a tweaked version of Daniel's patch for PR3599. We now
eliminate all the extensions and all but the one required truncate
from the testcase, but the or/and/shift stuff still isn't zapped.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 20:47:23 +00:00
Dan Gohman
cafb81337b Delete trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 19:13:57 +00:00
Dan Gohman
a575871884 Fix 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 15:57:39 +00:00
Evan Cheng
5a6c1a840a Strengthen the "non-constant stride must dominate loop preheader" check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:13:06 +00:00
Dan Gohman
1a5e936c53 Simplify; fix some 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:10:53 +00:00
Dan Gohman
ecd0fb51cb Fix EnforceKnownAlignment so that it doesn't ever reduce the alignment
of an alloca or global variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 23:02:21 +00:00
Dan Gohman
ebcd4af387 Delete this long-commented-out code. The situation it seems to have
been written for is no longer relevant with the elimination of
signed and unsigned types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 02:57:42 +00:00
Dan Gohman
926b0a27b9 Change these tests to use regular loads instead of llvm.x86.sse2.loadu.dq.
Enhance instcombine to use the preferred field of
GetOrEnforceKnownAlignment in more cases, so that regular IR operations are
optimized in the same way that the intrinsics currently are.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 00:44:23 +00:00
Nick Lewycky
225f747486 Update the list of function annotations for nocapture. All of these came up
when I was looking at functions used by python.

Highlights include, better largefile support (64-bit file sizes on 32-bit
systems), fputs string is nocapture, popen/pclose added (popen being noalias
return), modf and frexp and friends. Also added some missing 'break' statements
and combined identical sections.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 22:47:25 +00:00
Evan Cheng
8f40afe62d Fix pr3571: If stride is a value defined by an instruction, make sure it dominates the loop preheader. When IV users are strength reduced, the stride is inserted into the preheader. It could create a use before def situation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 06:06:15 +00:00
Evan Cheng
f8546f10c2 ifdef out unneeded if statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 03:20:37 +00:00
Dan Gohman
aa03649af2 Extend the IndVarSimplify support for promoting induction variables:
- Test for signed and unsigned wrapping conditions, instead of just
   testing for non-negative induction ranges. 
 - Handle loops with GT comparisons, in addition to LT comparisons.
 - Support more cases of induction variables that don't start at 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64532 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 02:31:09 +00:00
Dan Gohman
f108e2eaaa Clarify debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64531 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 02:26:50 +00:00
Dan Gohman
cd3eb9b098 Simplify some code. hasComputableLoopEvolution is overkill in this case.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 02:25:19 +00:00
Dan Gohman
03ce042d70 In CodeGenPrepare's debug output, use WriteAsOperand instead of
printing getName(), so that unnamed values are printed correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64468 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:45:12 +00:00
Dan Gohman
e698696569 Complete the sentance in this comment. I have reservations
about the code it describes, but at least now the comment
is right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64465 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:36:42 +00:00
Nick Lewycky
02b6a6a75f Mark strto* as readonly when the endptr is null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:08:33 +00:00
Nick Lewycky
4c49841f34 On strtod and friends, mark 'endptr' nocapture in the function prototype, and
mark the first argument nocapture if endptr=NULL for each particular call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 15:31:46 +00:00
Dan Gohman
9194e8b0c8 Fix the code that checked if a SCEVAddRecExpr Start contains an
addrec in a different loop to check the value being added to
the accumulated Start value, not the Start value before it has
the new value added to it. This prevents LSR from going crazy
on the included testcase. Dale, please review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 03:58:31 +00:00
Dan Gohman
bc511725f0 Fix LSR's IV sorting function to explicitly sort by bitwidth
after sorting by stride value. This prevents it from missing
IV reuse opportunities in a host-sensitive manner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:26:43 +00:00
Dan Gohman
c2390b14c9 Teach IndVarSimplify to optimize code using the C "int" type for
loop induction on LP64 targets. When the induction variable is
used in addressing, IndVars now is usually able to inserst a
64-bit induction variable and eliminates the sign-extending cast.
This is also useful for code using C "short" types for
induction variables on targets with 32-bit addressing.

Inserting a wider induction variable is easy; the tricky part is
determining when trunc(sext(i)) expressions are no-ops. This
requires range analysis of the loop trip count. A common case is
when the original loop iteration starts at 0 and exits when the
induction variable is signed-less-than a fixed value; this case
is now handled.

This replaces IndVarSimplify's OptimizeCanonicalIVType. It was
doing the same optimization, but it was limited to loops with
constant trip counts, because it was running after the loop
rewrite, and the information about the original induction
variable is lost by that point.

Rename ScalarEvolution's executesAtLeastOnce to
isLoopGuardedByCond, generalize it to be able to test for
ICMP_NE conditions, and move it to be a public function so that
IndVars can use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 22:19:27 +00:00
Dan Gohman
c83324682f Add a utility function to LoopInfo to return the exit block
when the loop has exactly one exit, and make use of it in
LoopIndexSplit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64388 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 18:08:24 +00:00
Dan Gohman
d0ffa73924 This code doesn't actually use the ExitingBlocks list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 16:36:26 +00:00
Chris Lattner
0aefc0eb2c improve naming of values in GVN, patch by Jay Foad!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 07:00:35 +00:00
Chris Lattner
65c02fbf9b fix PR3537: if resetting bbi back to the start of a block, we need to
forget about already inserted expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 06:56:08 +00:00
Nick Lewycky
b7c9eeeede Don't mark all args to strtod and friends as nocapture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 03:18:34 +00:00
Nate Begeman
7b25467d06 the two non-mask arguments to a shufflevector must be the same width, but they do not have to be the same
width as the result value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 22:36:25 +00:00
Devang Patel
7afe8fa066 Use early exits. Reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 19:28:07 +00:00
Devang Patel
4afc90dacf Enable scalar replacement of AllocaInst whose one of the user is dbg info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 07:00:59 +00:00
Dale Johannesen
1de17d574c Fix PR 3471, and some cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 22:14:15 +00:00
Bill Wendling
b805030e02 Mistakenly turned this on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 01:32:00 +00:00
Bill Wendling
7f51fd3ea9 Revert r63999. It was breaking self-hosting builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 00:58:05 +00:00
Mon P Wang
6753f959d2 Instrcombine should not change load(cast p) to cast(load p) if the cast
changes the address space of the pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 22:19:29 +00:00
Mike Stump
f344d83d39 Insert space to avoid warning and make code more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64003 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 03:36:02 +00:00
Devang Patel
d96c60df3f Ignore DbgInfoIntrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 06:19:06 +00:00
Chris Lattner
e991ced7cb fix PR3489, use bits instead of bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63916 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 04:34:07 +00:00
Devang Patel
32d9701d68 Ignore dbg intrinsics while propagating conditional expression info. Take 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 23:32:52 +00:00
Devang Patel
998cbb0444 Revert rev. 63876. It is causing llvm-gcc bootstrap failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 21:46:41 +00:00
Devang Patel
39c873e38f Remove dead blocks in the end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 19:59:42 +00:00
Devang Patel
1851db6b0f Ignore dbg intrinsics while propagating conditional expression info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 19:15:39 +00:00
Devang Patel
28aa5de050 If "optimize for size" attribute is set then block non-trivial loop unswitches but allow trivial loop unswitches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 22:04:27 +00:00
Chris Lattner
1aa7056b13 teach "convert from scalar" to handle loads of fca's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 21:08:45 +00:00
Chris Lattner
6e01115bb1 refactor the interface to ConvertUsesOfLoadToScalar,
renaming it to ConvertScalar_ExtractValue


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 21:01:03 +00:00
Chris Lattner
9bc67da0a9 convert ConvertUsesOfLoadToScalar to use IRBuilder,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63652 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 19:45:44 +00:00
Chris Lattner
65a650291d switch ConvertScalar_InsertValue to use an IRBuilder, no
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 19:41:50 +00:00
Chris Lattner
9b872db775 make scalar conversion handle stores of first class
aggregate values.  loads are not yet handled (coming
soon to an sroa near you).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 19:30:11 +00:00
Chris Lattner
1a3257bbf5 Make SROA produce a vector only when the alloca is actually
accessed at least once as a vector.  This prevents it from
compiling the example in not-a-vector into:

define double @test(double %A, double %B) {
	%tmp4 = insertelement <7 x double> undef, double %A, i32 0
	%tmp = insertelement <7 x double> %tmp4, double %B, i32 4
	%tmp2 = extractelement <7 x double> %tmp, i32 4
	ret double %tmp2
}

instead, producing the integer code.  Producing vectors when they
aren't otherwise in the program is dangerous because a lot of other
code treats them carefully and doesn't want to break them down.
OTOH, many things want to break down tasty i448's.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 18:15:05 +00:00