Commit Graph

291 Commits

Author SHA1 Message Date
Duncan Sands ad0ea2d430 Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Nick Lewycky cdb7e54ca7 Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner c00e8adfe0 Implement PR1822
llvm-svn: 44318
2007-11-25 21:27:53 +00:00
Duncan Sands 185eeac0f8 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.

llvm-svn: 44315
2007-11-25 14:10:56 +00:00
Chris Lattner 893fe3bbd1 Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Duncan Sands 8a3e9d2bee Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.

llvm-svn: 44288
2007-11-23 19:30:27 +00:00
Chris Lattner a8fbde3f78 Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.

llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Chris Lattner 1985d96dc9 Fix PR1817.
llvm-svn: 44284
2007-11-22 23:47:13 +00:00
Duncan Sands a915b538d3 Turn invokes of nounwind functions into ordinary calls.
llvm-svn: 44280
2007-11-22 22:24:59 +00:00
Duncan Sands 1c97d752df Readonly/readnone functions are allowed to throw
exceptions, so don't turn invokes of them into
calls.

llvm-svn: 44278
2007-11-22 21:40:06 +00:00
Chris Lattner c53b18362a Fix PR1800 by correcting mistaken logic.
llvm-svn: 44188
2007-11-16 06:04:17 +00:00
Chris Lattner a77e74edba Implement PR1796 and Transforms/SimplifyCFG/noreturn-call.ll
by inserting unreachable after no-return calls.

llvm-svn: 44099
2007-11-14 06:19:25 +00:00
Chris Lattner f150ace6cb upgrade test
llvm-svn: 44067
2007-11-13 21:42:48 +00:00
Chris Lattner 61ce4dff7a Implement PR1786 by iterating between dead cycle elimination
and simplifycfg in the rare cases when it is needed.

llvm-svn: 44044
2007-11-13 07:32:38 +00:00
Chris Lattner f9c0fd7488 Tighten up a check for folding away loads from (newly constant) globals. This
fixes a crash on Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll and 
rdar://5585488.

llvm-svn: 43949
2007-11-09 17:33:02 +00:00
Andrew Lenharth 19ca5c7021 Better check
llvm-svn: 43897
2007-11-08 18:45:15 +00:00
Andrew Lenharth 8cf11aa330 Fix PR1780
llvm-svn: 43893
2007-11-08 17:39:28 +00:00
Chris Lattner d8515f8e80 Implement PR1777 by detecting dependent phis that
all compute the same value.

llvm-svn: 43777
2007-11-06 21:52:06 +00:00
Dan Gohman 4decbc5002 Fix an abort in instcombine when folding creates a vector rem instruction.
llvm-svn: 43743
2007-11-05 23:16:33 +00:00
Devang Patel b98d2050a2 If a value is incoming from outside the loop then the value does not need remapping and the value is never tracked through LastValueMap.
llvm-svn: 43728
2007-11-05 19:32:30 +00:00
Duncan Sands 399d97987b Change uses of getTypeSize to getABITypeSize, getTypeStoreSize
or getTypeSizeInBits as appropriate in ScalarReplAggregates.
The right change to make was not always obvious, so it would
be good to have an sroa guru review this.  While there I noticed
some bugs, and fixed them: (1) arrays of x86 long double have
holes due to alignment padding, but this wasn't being spotted
by HasStructPadding (renamed to HasPadding).  The same goes
for arrays of oddly sized ints.  Vectors also suffer from this,
in fact the problem for vectors is much worse because basic
vector assumptions seem to be broken by vectors of type with
alignment padding.   I didn't try to fix any of these vector
problems.  (2) The code for extracting smaller integers from
larger ones (in the "int union" case) was wrong on big-endian
machines for integers with size not a multiple of 8, like i1.
Probably this is impossible to hit via llvm-gcc, but I fixed
it anyway while there and added a testcase.  I also got rid of
some trailing whitespace and changed a function name which
had an obvious typo in it.

llvm-svn: 43672
2007-11-04 14:43:57 +00:00
Owen Anderson 2ed651ace7 Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been
silently failing because of an incorrect run line for some time.

llvm-svn: 43605
2007-11-01 05:29:16 +00:00
Chris Lattner 6ab19ed78d Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.

