Commit Graph

6591 Commits

Author SHA1 Message Date
Gabor Greif
8a8a4350db performance: get rid of repeated dereferencing of use_iterator by caching its result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100550 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:32:30 +00:00
Gabor Greif
6ce02b5939 make more two predicates constant
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100549 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:24:18 +00:00
Gabor Greif
a01d6db569 performance: get rid of repeated dereferencing of use_iterator by caching its result
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 19:14:05 +00:00
Gabor Greif
0b520db74d const-ize predicate ValueIsOnlyUsedLocallyOrStoredToOneGlobal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 18:58:22 +00:00
Gabor Greif
fa1f5c22c5 use CallSite to access calls vs. invokes uniformly
and remove assumptions about operand order

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 18:45:08 +00:00
Chris Lattner
e597f00e1a fix a really nasty bug that Evan was tracking in SCCP. When resolving
undefs in branches/switches, we have two cases: a branch on a literal
undef or a branch on a symbolic value which is undef.  If we have a
literal undef, the code was correct: forcing it to a constant is the
right thing to do.

If we have a branch on a symbolic value that is undef, we should force
the symbolic value to a constant, which then makes the successor block
live.  Forcing the condition of the branch to being a constant isn't 
safe if later paths become live and the value becomes overdefined.  This
is the case that 'forcedconstant' is designed to handle, so just use it.

This fixes rdar://7765019 but there is no good testcase for this, the
one I have is too insane to be useful in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 22:14:48 +00:00
Chris Lattner
9e185800c0 some code cleanups, use SwitchInst::findCaseValue, reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 21:18:32 +00:00
Evan Cheng
0f1666b480 Code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100467 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 21:16:25 +00:00
Mon P Wang
20adc9dc46 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-04 03:10:48 +00:00
Chris Lattner
d52c072777 require that the branch being controlled by the IV
exits the loop.  With this information we can guarantee 
the iteration count of the loop is bounded by the 
compare.  I think this xforms is finally safe now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100285 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 07:21:39 +00:00
Chris Lattner
96fd76638b add integer overflow check for the fp induction variable
checker.  Amusingly, we already had tests that we should
have rejects because they would be miscompiled in the
testsuite.

The remaining issue with this is that we don't check that
the branch causes us to exit the loop if it fails, so we
don't actually know if we remain in bounds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100284 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 07:18:48 +00:00
Chris Lattner
bbb91498da add a comment and fix some consistency issues, converting
to a signed vs unsigned value depending on the sign of the
constant fp means that we can't distinguish between a 
truly negative number and a positive number so large the
32nd bit is set.  So, do don't this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100283 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:41:49 +00:00
Chris Lattner
43b85273ee fix PR6761, a miscompilation due to the fp->int IV conversion
stuff.  More bugs remain though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:30:03 +00:00
Chris Lattner
a40e4a0c8a just eliminate the uitofp checks. This code isn't doing
the required validity checks in the first place, and supporting
a condition large enough to require the 32'nd bit isn't worth it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100280 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:25:21 +00:00
Chris Lattner
c91961e31b rename PH -> PN to be consistent with WeakPN and the rest
of llvm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:17:08 +00:00
Chris Lattner
70c0d4f7eb improve comment and drop a dead check. If PH had
no uses, it would have been deleted by 
RecursivelyDeleteTriviallyDeadInstructions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:16:22 +00:00
Chris Lattner
9698c1985f strength reduce a ridiculous use of APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:13:12 +00:00
Chris Lattner
ca703bd56b rename stuff improve comment grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:11:07 +00:00
Chris Lattner
fa405af58a simplify some code and resolve a fixme.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:06:59 +00:00
Chris Lattner
c4f7e8061d There is no guarantee that the increment and the branch
are in the same block.  Insert the new increment in the
correct location.

Also, more cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 06:05:10 +00:00
Chris Lattner
07aa76ad93 first half of a pass through IndVarSimplify::HandleFloatingPointIV,
this cleans up a bunch of code and also fixes several crashes and
miscompiles.  More to come unfortunately, this optimization
is quite broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 05:54:59 +00:00
Chris Lattner
8e9c48a606 don't internalize available_externally functions, they are
really just declarations.  This is related to PR6524


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 05:24:50 +00:00
Bob Wilson
49c283fd3f Revert all my SSAUpdater patches. The PHI placement algorithm is not correct
(what was I thinking?) and there's also a problem with LCSSA.  I'll try again
later with fixes.

