1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

1683 Commits

Author SHA1 Message Date
Dan Gohman
1521831bff Teach ScalarEvolution to simplify smax and umax when it can prove
that one operand is always greater than another.

llvm-svn: 101142
2010-04-13 16:51:03 +00:00
Dan Gohman
a83b45d7b5 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.

llvm-svn: 101113
2010-04-13 01:46:36 +00:00
Dan Gohman
ba53e85cc3 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.

llvm-svn: 101068
2010-04-12 21:13:43 +00:00
Eric Christopher
6b38179ee2 Verify function prototypes before trying to optimize functions. We also
need TargetData, just return false if we don't have it.

Update testcases accordingly.

Fixes PR6807.

llvm-svn: 101011
2010-04-12 04:48:00 +00:00
Dan Gohman
dff42439b2 Re-apply r101000, with a fix: Don't eliminate an icmp which is part of
the loop exit test. This usually doesn't come up for a variety of
reasons, but it isn't impossible, so make IndVarSimplify handle it
conservatively.

llvm-svn: 101008
2010-04-12 02:21:50 +00:00
Dan Gohman
97a1bdfafc Revert 101000, which is breaking self-host builds.
llvm-svn: 101002
2010-04-12 00:17:10 +00:00
Dan Gohman
7e250afcfa Teach IndVarSimplify how to eliminate comparisons involving induction
variables. For example, with code like this:

  for (i=0;i<n;++i)
    if (i<n)
      x[i] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the if.

llvm-svn: 101000
2010-04-11 23:10:12 +00:00
Chris Lattner
92b4e858d0 fix PR6743, a case where we'd delete an instruction before using it
in some cases.

llvm-svn: 100937
2010-04-10 18:26:57 +00:00
Chris Lattner
c5ee900be8 fix PR6760, a missing check in heap SRoA.
llvm-svn: 100936
2010-04-10 18:19:22 +00:00
Dan Gohman
67e02ffd79 When determining a canonical insert position, don't climb deeper
into adjacent loops. Also, ensure that the insert position is
dominated by the loop latch of any loop in the post-inc set which
has a latch.

llvm-svn: 100906
2010-04-09 22:07:05 +00:00
Dan Gohman
e36761b7d0 When emitting code for an add, don't force a SCEVUnknown wrapper around
a hoisted intermediate result if the intermediate result isn't an
Instruction.

llvm-svn: 100884
2010-04-09 19:14:31 +00:00
Dan Gohman
853ff6b580 Fix a bug in IVUsers which was permitting non-affine addrecs to
be sent to LSR, which it isn't prepared to handle.

llvm-svn: 100839
2010-04-09 01:22:56 +00:00
Chris Lattner
08fed5e338 fix a SCCP miscompilation that could happen when a
forced constant is changed to a constant, we would end
up adding the instruction to the wrong worklist, 
preventing it from being properly revisited.  This fixes
rdar://7832370

llvm-svn: 100837
2010-04-09 01:14:31 +00:00
Dan Gohman
5bf62639ed Print empty structs as {} rather than { }.
llvm-svn: 100787
2010-04-08 18:03:05 +00:00
Chris Lattner
23334439e9 add newlines at the end of files.
llvm-svn: 100705
2010-04-07 22:53:17 +00:00
Dan Gohman
b5210c934f Generalize IVUsers to track arbitrary expressions rather than expressions
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.

This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.

This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.

llvm-svn: 100699
2010-04-07 22:27:08 +00:00
Mon P Wang
484bbe6aa9 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)

llvm-svn: 100304
2010-04-04 03:10:48 +00:00
Chris Lattner
065798cd82 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.

llvm-svn: 100284
2010-04-03 07:18:48 +00:00
Chris Lattner
a8c9d26ea1 fix PR6761, a miscompilation due to the fp->int IV conversion
stuff.  More bugs remain though.

llvm-svn: 100282
2010-04-03 06:30:03 +00:00
Chris Lattner
c13dd4f035 convert to filecheck
llvm-svn: 100281
2010-04-03 06:27:56 +00:00
Chris Lattner
e1f0cf628b rename feature test.
llvm-svn: 100279
2010-04-03 06:24:28 +00:00
Chris Lattner
4d6928d1c7 actually just remove this, will move the real feature test here.
llvm-svn: 100278
2010-04-03 06:24:03 +00:00
Chris Lattner
17259c40aa rename test since it is a feature test.
llvm-svn: 100277
2010-04-03 06:22:52 +00:00
Chris Lattner
5c2f2edd08 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.

llvm-svn: 100270
2010-04-03 05:54:59 +00:00
Bob Wilson
5a3200f750 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