llvm-svn: 43597
2007-11-01 02:30:35 +00:00
Chris Lattner 74709473ed Fix InstCombine/2007-10-31-RangeCrash.ll
llvm-svn: 43596
2007-11-01 02:18:41 +00:00
Dan Gohman 9f39660c20 Add support for folding binary operators with vector zero operands.
llvm-svn: 43510
2007-10-30 19:00:49 +00:00
Chris Lattner 00860d7574 update testcase
llvm-svn: 43452
2007-10-29 17:06:35 +00:00
Chris Lattner c541c3ee15 Model stacksave and stackrestore as both writing memory, since we
don't model their dependences on allocas correctly.  This fixes
PR1745.

llvm-svn: 43442
2007-10-29 05:47:52 +00:00
Chris Lattner 9a641510bd Fix PR1749 and InstCombine/2007-10-28-EmptyField.ll by handling
zero-length fields better.

llvm-svn: 43427
2007-10-29 02:40:02 +00:00
Chris Lattner 4a15e04aee Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators
can have uses too.  Wouldn't it be nice if invoke didn't exist? :)

llvm-svn: 43426
2007-10-29 02:30:37 +00:00
Chris Lattner c62877e9da Implement a couple of foldings for ordered and unordered comparisons,
implementing cases related to PR1738.

llvm-svn: 43289
2007-10-24 05:38:08 +00:00
Bill Wendling ac5c93040f Don't branch fold inline asm statements.
llvm-svn: 43191
2007-10-19 21:09:55 +00:00
Devang Patel c0ced49a14 This test now passes.
llvm-svn: 43183
2007-10-19 17:11:01 +00:00
Chris Lattner 9715d9fb59 Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by
fixing some obviously broken code :(

llvm-svn: 43141
2007-10-18 18:49:29 +00:00
Devang Patel 9497767458 XFAIL for now.
llvm-svn: 43111
2007-10-18 00:48:43 +00:00
Devang Patel b3dac3f5d9 Do not raise free() call that is called through invoke instruction.
llvm-svn: 43083
2007-10-17 20:12:58 +00:00
Devang Patel 91ff13edcc Apply "Instead of loading small c string constant, use integer constant directly" transformation while processing load instruction.
llvm-svn: 43070
2007-10-17 07:24:40 +00:00
Chris Lattner ad618f66e6 Fix a bug in my patch last night that broke InstCombine/2007-10-12-Crash.ll
llvm-svn: 42920
2007-10-12 18:05:47 +00:00
Chris Lattner 3e99eb25ee testcase for PR1728
llvm-svn: 42890
2007-10-12 05:29:53 +00:00
Devang Patel 899cc56612 Lower memcpy if it makes sense.
llvm-svn: 42864
2007-10-11 17:21:57 +00:00
Devang Patel a69f987b66 Fix bug in updating dominance frontier after loop
unswitch when frontier includes basic blocks that 
are not inside loop.

llvm-svn: 42654
2007-10-05 22:29:34 +00:00
Devang Patel 2a60ff1aeb Relax unsafe use check. If there is one unconditional use inside the loop then it is safe to promote value even if there is another conditional use inside the loop.
llvm-svn: 42493
2007-10-01 18:12:58 +00:00
Devang Patel 7bba386f72 Handle multiple induction variables.
This fixes PR714.

llvm-svn: 42309
2007-09-25 18:24:48 +00:00
Devang Patel 87d7e8ebcb Add transformation to update loop interation space. Now,
for (i=A; i<N; i++) {
  if (i < X && i > Y)
    do_something();
}

is transformed into

U=min(N,X); L=max(A,Y);
for (i=L;i<U;i++)
  do_somethihg();                            

llvm-svn: 42299
2007-09-25 17:31:19 +00:00
Devang Patel 9e30e1a3be Do not promote null values because it may be unsafe to do so.
llvm-svn: 42270
2007-09-24 20:02:42 +00:00
Devang Patel 361e52f39c Fix PR1692
llvm-svn: 42209
2007-09-21 21:18:19 +00:00
Duncan Sands 416b9f0410 Testcase for PR1678.
llvm-svn: 42171
2007-09-20 18:56:24 +00:00
Nick Lewycky e7be16a053 Excuse me.
llvm-svn: 42158
2007-09-20 00:57:00 +00:00
Nick Lewycky eae7e7d00b Fix optimization. %x = sub %x, %y does not imply that %y is zero.
llvm-svn: 42157
2007-09-20 00:48:36 +00:00
Devang Patel 464276f831 Avoid unsafe promotion.
llvm-svn: 42149
2007-09-19 20:18:51 +00:00
Gabor Greif 49122edc98 rename test, it is obviously misspelled
llvm-svn: 42108
2007-09-18 21:42:39 +00:00