--- Reverse-merging r100263 into '.':
U    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100177 into '.':
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100148 into '.':
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100147 into '.':
U    include/llvm/Transforms/Utils/SSAUpdater.h
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100131 into '.':
G    include/llvm/Transforms/Utils/SSAUpdater.h
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100130 into '.':
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100126 into '.':
G    include/llvm/Transforms/Utils/SSAUpdater.h
G    lib/Transforms/Utils/SSAUpdater.cpp
--- Reverse-merging r100050 into '.':
D    test/Transforms/GVN/2010-03-31-RedundantPHIs.ll
--- Reverse-merging r100047 into '.':
G    include/llvm/Transforms/Utils/SSAUpdater.h
G    lib/Transforms/Utils/SSAUpdater.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 03:50:38 +00:00
Bob Wilson
4cc3c26834 Add a DEBUG_TYPE for the SSAUpdater.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100263 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 03:28:44 +00:00
Evan Cheng
0272024210 Code refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-03 02:23:43 +00:00
Mon P Wang
e754d3fb85 Revert r100191 since it breaks objc in clang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:43:02 +00:00
Mon P Wang
e33c848fa4 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100191 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 18:04:15 +00:00
Dan Gohman
d7bfd0028b Manually notify ScalarEvolution before making an operand replacement, since
it can't currently observe such changes automatically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 14:48:31 +00:00
Bob Wilson
6682048206 Recommit 100158 now that the buildbots are happy again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100177 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 05:09:46 +00:00
Dan Gohman
f860db2398 Revert the recent alignment changes. They're broken for -Os because,
in particular, they end up aligning strings at 16-byte boundaries, and
there's no way for GlobalOpt to check OptForSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 03:04:37 +00:00
Bob Wilson
5ea6352fcd Revert 100158 in case it is causing some of the buildbot problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 01:22:49 +00:00
Dan Gohman
c9ae19e465 Make globalopt refine global variable alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 00:14:16 +00:00
Bob Wilson
ec54d6ab84 Check for terminating conditions before adding PHIs to the worklists.
This is more efficient than adding them to the worklist and then ignoring them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 00:10:41 +00:00
Bob Wilson
7272b92009 Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 23:06:38 +00:00
Bob Wilson
6f69035970 Rewrite another SSAUpdater function to avoid recursion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 23:05:58 +00:00
Bob Wilson
33f22e8c66 Change another SSAUpdater function to avoid recursion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 20:04:30 +00:00
Bob Wilson
9bdb8f0717 Simplify the code to check for existing PHIs, now that it is only used in
one place.  This removes the template function added in svn 94690.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 19:53:48 +00:00
Bob Wilson
e8b64281ce The SSAUpdater should avoid recursive traversals of the CFG, since that may
blow out the stack for really big functions.  Start by fixing an easy case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 18:46:59 +00:00
Gabor Greif
c8b82ccbcf Introduce ImmutableCallSite, useful for contexts where no mutation
is necessary. Inherits from new templated baseclass CallSiteBase<>
which is highly customizable. Base CallSite on it too, in a configuration
that allows full mutation.
Adapt some call sites in analyses to employ ImmutableCallSite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 08:21:08 +00:00
Nick Lewycky
2d7820cb78 Clean up this file a little, no functionality change. This is a subset of my
patch back in r94322.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01 07:34:00 +00:00
Bob Wilson
a0c6057061 Rewrite part of the SSAUpdater to be more careful about inserting redundant
PHIs.  The previous algorithm was unable to reliably detect when existing
PHIs in a cycle can be reused.  I'm still working on reducing a testcase.
Radar 7711900.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 20:51:00 +00:00
Dale Johannesen
536d31b5b3 Fix a nasty dangling-pointer heisenbug that could
generate wrong code pretty much anywhere AFAICT.
A case that hits the bug reproducibly is impossible,
but the situation was like this:
Addr = ...
Store -> Addr
Addr2 = GEP , 0, 0
Store -> Addr2
Handling the first store, the code changed replaced Addr
with a sunkaddr and deleted Addr, but not its table
entry.  Code in OptimizedBlock replaced Addr2 with a
bitcast; if that happened to reuse the memory of Addr,
the old table entry was erroneously found when handling
the second store.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 20:37:15 +00:00
Bob Wilson
100f090add Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:27:04 +00:00
Mon P Wang
808bab0169 Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:55:56 +00:00
Dan Gohman
4bb31bfaa3 Fix a grammaro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 20:04:57 +00:00
Gabor Greif
bd44314c67 fix two cases where the arguments were extracted from the wrong range out of the InvokeInst
spotted by baldrick -- thanks\!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 19:20:53 +00:00
Jeffrey Yasskin
0826e1c519 Remove another memory leak from ABCD by using Edges by value instead of
pointer.  There was also a SmallPtrSet whose settiness wasn't being used, so I
changed it to a SmallVector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 09:09:17 +00:00
Jeffrey Yasskin
e9580bf254 In ABCD, change the non-null Bound*s to Bound&s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99711 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 08:15:46 +00:00
Jeffrey Yasskin
2f97b46f7b Fix a memory leak in ABCD by giving ownership of Bound objects to the
MemoizedResultChart.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 08:09:24 +00:00
Eric Christopher
6fde0bd39b When we promote a load of an argument make sure to take the alignment
of the previous load - it's usually important.  For example, we don't want
to blindly turn an unaligned load into an aligned one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 01:54:00 +00:00