llvm-svn: 100264
2010-04-03 03:50:38 +00:00
Mon P Wang
0ccf050ca3 Revert r100191 since it breaks objc in clang
llvm-svn: 100199
2010-04-02 18:43:02 +00:00
Mon P Wang
a01350755e 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)

llvm-svn: 100191
2010-04-02 18:04:15 +00:00
Dan Gohman
8835a0200a Manually notify ScalarEvolution before making an operand replacement, since
it can't currently observe such changes automatically.

llvm-svn: 100186
2010-04-02 14:48:31 +00:00
Dan Gohman
7051600e3f 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.

llvm-svn: 100172
2010-04-02 03:04:37 +00:00
Dan Gohman
ece7e3c015 Make globalopt refine global variable alignment.
llvm-svn: 100160
2010-04-02 00:14:16 +00:00
Bob Wilson
b66bed7e3c Add a redundant PHI testcase for SSAUpdater to go with svn r100047.
llvm-svn: 100050
2010-03-31 21:38:43 +00:00
Gabor Greif
b7ecfb134b testcase for r99914, provided by baldrick!
llvm-svn: 100043
2010-03-31 20:37:13 +00:00
Bob Wilson
aae933cc81 Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
llvm-svn: 99948
2010-03-30 22:27:04 +00:00
Mon P Wang
9351ea594a 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.

llvm-svn: 99928
2010-03-30 20:55:56 +00:00
Chris Lattner
1d47291927 fix PR6642, GVN forwarding from memset to load of the base of the memset.
llvm-svn: 99488
2010-03-25 05:58:19 +00:00
Eric Christopher
b3abae8852 Reapply r99451 with a fix to move the NoInline check to the cost functions
instead of InlineFunction.

llvm-svn: 99483
2010-03-25 04:49:10 +00:00
Eric Christopher
e293604548 Temporarily revert this, it's causing an issue with an internal project.
llvm-svn: 99451
2010-03-24 23:35:21 +00:00
Chris Lattner
a9eb6a6987 add some accessors to callsite/callinst/invokeinst to check
for the noinline attribute, and make the inliner refuse to
inline a call site when the call site is marked noinline even
if the callee isn't.  This fixes PR6682.

llvm-svn: 99341
2010-03-23 22:59:07 +00:00
Evan Cheng
1144c23330 Teach simplify libcall to transform __strcpy_chk to __memcpy_chk to enable optimizations down stream.
llvm-svn: 99282
2010-03-23 15:48:04 +00:00
Evan Cheng
a544f02286 Fix an incorrect logic causing instcombine to miss some _chk -> non-chk transformations.
llvm-svn: 99263
2010-03-23 06:06:09 +00:00
Evan Cheng
34c5c9af6f Fix a typo in ValueTracking that's causing instcombine to delete needed shift instructions.
llvm-svn: 98416
2010-03-13 02:20:29 +00:00
Duncan Sands
01532e804a When constant folding GEP of GEP, do not crash if an index of
the inner GEP is not a ConstantInt.

llvm-svn: 98359
2010-03-12 17:55:20 +00:00
Dan Gohman
c421549beb Make isLCSSA ignore uses in blocks not reachable from the entry block,
as LCSSA no longer transforms such uses.

llvm-svn: 98033
2010-03-09 01:53:33 +00:00
Evan Cheng
db47eab2a3 Re-commit 97860 with fix. getMallocAllocatedType may return null.
llvm-svn: 98000
2010-03-08 22:54:36 +00:00
Eric Christopher
a671e4f7aa Migrate _chk call lowering from SimplifyLibCalls to InstCombine. Stub
out the remainder of the calls that we should lower in some way and
move the tests to the new correct directory. Fix up tests that are now
optimized more than they were before by -instcombine.

llvm-svn: 97875
2010-03-06 10:50:38 +00:00
Eric Christopher
b3f0926f84 Temporarily revert:
Log:
Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.

Modified:
   llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
   llvm/trunk/test/Transforms/InstCombine/objsize.ll

It appears to be causing swb and nightly test failures.

llvm-svn: 97866
2010-03-06 03:11:35 +00:00
Evan Cheng
071e007ce6 Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
llvm-svn: 97860
2010-03-06 01:01:42 +00:00
Evan Cheng
3346ea1d4e Safely turn memset_chk etc. to non-chk variant if the known object size is >= memset / memcpy / memmove size.
llvm-svn: 97828
2010-03-05 20:59:47 +00:00
Evan Cheng
782183fe4a Instcombine should turn llvm.objectsize of a alloca with static size to an integer.
llvm-svn: 97827
2010-03-05 20:47:23 +00:00
Chris Lattner
789121d6e2 fix PR6512, a case where instcombine would incorrectly merge loads
from different addr spaces.

llvm-svn: 97813
2010-03-05 18:53:28 +00:00